diff --git a/Cargo.lock b/Cargo.lock index db19d8c7c..317579be1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,7 +57,7 @@ dependencies = [ "hex", "log", "parity-scale-codec", - "scale-bits 0.3.0", + "scale-bits", "scale-decode", "scale-encode", "scale-info", @@ -4463,16 +4463,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "scale-bits" -version = "0.3.0" -source = "git+https://github.com/haerdib/scale-bits.git?branch=bh/no-std#24b4b48821322d0b7337dba1e4e3d11441e8a5dd" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", -] - [[package]] name = "scale-bits" version = "0.4.0" @@ -4481,6 +4471,7 @@ checksum = "036575c29af9b6e4866ffb7fa055dbf623fe7a9cc159b33786de6013a6969d89" dependencies = [ "parity-scale-codec", "scale-info", + "serde", ] [[package]] @@ -4490,7 +4481,7 @@ source = "git+https://github.com/scs/scale-decode.git?branch=no-std#d9768dc33ab6 dependencies = [ "parity-scale-codec", "primitive-types", - "scale-bits 0.4.0", + "scale-bits", "scale-decode-derive", "scale-info", "smallvec", @@ -4511,12 +4502,11 @@ dependencies = [ [[package]] name = "scale-encode" version = "0.3.0" -source = "git+https://github.com/scs/scale-encode.git?branch=no-std#1688cf1001530f91c56e5794d072e2b77a81f257" +source = "git+https://github.com/paritytech/scale-encode.git#1d302221cf697f189f46e0ccc1dfd79b36bc524f" dependencies = [ - "derive_more", "parity-scale-codec", "primitive-types", - "scale-bits 0.3.0", + "scale-bits", "scale-encode-derive", "scale-info", "smallvec", @@ -4525,7 +4515,7 @@ dependencies = [ [[package]] name = "scale-encode-derive" version = "0.3.0" -source = "git+https://github.com/scs/scale-encode.git?branch=no-std#1688cf1001530f91c56e5794d072e2b77a81f257" +source = "git+https://github.com/paritytech/scale-encode.git#1d302221cf697f189f46e0ccc1dfd79b36bc524f" dependencies = [ "darling", "proc-macro-crate", @@ -4536,9 +4526,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.8.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad560913365790f17cbf12479491169f01b9d46d29cfc7422bf8c64bdc61b731" +checksum = "b569c32c806ec3abdf3b5869fb8bf1e0d275a7c1c9b0b05603d9464632649edf" dependencies = [ "bitvec", "cfg-if 1.0.0", @@ -4550,9 +4540,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.8.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" +checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6127,9 +6117,9 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "digest 0.10.7", - "rand 0.8.5", + "rand 0.7.3", "static_assertions", ] diff --git a/node-api/Cargo.toml b/node-api/Cargo.toml index c9e63b122..b76796c93 100644 --- a/node-api/Cargo.toml +++ b/node-api/Cargo.toml @@ -17,14 +17,14 @@ either = { version = "1.6.1", default-features = false } frame-metadata = { version = "15.1", default-features = false, features = ["v14", "v15-unstable", "serde_full", "decode"] } hex = { version = "0.4.3", default-features = false } log = { version = "0.4.14", default-features = false } +scale-bits = { version = "0.4.0", default-features = false, features = ["scale-info", "serde"] } scale-info = { version = "2.0.1", features = ["derive", "decode", "bitvec"], default-features = false } serde = { version = "1.0.136", features = ["derive"], default-features = false } serde_json = { version = "1.0.79", default-features = false, features = ["alloc"] } # scale -scale-bits = { default-features = false, features = ["scale-info", "serde"], git = "https://github.com/haerdib/scale-bits.git", branch = "bh/no-std" } scale-decode = { default-features = false, features = ["primitive-types", "derive"], git = "https://github.com/scs/scale-decode.git", branch = "no-std" } -scale-encode = { default-features = false, features = ["bits", "primitive-types", "derive"], git = "https://github.com/scs/scale-encode.git", branch = "no-std" } +scale-encode = { default-features = false, features = ["bits", "primitive-types", "derive"], git = "https://github.com/paritytech/scale-encode.git" } # substrate sp-core = { default-features = false, features = ["full_crypto", "serde"], git = "https://github.com/paritytech/substrate.git", branch = "master" } diff --git a/node-api/src/scale_value/encode.rs b/node-api/src/scale_value/encode.rs index 41115e78d..456f86187 100644 --- a/node-api/src/scale_value/encode.rs +++ b/node-api/src/scale_value/encode.rs @@ -9,7 +9,7 @@ //! Based on https://github.com/paritytech/scale-value/blob/430bfaf8f302dfcfc45d8d63c687628fd9b7fc25/src/scale_impls/encode.rs use crate::scale_value::{Composite, Primitive, Value, ValueDef, Variant}; -use alloc::{string::ToString, vec::Vec}; +use alloc::{boxed::Box, string::ToString, vec::Vec}; use codec::{Compact, Encode}; use scale_encode::{ error::{ErrorKind, Kind}, @@ -45,7 +45,9 @@ impl EncodeAsFields for Value { ) -> Result<(), Error> { match &self.value { ValueDef::Composite(composite) => composite.encode_as_fields_to(fields, types, out), - _ => Err(Error::custom("Cannot encode non-composite Value shape into fields")), + _ => Err(Error::new(ErrorKind::Custom(Box::new( + "Cannot encode non-composite Value shape into fields".to_string(), + )))), } } }