Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cardano-serialization-lib",
"version": "14.1.2",
"version": "15.0.0-beta.1",
"description": "(De)serialization functions for the Cardano blockchain along with related utility functions",
"scripts": {
"publish-all:prod": "node scripts/build-helper.js publish-all --env prod",
Expand Down
3 changes: 2 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cardano-serialization-lib"
version = "14.1.2"
version = "15.0.0-beta.1"
edition = "2018"
authors = ["EMURGO"]
license = "MIT"
Expand All @@ -19,6 +19,7 @@ arbitrary-precision-json = ["serde_json/arbitrary_precision"]
property-test-api = []
generic-serialization = []
with-bench = []
dont-expose-wasm = []

[lib]
crate-type = ["cdylib", "rlib"]
Expand Down
4 changes: 2 additions & 2 deletions rust/json-gen/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions rust/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl std::fmt::Display for DeserializeError {
}
}

#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"), not(feature = "dont-expose-wasm"))))]
impl std::error::Error for DeserializeError {}

impl From<DeserializeError> for JsError {
Expand Down Expand Up @@ -197,16 +197,16 @@ impl From<chain_crypto::PublicKeyError> for DeserializeError {
// Generic string error that is replaced with JsError on wasm builds but still usable from non-wasm builds
// since JsError panics when used for non-constants in non-wasm builds even just creating one

#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten"), not(feature = "dont-expose-wasm")))]
pub type JsError = JsValue;

#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"), not(feature = "dont-expose-wasm"))))]
#[derive(Debug, Clone)]
pub struct JsError {
msg: String,
}

#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"), not(feature = "dont-expose-wasm"))))]
impl JsError {
pub fn from_str(s: &str) -> Self {
Self { msg: s.to_owned() }
Expand All @@ -218,14 +218,14 @@ impl JsError {
}
}

#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"), not(feature = "dont-expose-wasm"))))]
impl std::fmt::Display for JsError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.msg)
}
}

#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"), not(feature = "dont-expose-wasm"))))]
impl std::error::Error for JsError {}

pub(crate) enum BuilderError {
Expand Down
4 changes: 2 additions & 2 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ extern crate num_derive;
use std::convert::TryInto;
use std::io::{BufRead, Seek, Write};

#[cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))]
#[cfg(any(not(all(target_arch = "wasm32", not(target_os = "emscripten"))), feature = "dont-expose-wasm"))]
use noop_proc_macro::wasm_bindgen;

#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten"), not(feature = "dont-expose-wasm")))]
use wasm_bindgen::prelude::{wasm_bindgen, JsValue};

// This file was code-generated using an experimental CDDL to rust tool:
Expand Down
14 changes: 7 additions & 7 deletions rust/src/protocol_types/certificates/certificates_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use std::hash::{Hash, Hasher};
use std::iter::Map;
use itertools::Itertools;
use std::ops::Deref;
use std::rc::Rc;
use std::slice;
use std::sync::Arc;

#[wasm_bindgen]
#[derive(Clone, Debug)]
pub struct Certificates {
pub(crate) certs: Vec<Rc<Certificate>>,
pub(crate) dedup: HashSet<Rc<Certificate>>,
pub(crate) certs: Vec<Arc<Certificate>>,
pub(crate) dedup: HashSet<Arc<Certificate>>,
pub(crate) cbor_set_type: CborSetType,
}

Expand Down Expand Up @@ -44,7 +44,7 @@ impl Certificates {
/// Add a new `Certificate` to the set.
/// Returns `true` if the element was not already present in the set.
pub fn add(&mut self, elem: &Certificate) -> bool {
let rc_elem = Rc::new(elem.clone());
let rc_elem = Arc::new(elem.clone());
if self.dedup.insert(rc_elem.clone()) {
self.certs.push(rc_elem.clone());
true
Expand All @@ -54,7 +54,7 @@ impl Certificates {
}

pub(crate) fn add_move(&mut self, elem: Certificate) {
let rc_elem = Rc::new(elem);
let rc_elem = Arc::new(elem);
if self.dedup.insert(rc_elem.clone()) {
self.certs.push(rc_elem.clone());
}
Expand Down Expand Up @@ -106,8 +106,8 @@ impl Hash for Certificates {
impl<'a> IntoIterator for &'a Certificates {
type Item = &'a Certificate;
type IntoIter = Map<
slice::Iter<'a, Rc<Certificate>>,
fn(&'a Rc<Certificate>) -> &'a Certificate,
slice::Iter<'a, Arc<Certificate>>,
fn(&'a Arc<Certificate>) -> &'a Certificate,
>;

fn into_iter(self) -> Self::IntoIter {
Expand Down
18 changes: 9 additions & 9 deletions rust/src/protocol_types/credentials.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashSet;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::rc::Rc;
use std::sync::Arc;
use itertools::Itertools;
use crate::*;

Expand All @@ -11,8 +11,8 @@ use crate::*;
Debug,
)]
pub struct Credentials {
pub(crate) credentials: Vec<Rc<Credential>>,
pub(crate) dedup: HashSet<Rc<Credential>>,
pub(crate) credentials: Vec<Arc<Credential>>,
pub(crate) dedup: HashSet<Arc<Credential>>,
pub(crate) cbor_set_type: CborSetType,
}

Expand All @@ -29,8 +29,8 @@ impl Credentials {
}

pub(crate) fn new_from_prepared_fields(
credentials: Vec<Rc<Credential>>,
dedup: HashSet<Rc<Credential>>,
credentials: Vec<Arc<Credential>>,
dedup: HashSet<Arc<Credential>>,
) -> Self {
Self {
credentials,
Expand All @@ -50,7 +50,7 @@ impl Credentials {
/// Add a new `Credential` to the set.
/// Returns `true` if the element was not already present in the set.
pub fn add(&mut self,credential: &Credential) -> bool {
let credential_rc = Rc::new(credential.clone());
let credential_rc = Arc::new(credential.clone());
if self.dedup.insert(credential_rc.clone()) {
self.credentials.push(credential_rc);
true
Expand All @@ -60,7 +60,7 @@ impl Credentials {
}

pub(crate) fn add_move(&mut self, credential: Credential) {
let credential_rc = Rc::new(credential);
let credential_rc = Arc::new(credential);
if self.dedup.insert(credential_rc.clone()) {
self.credentials.push(credential_rc);
}
Expand All @@ -75,7 +75,7 @@ impl Credentials {
let mut dedup = HashSet::new();
let mut credentials = Vec::new();
for elem in vec {
let elem_rc = Rc::new(elem);
let elem_rc = Arc::new(elem);
if dedup.insert(elem_rc.clone()) {
credentials.push(elem_rc);
}
Expand All @@ -87,7 +87,7 @@ impl Credentials {
let mut dedup = HashSet::new();
let mut credentials = Vec::new();
for elem in iter {
let elem_rc = Rc::new(elem);
let elem_rc = Arc::new(elem);
if dedup.insert(elem_rc.clone()) {
credentials.push(elem_rc);
}
Expand Down
20 changes: 10 additions & 10 deletions rust/src/protocol_types/ed25519_key_hashes.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::HashSet;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::rc::Rc;
use std::slice;
use std::iter::Map;
use std::sync::Arc;
use itertools::Itertools;
pub use crate::*;

Expand All @@ -15,8 +15,8 @@ pub type RequiredSigners = Ed25519KeyHashes;
Debug,
)]
pub struct Ed25519KeyHashes {
keyhashes: Vec<Rc<Ed25519KeyHash>>,
dedup: HashSet<Rc<Ed25519KeyHash>>,
keyhashes: Vec<Arc<Ed25519KeyHash>>,
dedup: HashSet<Arc<Ed25519KeyHash>>,
cbor_set_type: CborSetType,
}

Expand All @@ -33,8 +33,8 @@ impl Ed25519KeyHashes {
}

pub(crate) fn new_from_prepared_fields(
keyhashes: Vec<Rc<Ed25519KeyHash>>,
dedup: HashSet<Rc<Ed25519KeyHash>>,
keyhashes: Vec<Arc<Ed25519KeyHash>>,
dedup: HashSet<Arc<Ed25519KeyHash>>,
) -> Self {
Self {
keyhashes,
Expand All @@ -54,7 +54,7 @@ impl Ed25519KeyHashes {
/// Add a new `Ed25519KeyHash` to the set.
/// Returns `true` if the element was not already present in the set.
pub fn add(&mut self, keyhash: &Ed25519KeyHash) -> bool {
let keyhash_rc = Rc::new(keyhash.clone());
let keyhash_rc = Arc::new(keyhash.clone());
if self.dedup.insert(keyhash_rc.clone()) {
self.keyhashes.push(keyhash_rc.clone());
true
Expand All @@ -76,7 +76,7 @@ impl Ed25519KeyHashes {
}

pub(crate) fn add_move(&mut self, keyhash: Ed25519KeyHash) {
let keyhash_rc = Rc::new(keyhash);
let keyhash_rc = Arc::new(keyhash);
if self.dedup.insert(keyhash_rc.clone()) {
self.keyhashes.push(keyhash_rc);
}
Expand All @@ -100,7 +100,7 @@ impl Ed25519KeyHashes {
let mut dedup = HashSet::new();
let mut keyhashes = Vec::new();
for keyhash in keyhash_vec {
let keyhash_rc = Rc::new(keyhash.clone());
let keyhash_rc = Arc::new(keyhash.clone());
if dedup.insert(keyhash_rc.clone()) {
keyhashes.push(keyhash_rc);
}
Expand All @@ -121,8 +121,8 @@ impl Ed25519KeyHashes {
impl<'a> IntoIterator for &'a Ed25519KeyHashes {
type Item = &'a Ed25519KeyHash;
type IntoIter = Map<
slice::Iter<'a, Rc<Ed25519KeyHash>>,
fn(&'a Rc<Ed25519KeyHash>) -> &'a Ed25519KeyHash,
slice::Iter<'a, Arc<Ed25519KeyHash>>,
fn(&'a Arc<Ed25519KeyHash>) -> &'a Ed25519KeyHash,
>;

fn into_iter(self) -> Self::IntoIter {
Expand Down
18 changes: 9 additions & 9 deletions rust/src/protocol_types/governance/proposals/voting_proposals.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::rc::Rc;
use std::slice;
use std::iter::Map;
use std::collections::HashSet;
use std::cmp::Ordering;
use std::sync::Arc;
use itertools::Itertools;
use schemars::JsonSchema;
use crate::*;
Expand All @@ -15,8 +15,8 @@ use crate::*;
Debug,
)]
pub struct VotingProposals {
proposals: Vec<Rc<VotingProposal>>,
dedup: HashSet<Rc<VotingProposal>>,
proposals: Vec<Arc<VotingProposal>>,
dedup: HashSet<Arc<VotingProposal>>,
cbor_set_type: CborSetType,
}

Expand All @@ -39,8 +39,8 @@ impl VotingProposals {
}

pub(crate) fn new_from_prepared_fields(
proposals: Vec<Rc<VotingProposal>>,
dedup: HashSet<Rc<VotingProposal>>,
proposals: Vec<Arc<VotingProposal>>,
dedup: HashSet<Arc<VotingProposal>>,
) -> Self {
Self {
proposals,
Expand All @@ -60,7 +60,7 @@ impl VotingProposals {
/// Add a new `VotingProposal` to the set.
/// Returns `true` if the element was not already present in the set.
pub fn add(&mut self, proposal: &VotingProposal) -> bool {
let proposal_rc = Rc::new(proposal.clone());
let proposal_rc = Arc::new(proposal.clone());
if self.dedup.insert(proposal_rc.clone()) {
self.proposals.push(proposal_rc.clone());
true
Expand All @@ -85,7 +85,7 @@ impl VotingProposals {
let mut dedup = HashSet::new();
let mut proposals = Vec::new();
for proposal in proposal_vec {
let proposal_rc = Rc::new(proposal.clone());
let proposal_rc = Arc::new(proposal.clone());
if dedup.insert(proposal_rc.clone()) {
proposals.push(proposal_rc);
}
Expand All @@ -105,8 +105,8 @@ impl VotingProposals {
impl<'a> IntoIterator for &'a VotingProposals {
type Item = &'a VotingProposal;
type IntoIter = Map<
slice::Iter<'a, Rc<VotingProposal>>,
fn(&'a Rc<VotingProposal>) -> &'a VotingProposal,
slice::Iter<'a, Arc<VotingProposal>>,
fn(&'a Arc<VotingProposal>) -> &'a VotingProposal,
>;

fn into_iter(self) -> Self::IntoIter {
Expand Down
Loading