From 223611cfa591495bf729105c9ef971848a37eb66 Mon Sep 17 00:00:00 2001 From: Chevdor Date: Mon, 19 Jun 2023 18:02:30 +0200 Subject: [PATCH 1/6] Fix system.set_code index --- .../substrate-runtime-proposal-hash/src/lib.rs | 18 +++++++++--------- libs/wasm-testbed/src/lib.rs | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/substrate-runtime-proposal-hash/src/lib.rs b/libs/substrate-runtime-proposal-hash/src/lib.rs index f2e7d46..b70119d 100644 --- a/libs/substrate-runtime-proposal-hash/src/lib.rs +++ b/libs/substrate-runtime-proposal-hash/src/lib.rs @@ -18,7 +18,7 @@ pub type CalllHash = [u8; SIZE]; type Prefix = (u8, u8); /// The PREFIX is prepended to the data before hashing -pub const PREFIX_SYSTEM_SETCODE: Prefix = (0x00, 0x03); +pub const PREFIX_SYSTEM_SETCODE: Prefix = (0x00, 0x02); const PARACHAIN_PALLET_ID_ENV: &str = "PARACHAIN_PALLET_ID"; const DEFAULT_PARACHAIN_PALLET_ID: &str = "0x01"; @@ -33,7 +33,7 @@ pub struct SrhResult { pub hash: CalllHash, /// Hex encoded proposal hash. - pub encodedd_hash: String, + pub encoded_hash: String, } /// Concatenate 2 arrays. @@ -47,7 +47,7 @@ pub fn concatenate_arrays(x: &[T], y: &[T]) -> Vec { pub fn get_result(prefix: Prefix, buffer: &[u8]) -> Result { buffer.using_encoded(|wasm_blob: &[u8]| { let result = match get_call_hash(prefix, wasm_blob) { - Ok(hash) => Ok(SrhResult { hash, encodedd_hash: hex::encode(hash) }), + Ok(hash) => Ok(SrhResult { hash, encoded_hash: hex::encode(hash) }), Err(_e) => Err(RuntimePropHashError::HashComputing()), }; result @@ -105,8 +105,8 @@ mod prop_hash_tests { assert_eq!( get_proposal_hash(&[1, 2, 42]).unwrap(), [ - 156, 244, 243, 93, 21, 8, 113, 238, 186, 17, 20, 52, 240, 236, 140, 15, 108, 26, 86, 5, 152, 148, 91, - 162, 108, 168, 3, 65, 254, 162, 114, 46 + 174, 123, 79, 240, 254, 106, 147, 26, 65, 61, 41, 84, 181, 102, 24, 182, 128, 135, 188, 31, 135, 187, + 99, 34, 143, 35, 120, 100, 246, 90, 186, 106 ] ); } @@ -116,8 +116,8 @@ mod prop_hash_tests { assert_eq!( get_call_hash(PREFIX_SYSTEM_SETCODE, &[1, 2, 42]).unwrap(), [ - 156, 244, 243, 93, 21, 8, 113, 238, 186, 17, 20, 52, 240, 236, 140, 15, 108, 26, 86, 5, 152, 148, 91, - 162, 108, 168, 3, 65, 254, 162, 114, 46 + 174, 123, 79, 240, 254, 106, 147, 26, 65, 61, 41, 84, 181, 102, 24, 182, 128, 135, 188, 31, 135, 187, + 99, 34, 143, 35, 120, 100, 246, 90, 186, 106 ] ); } @@ -164,13 +164,13 @@ mod prop_hash_tests { #[test] fn test_get_result() { let res = get_result(PREFIX_SYSTEM_SETCODE, &[1, 2, 42]).unwrap(); - assert!(res.encodedd_hash == "9388ba11b3f2a5db3ef9bf237f1c88ffb369d77ffa843fc67570c89c09fa9c0e"); + assert_eq!(res.encoded_hash, "85233004e044626a6c08e469573369536d8de9b264b08eb6611b76b80148e429"); } #[test] fn test_long_input() { const SIZE_8MB: usize = 8 * 1024 * 1024; let res = get_result(PREFIX_SYSTEM_SETCODE, &[0; SIZE_8MB]).unwrap(); - assert!(res.encodedd_hash == "9348da94fcffe94318313f8ce237211a7fd6c1531ab21b61606a1f7eeb8b2409"); + assert_eq!(res.encoded_hash, "44de98eef7227a1f55c5d1cf2b437dc87e60177dc8607538a115773b567ed0d5"); } } diff --git a/libs/wasm-testbed/src/lib.rs b/libs/wasm-testbed/src/lib.rs index e39321b..eb340c3 100644 --- a/libs/wasm-testbed/src/lib.rs +++ b/libs/wasm-testbed/src/lib.rs @@ -185,7 +185,7 @@ impl WasmTestBed { /// Compute the proposal hash of the runtime pub fn proposal_hash(&self) -> Result { let result: SrhResult = get_result(substrate_runtime_proposal_hash::PREFIX_SYSTEM_SETCODE, &self.bytes)?; - Ok(format!("0x{}", &result.encodedd_hash)) + Ok(format!("0x{}", &result.encoded_hash)) } /// Compute the proposal hash of the runtime From 071e70b40a88176fd7d34a6c50542ed710a87e24 Mon Sep 17 00:00:00 2001 From: Chevdor Date: Tue, 20 Jun 2023 09:21:59 +0200 Subject: [PATCH 2/6] Set version for new release --- .gitignore | 2 + Cargo.lock | 296 +++++++++++++++---------------- Cargo.toml | 2 +- cli/Cargo.toml | 8 +- cli/tests/show.rs | 17 ++ lib/Cargo.toml | 8 +- libs/ipfs-hasher/Cargo.toml | 2 +- libs/substrate-differ/Cargo.toml | 4 +- libs/wasm-testbed/Cargo.toml | 4 +- 9 files changed, 175 insertions(+), 168 deletions(-) create mode 100644 cli/tests/show.rs diff --git a/.gitignore b/.gitignore index 7992649..cfa45ae 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ metadata.* *.jscale *.profraw *.deb + +.vscode diff --git a/Cargo.lock b/Cargo.lock index 836b9e5..cd208cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,7 +27,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.2", + "gimli 0.27.3", ] [[package]] @@ -51,7 +51,7 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] @@ -63,16 +63,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", - "getrandom 0.2.9", + "getrandom 0.2.10", "once_cell", "version_check", ] [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -182,9 +182,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "assert_cmd" @@ -218,7 +218,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide 0.6.2", - "object 0.30.3", + "object 0.30.4", "rustc-demangle", ] @@ -294,8 +294,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" dependencies = [ "arrayref", - "arrayvec 0.7.2", - "constant_time_eq 0.2.5", + "arrayvec 0.7.4", + "constant_time_eq 0.2.6", ] [[package]] @@ -316,21 +316,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6637f448b9e61dfadbdcbae9a885fadee1f3eaffb1f8d3c1965d3ade8bdfd44f" dependencies = [ "arrayref", - "arrayvec 0.7.2", - "constant_time_eq 0.2.5", + "arrayvec 0.7.4", + "constant_time_eq 0.2.6", ] [[package]] name = "blake3" -version = "1.3.3" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", - "arrayvec 0.7.2", + "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq 0.2.5", + "constant_time_eq 0.2.6", ] [[package]] @@ -381,9 +381,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "bounded-collections" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07fbd1d11282a1eb134d3c3b7cf8ce213b5161c6e5f73fb1b98618482c606b64" +checksum = "eb5b05133427c07c4776906f673ccf36c21b102c9829c641a5b56bd151d44fd6" dependencies = [ "log", "parity-scale-codec", @@ -498,9 +498,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.0" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" +checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" dependencies = [ "clap_builder", "clap_derive", @@ -509,9 +509,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.0" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" +checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" dependencies = [ "anstream", "anstyle", @@ -525,9 +525,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.0" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", @@ -618,9 +618,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "constant_time_eq" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" +checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" [[package]] name = "convert_case" @@ -679,9 +679,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -701,7 +701,7 @@ version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", @@ -817,22 +817,22 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset 0.9.0", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -1282,9 +1282,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1304,7 +1304,7 @@ dependencies = [ [[package]] name = "frame-metadata" version = "15.1.0" -source = "git+https://github.com/paritytech/frame-metadata?branch=main#0c6400964fe600ea07f8233810415f6958fe4e20" +source = "git+https://github.com/paritytech/frame-metadata?branch=main#d6e6c2bf820bd2067aadd7420f361cacaddbb09e" dependencies = [ "cfg-if", "parity-scale-codec", @@ -1455,9 +1455,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -1477,9 +1477,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" [[package]] name = "h2" @@ -1679,9 +1679,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1702,9 +1702,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1787,7 +1787,7 @@ dependencies = [ [[package]] name = "ipfs-hasher" -version = "1.0.0-alpha9" +version = "0.20.0" dependencies = [ "ipfs-unixfs", "thiserror", @@ -1822,7 +1822,7 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix 0.37.19", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -1852,9 +1852,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1876,9 +1876,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libm" @@ -1954,9 +1954,9 @@ checksum = "f9275e0933cf8bb20f008924c0cb07a0692fe54d8064996520bf998de9eb79aa" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -1964,9 +1964,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "lru" @@ -2007,7 +2007,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.19", + "rustix 0.37.20", ] [[package]] @@ -2021,9 +2021,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -2161,7 +2161,7 @@ dependencies = [ "core2", "digest 0.10.7", "multihash-derive", - "sha2 0.10.6", + "sha2 0.10.7", "sha3 0.10.8", "unsigned-varint 0.7.1", ] @@ -2230,7 +2230,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "itoa", ] @@ -2289,18 +2289,18 @@ dependencies = [ [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.17.2" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9670a07f94779e00908f3e686eab508878ebb390ba6e604d3a284c00e8d0487b" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -2375,11 +2375,11 @@ checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "parity-scale-codec" -version = "3.5.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ddb756ca205bd108aee3c62c6d3c994e1df84a59b9d6d4a5ea42ee1fd5a9a28" +checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" dependencies = [ - "arrayvec 0.7.2", + "arrayvec 0.7.4", "bitvec", "byte-slice-cast", "bytes", @@ -2390,9 +2390,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2424,7 +2424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -2443,15 +2443,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "smallvec", - "windows-sys 0.45.0", + "windows-targets 0.48.0", ] [[package]] @@ -2480,9 +2480,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" @@ -2597,9 +2597,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -2696,7 +2696,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -2754,7 +2754,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", "redox_syscall 0.2.16", "thiserror", ] @@ -2793,9 +2793,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81ca098a9821bd52d6b24fd8b10bd081f47d39c22778cafaa75a2857a62c6390" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", @@ -2921,9 +2921,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.19" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", @@ -2935,21 +2935,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c911ba11bc8433e811ce56fde130ccf32f5127cab0e0194e9c68c5a5b671791e" +checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f" dependencies = [ "log", "ring", @@ -2959,9 +2947,9 @@ dependencies = [ [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -3217,18 +3205,18 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", @@ -3237,9 +3225,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" dependencies = [ "itoa", "ryu", @@ -3309,9 +3297,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -3529,7 +3517,7 @@ dependencies = [ "blake2b_simd 1.0.1", "byteorder", "digest 0.10.7", - "sha2 0.10.6", + "sha2 0.10.7", "sha3 0.10.8", "sp-std", "twox-hash", @@ -3883,7 +3871,7 @@ dependencies = [ [[package]] name = "substrate-differ" -version = "1.0.0-alpha9" +version = "0.20.0" dependencies = [ "comparable", "document-features", @@ -3900,7 +3888,7 @@ dependencies = [ [[package]] name = "substrate-runtime-proposal-hash" -version = "1.0.0-alpha9" +version = "0.20.0" dependencies = [ "blake2", "frame-metadata 15.1.0 (git+https://github.com/paritytech/frame-metadata?branch=main)", @@ -3921,7 +3909,7 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "subwasm" -version = "1.0.0-alpha9" +version = "0.20.0" dependencies = [ "assert_cmd", "clap", @@ -3941,7 +3929,7 @@ dependencies = [ [[package]] name = "subwasmlib" -version = "1.0.0-alpha9" +version = "0.20.0" dependencies = [ "calm_io", "frame-metadata 15.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4012,15 +4000,16 @@ checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.19", - "windows-sys 0.45.0", + "rustix 0.37.20", + "windows-sys 0.48.0", ] [[package]] @@ -4089,7 +4078,7 @@ dependencies = [ "pbkdf2 0.11.0", "rand 0.8.5", "rustc-hash", - "sha2 0.10.6", + "sha2 0.10.7", "thiserror", "unicode-normalization", "wasm-bindgen", @@ -4180,9 +4169,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "8803eee176538f94ae9a14b55b2804eb7e1441f8210b1c31290b3bccdccff73b" dependencies = [ "proc-macro2", "quote", @@ -4304,7 +4293,7 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "rustls 0.21.1", + "rustls", "rustls-native-certs", "sha1", "thiserror", @@ -4417,27 +4406,27 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "2.6.2" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338b31dd1314f68f3aabf3ed57ab922df95ffcd902476ca7ba3c4ce7b908c46d" +checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9" dependencies = [ - "base64 0.13.1", + "base64 0.21.2", "flate2", "log", "once_cell", - "rustls 0.20.8", + "rustls", + "rustls-webpki", "serde", "serde_json", "url", - "webpki", "webpki-roots", ] [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -4458,11 +4447,11 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.3.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" +checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" dependencies = [ - "getrandom 0.2.9", + "getrandom 0.2.10", ] [[package]] @@ -4494,11 +4483,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -4516,9 +4504,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -4526,9 +4514,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", @@ -4541,9 +4529,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.36" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -4553,9 +4541,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4563,9 +4551,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", @@ -4576,9 +4564,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.86" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-instrument" @@ -4591,7 +4579,7 @@ dependencies = [ [[package]] name = "wasm-loader" -version = "1.0.0-alpha9" +version = "0.20.0" dependencies = [ "array-bytes 6.1.0", "assert_cmd", @@ -4610,7 +4598,7 @@ dependencies = [ [[package]] name = "wasm-testbed" -version = "1.0.0-alpha9" +version = "0.20.0" dependencies = [ "frame-metadata 15.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex", @@ -4725,7 +4713,7 @@ dependencies = [ "log", "rustix 0.36.14", "serde", - "sha2 0.10.6", + "sha2 0.10.7", "toml", "windows-sys 0.42.0", "zstd 0.11.2+zstd.1.5.2", @@ -4855,9 +4843,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.63" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -4875,11 +4863,11 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.6" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" dependencies = [ - "webpki", + "rustls-webpki", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 727be10..12cdd3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "1.0.0-alpha9" +version = "0.20.0" authors = ["chevdor ", "Wilfried Kopp "] edition = "2021" diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8d288e5..ee53bf6 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -39,10 +39,10 @@ color-eyre = "0.6" thiserror = "1.0" env_logger = "0.10" log = "0.4" -substrate-runtime-proposal-hash = { version = "1.0.0-alpha9", path = "../libs/substrate-runtime-proposal-hash", optional = true } -subwasmlib = { version = "1.0.0-alpha9", path = "../lib" } -wasm-loader = { version = "1.0.0-alpha9", path = "../libs/wasm-loader" } -wasm-testbed = { version = "1.0.0-alpha9", path = "../libs/wasm-testbed" } +substrate-runtime-proposal-hash = { version = "0.20.0", path = "../libs/substrate-runtime-proposal-hash", optional = true } +subwasmlib = { version = "0.20.0", path = "../lib" } +wasm-loader = { version = "0.20.0", path = "../libs/wasm-loader" } +wasm-testbed = { version = "0.20.0", path = "../libs/wasm-testbed" } serde_json = "1.0" text-style = { version = "0.3", features = ["crossterm"] } sp-runtime = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } diff --git a/cli/tests/show.rs b/cli/tests/show.rs new file mode 100644 index 0000000..12f9050 --- /dev/null +++ b/cli/tests/show.rs @@ -0,0 +1,17 @@ +mod test_utils; +#[cfg(test)] +mod cli_tests { + #[cfg(test)] + mod show { + use assert_cmd::Command as AssertCommand; + + #[test] + fn it_shows_metadata() { + let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); + + let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let assert = cmd.args(["show", "--json"]).arg(test_wasm).assert(); + assert.success().code(0); + } + } +} diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 31b896f..ef550e2 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -38,10 +38,10 @@ scale-info = { version = "2.1", default-features = false, features = [ "derive", ] } sp-version = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -ipfs-hasher = { version = "1.0.0-alpha9", path = "../libs/ipfs-hasher" } -wasm-loader = { version = "1.0.0-alpha9", path = "../libs/wasm-loader" } -wasm-testbed = { version = "1.0.0-alpha9", path = "../libs/wasm-testbed" } -substrate-differ = { version = "1.0.0-alpha9", path = "../libs/substrate-differ" } +ipfs-hasher = { version = "0.20.0", path = "../libs/ipfs-hasher" } +wasm-loader = { version = "0.20.0", path = "../libs/wasm-loader" } +wasm-testbed = { version = "0.20.0", path = "../libs/wasm-testbed" } +substrate-differ = { version = "0.20.0", path = "../libs/substrate-differ" } url = "2.3.1" reqwest = { version = "0.11", features = ["blocking"] } semver = "1.0.17" diff --git a/libs/ipfs-hasher/Cargo.toml b/libs/ipfs-hasher/Cargo.toml index 0527f84..3af2baa 100644 --- a/libs/ipfs-hasher/Cargo.toml +++ b/libs/ipfs-hasher/Cargo.toml @@ -13,4 +13,4 @@ ipfs-unixfs = "0.2" thiserror = "1.0" [dev-dependencies] -wasm-loader = { version = "1.0.0-alpha9", path = "../wasm-loader" } +wasm-loader = { version = "0.20.0", path = "../wasm-loader" } diff --git a/libs/substrate-differ/Cargo.toml b/libs/substrate-differ/Cargo.toml index e881307..b55391c 100644 --- a/libs/substrate-differ/Cargo.toml +++ b/libs/substrate-differ/Cargo.toml @@ -12,7 +12,7 @@ document-features = { version = "0.2" } thiserror = "1.0" serde = { version = "1.0", features = ["derive", "rc"] } comparable = { version = ">=0.5.3", features = ["derive", "serde"] } -wasm-testbed = { version = "1.0.0-alpha9", path = "../wasm-testbed" } +wasm-testbed = { version = "0.20.0", path = "../wasm-testbed" } scale-info = { version = "2.1.2", default-features = false, features = [ "derive", "std", @@ -26,7 +26,7 @@ frame-metadata = { version = "15", package = "frame-metadata", features = [ ] } [dev-dependencies] -wasm-loader = { version = "1.0.0-alpha9", path = "../wasm-loader" } +wasm-loader = { version = "0.20.0", path = "../wasm-loader" } [features] ## The default feature currently excludes feature that are deprecated diff --git a/libs/wasm-testbed/Cargo.toml b/libs/wasm-testbed/Cargo.toml index d5fa2fd..a532219 100644 --- a/libs/wasm-testbed/Cargo.toml +++ b/libs/wasm-testbed/Cargo.toml @@ -21,8 +21,8 @@ repository = "https://github.com/chevdor/subwasm" hex = "0.4" log = "0.4" thiserror = "1.0" -wasm-loader = { version = "1.0.0-alpha9", path = "../wasm-loader" } -substrate-runtime-proposal-hash = { version = "1.0.0-alpha9", path = "../substrate-runtime-proposal-hash" } +wasm-loader = { version = "0.20.0", path = "../wasm-loader" } +substrate-runtime-proposal-hash = { version = "0.20.0", path = "../substrate-runtime-proposal-hash" } sc-executor = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } sc-executor-common = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } scale = { version = "3", package = "parity-scale-codec", default-features = false } From 27589cc6b610dcdcde8825584b0e63af1382c744 Mon Sep 17 00:00:00 2001 From: Chevdor Date: Tue, 20 Jun 2023 10:04:10 +0200 Subject: [PATCH 3/6] Replace unwrap by expect statements --- cli/tests/compress.rs | 8 +- cli/tests/diff.rs | 2 +- cli/tests/get.rs | 4 +- cli/tests/info.rs | 4 +- cli/tests/meta.rs | 4 +- cli/tests/misc.rs | 2 +- cli/tests/show.rs | 2 +- cli/tests/test_utils.rs | 2 +- lib/src/chain_info.rs | 18 ++--- lib/src/github_ref.rs | 2 +- lib/src/source.rs | 13 ++-- lib/src/types.rs | 9 ++- libs/ipfs-hasher/src/lib.rs | 11 +-- .../src/differs/reduced/diff_analyzer/mod.rs | 73 ++++++++++--------- .../src/differs/reduced/reduced_runtime.rs | 16 ++-- .../differs/reduced/v14/reduced_runtime.rs | 28 +++---- .../src/differs/test_runtimes.rs | 2 +- .../src/lib.rs | 14 ++-- libs/wasm-loader/src/compression.rs | 4 +- libs/wasm-loader/src/lib.rs | 10 +-- libs/wasm-loader/src/source.rs | 4 +- libs/wasm-testbed/src/lib.rs | 31 ++++---- 22 files changed, 142 insertions(+), 121 deletions(-) diff --git a/cli/tests/compress.rs b/cli/tests/compress.rs index 9acea68..7ceb4db 100644 --- a/cli/tests/compress.rs +++ b/cli/tests/compress.rs @@ -11,10 +11,10 @@ mod cli_tests { fn it_does_basic_compress_decompress() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); cmd.args(["decompress", test_wasm, "/tmp/decompressed.wasm"]).assert().success().code(0); - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); cmd.args(["compress", "/tmp/decompressed.wasm", "/tmp/new_compressed.wasm"]).assert().success().code(0); } @@ -22,10 +22,10 @@ mod cli_tests { fn it_does_decompress_on_already() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); cmd.args(["decompress", test_wasm, "/tmp/decompressed.wasm"]).assert().success().code(0); - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); cmd.args(["decompress", "/tmp/decompressed.wasm", "/tmp/new_decompressed.wasm"]).assert().success().code(0); } } diff --git a/cli/tests/diff.rs b/cli/tests/diff.rs index bc79826..d326254 100644 --- a/cli/tests/diff.rs +++ b/cli/tests/diff.rs @@ -10,7 +10,7 @@ mod cli_tests { fn it_shows_metadata() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.args(["meta", test_wasm]).assert(); assert.success().code(0); } diff --git a/cli/tests/get.rs b/cli/tests/get.rs index e58483c..a942ad7 100644 --- a/cli/tests/get.rs +++ b/cli/tests/get.rs @@ -9,7 +9,7 @@ mod cli_tests { #[test] fn it_gets_a_runtime() { const TARGET: &str = "/tmp/polkadot_runtime.wasm"; - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.args(["get", "--output", TARGET, "wss://rpc.polkadot.io:443"]).assert(); assert.success().code(0); @@ -18,7 +18,7 @@ mod cli_tests { #[test] fn it_fails_on_bad_chain() { - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.args(["get", "--chain", "foobar"]).assert(); assert.failure().code(101); diff --git a/cli/tests/info.rs b/cli/tests/info.rs index ffa4015..08df203 100644 --- a/cli/tests/info.rs +++ b/cli/tests/info.rs @@ -8,7 +8,7 @@ mod cli_tests { #[test] fn it_fails_without_source() { - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.arg("info tcp://foo.bar").assert(); assert.failure().code(2); } @@ -17,7 +17,7 @@ mod cli_tests { fn it_returns_infos() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.args(["info", test_wasm]).assert(); assert.success().code(0); } diff --git a/cli/tests/meta.rs b/cli/tests/meta.rs index a5ccd58..f489fd0 100644 --- a/cli/tests/meta.rs +++ b/cli/tests/meta.rs @@ -9,14 +9,14 @@ mod cli_tests { fn it_shows_metadata() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); - let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.args(["meta", test_wasm]).assert(); assert.success().code(0); } // #[test] // fn it_shows_when_piped() { - // // let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + // // let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); // // let assert = cmd.args(["get", "wss://rpc.polkadot.io:443", "--output", "runtime.wasm"]).assert(); // // assert.success().code(0); diff --git a/cli/tests/misc.rs b/cli/tests/misc.rs index 20d55a7..36596b7 100644 --- a/cli/tests/misc.rs +++ b/cli/tests/misc.rs @@ -7,7 +7,7 @@ mod cli_tests { #[test] fn it_shows_help() { - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.arg("--help").assert(); assert.success().code(0); } diff --git a/cli/tests/show.rs b/cli/tests/show.rs index 12f9050..92b9136 100644 --- a/cli/tests/show.rs +++ b/cli/tests/show.rs @@ -9,7 +9,7 @@ mod cli_tests { fn it_shows_metadata() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); - let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); let assert = cmd.args(["show", "--json"]).arg(test_wasm).assert(); assert.success().code(0); } diff --git a/cli/tests/test_utils.rs b/cli/tests/test_utils.rs index 9649fa8..8aac83e 100644 --- a/cli/tests/test_utils.rs +++ b/cli/tests/test_utils.rs @@ -9,7 +9,7 @@ pub fn ensure_local_wasm() -> String { const WASM_FILE: &str = "/tmp/runtime.wasm"; let mut retry = 0; - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); if PathBuf::from(WASM_FILE).exists() { println!("Found an existing runtime, reusing..."); diff --git a/lib/src/chain_info.rs b/lib/src/chain_info.rs index a877daa..d3d9a6a 100644 --- a/lib/src/chain_info.rs +++ b/lib/src/chain_info.rs @@ -95,36 +95,36 @@ mod tests { #[test] fn it_gets_chain_endpoints() { assert!(ChainInfo::from_str("local").is_ok()); - assert!(ChainInfo::from_str("local").unwrap().endpoints.len() == 1); + assert_eq!(1, ChainInfo::from_str("local").expect("Failed getting ChainInfo from string").endpoints.len()); assert!(ChainInfo::from_str("polkadot").is_ok()); assert!(ChainInfo::from_str("PolkaDOT").is_ok()); - assert!(!ChainInfo::from_str("polkadot").unwrap().endpoints.is_empty()); + assert!(!ChainInfo::from_str("polkadot").expect("Failed getting ChainInfo from string").endpoints.is_empty()); assert!(ChainInfo::from_str("foobar").is_err()); } #[test] fn it_returns_a_url() { - let info = ChainInfo::from_str("polkadot").unwrap(); - let _endpoint = info.get_random_url(None).unwrap(); + let info = ChainInfo::from_str("polkadot").expect("Failed getting ChainInfo from string"); + let _endpoint = info.get_random_url(None).expect("Failed getting url"); } #[test] fn it_returns_a_http_url() { - let info = ChainInfo::from_str("local").unwrap(); - let endpoint = info.get_random_url(Some(EndpointType::Http)).unwrap(); + let info = ChainInfo::from_str("local").expect("Failed getting ChainInfo from string"); + let endpoint = info.get_random_url(Some(EndpointType::Http)).expect("Failed getting url"); assert!(endpoint.to_string().starts_with("http")); } #[test] fn it_returns_a_ws_url() { - let info = ChainInfo::from_str("polkadot").unwrap(); - let endpoint = info.get_random_url(Some(EndpointType::WesbSocket)).unwrap(); + let info = ChainInfo::from_str("polkadot").expect("Failed getting ChainInfo from string"); + let endpoint = info.get_random_url(Some(EndpointType::WesbSocket)).expect("Failed getting url"); assert!(endpoint.to_string().starts_with("ws")); } #[test] fn test_chain_info() { - let ci = ChainInfo::from_str("polkadot").unwrap(); + let ci = ChainInfo::from_str("polkadot").expect("Failed getting ChainInfo from string"); assert!(!ci.endpoints.is_empty()); } } diff --git a/lib/src/github_ref.rs b/lib/src/github_ref.rs index 54b96ce..5adbd11 100644 --- a/lib/src/github_ref.rs +++ b/lib/src/github_ref.rs @@ -75,7 +75,7 @@ mod test_github_ref { #[test] fn test_as_url() { - let gh = GithubRef::from_str("kusama@1.2.3").unwrap(); + let gh = GithubRef::from_str("kusama@1.2.3").expect("Failed parsing GithubRef"); assert_eq!("https://github.com/paritytech/polkadot/releases/download/v1.2.3/kusama_runtime-v230.compact.compressed.wasm", gh.as_url().as_str()); } } diff --git a/lib/src/source.rs b/lib/src/source.rs index 89f8788..53e2c05 100644 --- a/lib/src/source.rs +++ b/lib/src/source.rs @@ -208,7 +208,7 @@ mod tests_source { let urls = vec!["ws://localhost:9933", "wss://localhost:9933"]; for url in urls { - let src = Source::try_from(url).unwrap(); + let src = Source::try_from(url).expect("Failing parsing source"); match src { Source::Chain(r) => match r.endpoint { NodeEndpoint::WebSocket(ws) => assert_eq!(ws, url), @@ -242,7 +242,7 @@ mod tests_source { ]; for url in urls { - let src = Source::try_from(url).unwrap(); + let src = Source::try_from(url).expect("Failing parsing source"); match src { Source::Chain(r) => match r.endpoint { NodeEndpoint::Http(http) => assert_eq!(http, url), @@ -258,7 +258,7 @@ mod tests_source { let names = vec!["polkadot", "dot"]; for name in names { - assert!(matches!(Source::try_from(name).unwrap(), Source::Alias(_))); + assert!(matches!(Source::try_from(name).expect("Failing parsing source"), Source::Alias(_))); } } @@ -267,7 +267,7 @@ mod tests_source { let urls = vec!["https://github.com/paritytech/polkadot/releases/download/v0.9.42/kusama_runtime-v9420.compact.compressed.wasm"]; for url in urls { - let src = Source::try_from(url).unwrap(); + let src = Source::try_from(url).expect("Failing parsing source"); assert!(matches!(src, Source::URL(_))); } } @@ -282,7 +282,10 @@ mod tests_source { let files = vec![path]; for file in files { - assert_eq!(Source::try_from(file.as_str()).unwrap(), Source::File(PathBuf::from(file))); + assert_eq!( + Source::try_from(file.as_str()).expect("Failing parsing source"), + Source::File(PathBuf::from(file)) + ); } } diff --git a/lib/src/types.rs b/lib/src/types.rs index 35d7760..2e7eb7c 100644 --- a/lib/src/types.rs +++ b/lib/src/types.rs @@ -43,16 +43,19 @@ mod test_super { #[test] fn it_passes_common_tests() { assert!( - Filter::from_str("Module.caLL").unwrap() + Filter::from_str("Module.caLL").expect("Failed init filter") == Filter { module: "module".to_string(), call: Some("call".to_string()) } ); assert!( - Filter::from_str("module.call.foobar").unwrap() + Filter::from_str("module.call.foobar").expect("Failed init filter") == Filter { module: "module".to_string(), call: Some("call".to_string()) } ); - assert!(Filter::from_str("module").unwrap() == Filter { module: "module".to_string(), call: None }); + assert!( + Filter::from_str("module").expect("Failed init filter") + == Filter { module: "module".to_string(), call: None } + ); assert!(Filter::from_str("").is_err()); } diff --git a/libs/ipfs-hasher/src/lib.rs b/libs/ipfs-hasher/src/lib.rs index 81ca765..8f6338e 100644 --- a/libs/ipfs-hasher/src/lib.rs +++ b/libs/ipfs-hasher/src/lib.rs @@ -56,14 +56,14 @@ mod tests { #[test] fn it_works_with_single_block() { let hasher = IpfsHasher::default(); - let ipfs = hasher.compute(b"foobar\n").unwrap(); + let ipfs = hasher.compute(b"foobar\n").expect("Failed computing hash"); assert!(ipfs == "QmRgutAxd8t7oGkSm4wmeuByG6M51wcTso6cubDdQtuEfL"); } #[test] fn it_works_with_multiple_blocks() { let hasher = IpfsHasher::new(2); - let ipfs = hasher.compute(b"foobar\n").unwrap(); + let ipfs = hasher.compute(b"foobar\n").expect("Failed computing a hash"); assert!(ipfs == "QmRJHYTNvC3hmd9gJQARxLR1QMEincccBV53bBw524yyq6"); } @@ -72,10 +72,11 @@ mod tests { fn it_computes_a_runtime_ipfs_hash() { const POLKADOT_BLOCK20: &str = "0x4d6a0bca208b85d41833a7f35cf73d1ae6974f4bad8ab576e2c3f751d691fe6c"; // Polkadot Block #20 - let ocb = OnchainBlock::new("wss://rpc.polkadot.io:443", Some(POLKADOT_BLOCK20.to_string())).unwrap(); - let loader = WasmLoader::load_from_source(&Source::Chain(ocb)).unwrap(); + let ocb = OnchainBlock::new("wss://rpc.polkadot.io:443", Some(POLKADOT_BLOCK20.to_string())) + .expect("Failed getting onchain block"); + let loader = WasmLoader::load_from_source(&Source::Chain(ocb)).expect("Failed loading wasm"); let hasher = IpfsHasher::default(); - let cid = hasher.compute(loader.uncompressed_bytes()).unwrap(); + let cid = hasher.compute(loader.uncompressed_bytes()).expect("Failed computing hash"); assert!(cid == "QmevKMGkRViXfQMSZ38DBdcJ1cXcXf9sXdfXie8Jkc7ZGs"); } } diff --git a/libs/substrate-differ/src/differs/reduced/diff_analyzer/mod.rs b/libs/substrate-differ/src/differs/reduced/diff_analyzer/mod.rs index 0b7e723..fc3808e 100644 --- a/libs/substrate-differ/src/differs/reduced/diff_analyzer/mod.rs +++ b/libs/substrate-differ/src/differs/reduced/diff_analyzer/mod.rs @@ -41,15 +41,15 @@ mod test_diffanalyzer { fn analyze(rf1: RuntimeFile, rf2: RuntimeFile) -> Option { let a = get_runtime_file(rf1).expect("Runtime file should exist"); - let ra = WasmTestBed::new(&Source::File(a)).unwrap().metadata().into(); + let ra = WasmTestBed::new(&Source::File(a)).expect("Failed loading runtime").metadata().into(); let b = get_runtime_file(rf2).expect("Runtime file should exist"); - let rb = WasmTestBed::new(&Source::File(b)).unwrap().metadata().into(); + let rb = WasmTestBed::new(&Source::File(b)).expect("Failed loading runtime").metadata().into(); ReducedDiffResult::new(ra, rb).changes.map(DiffAnalyzer::new) } fn check_tx_version_bump(runtime_a: PathBuf, runtime_b: PathBuf) -> bool { - let a = WasmTestBed::new(&Source::File(runtime_a)).unwrap(); - let b = WasmTestBed::new(&Source::File(runtime_b)).unwrap(); + let a = WasmTestBed::new(&Source::File(runtime_a)).expect("Failed loading runtime"); + let b = WasmTestBed::new(&Source::File(runtime_b)).expect("Failed loading runtime"); let ra = a.metadata().into(); let rb = b.metadata().into(); @@ -79,16 +79,16 @@ mod test_diffanalyzer { #[ignore = "local data"] fn test_require_tx_version_bump_9260_9260() { assert!(check_tx_version_bump( - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).unwrap(), - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).unwrap(), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Failed loading runtime"), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Failed loading runtime"), )); } #[test] #[ignore = "local data"] fn test_require_tx_version_bump_9400_9420() { - let r1 = get_runtime_file(RuntimeFile::new(Chain::Statemint, 14, 9400)).unwrap(); - let r2 = get_runtime_file(RuntimeFile::new(Chain::Statemint, 14, 9420)).unwrap(); + let r1 = get_runtime_file(RuntimeFile::new(Chain::Statemint, 14, 9400)).expect("Failed loading runtime"); + let r2 = get_runtime_file(RuntimeFile::new(Chain::Statemint, 14, 9420)).expect("Failed loading runtime"); let compat = check_tx_version_bump(r1, r2); assert!(compat); } @@ -96,8 +96,10 @@ mod test_diffanalyzer { #[test] #[ignore = "local data"] fn test_not_require_tx_version_bump_collectives_9400_9420() { - let r1 = get_runtime_file(RuntimeFile::new(Chain::CollectivesPolkadot, 14, 9400)).unwrap(); - let r2 = get_runtime_file(RuntimeFile::new(Chain::CollectivesPolkadot, 14, 9420)).unwrap(); + let r1 = + get_runtime_file(RuntimeFile::new(Chain::CollectivesPolkadot, 14, 9400)).expect("Failed loading runtime"); + let r2 = + get_runtime_file(RuntimeFile::new(Chain::CollectivesPolkadot, 14, 9420)).expect("Failed loading runtime"); let compat = check_tx_version_bump(r1, r2); assert!(!compat); } @@ -106,8 +108,8 @@ mod test_diffanalyzer { #[ignore = "local data"] fn test_require_tx_version_bump_9270_9270() { assert!(check_tx_version_bump( - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9270)).unwrap(), - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9270)).unwrap(), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9270)).expect("Failed loading runtime"), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9270)).expect("Failed loading runtime"), )); } @@ -115,8 +117,8 @@ mod test_diffanalyzer { #[ignore = "local data"] fn test_require_tx_version_bump_not_9260_9270() { assert!(!check_tx_version_bump( - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).unwrap(), - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9280)).unwrap(), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Failed loading runtime"), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9280)).expect("Failed loading runtime"), )); } @@ -124,8 +126,8 @@ mod test_diffanalyzer { #[ignore = "local data"] fn test_require_tx_version_bump_ksm_not_9280_9290() { assert!(!check_tx_version_bump( - get_runtime_file(RuntimeFile::new(Chain::Kusama, 14, 9280)).unwrap(), - get_runtime_file(RuntimeFile::new(Chain::Kusama, 14, 9290)).unwrap(), + get_runtime_file(RuntimeFile::new(Chain::Kusama, 14, 9280)).expect("Failed loading runtime"), + get_runtime_file(RuntimeFile::new(Chain::Kusama, 14, 9290)).expect("Failed loading runtime"), )); } @@ -133,17 +135,17 @@ mod test_diffanalyzer { #[ignore = "local data"] fn test_require_tx_version_bump_dot_not_9280_9290() { assert!(!check_tx_version_bump( - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9280)).unwrap(), - get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9290)).unwrap(), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9280)).expect("Failed loading runtime"), + get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9290)).expect("Failed loading runtime"), )); } #[test] #[ignore = "local data"] fn test_changes_9280_9290() { - let da = - analyze(RuntimeFile::new(Chain::Polkadot, 14, 9280), RuntimeFile::new(Chain::Polkadot, 14, 9290)).unwrap(); - let pallet_system_changes = da.get_pallet_changes(0).unwrap(); + let da = analyze(RuntimeFile::new(Chain::Polkadot, 14, 9280), RuntimeFile::new(Chain::Polkadot, 14, 9290)) + .expect("Failed loading runtime"); + let pallet_system_changes = da.get_pallet_changes(0).expect("Failed loading runtime"); println!("pallet_system_changes = {pallet_system_changes:#?}"); // There is a single change in the system pallet between 9280 and 9290: Constant: Version @@ -157,7 +159,7 @@ mod test_diffanalyzer { _ => panic!("Unexpected change while comparing 9280 and 9290"), } - let pallet_balances_changes = da.get_pallet_changes(4).unwrap(); + let pallet_balances_changes = da.get_pallet_changes(4).expect("Failed loading runtime"); println!("pallet_balances_changes = {pallet_balances_changes:#?}"); // There is a single change in the balances pallet between 9280 and 9290: Calls: Signature changed @@ -177,8 +179,8 @@ mod test_diffanalyzer { #[cfg(feature = "v14")] #[ignore = "local data"] fn test_different_variants_v13_v14() { - let a = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13_1))).unwrap(); - let b = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V14))).unwrap(); + let a = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13_1))).expect("Failed loading runtime"); + let b = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V14))).expect("Failed loading runtime"); let _differ = ReducedDiffer::new(a.metadata(), b.metadata()); } @@ -186,8 +188,8 @@ mod test_diffanalyzer { #[cfg(feature = "v13")] #[ignore = "local data"] fn test_v13() { - let a = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13_1))).unwrap(); - let b = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13_2))).unwrap(); + let a = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13_1))).expect("Failed loading runtime"); + let b = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13_2))).expect("Failed loading runtime"); let comp = ReducedDiffer::compare(&a, &b); } @@ -203,8 +205,8 @@ mod test_diffanalyzer { #[cfg(all(feature = "v13", feature = "v14"))] #[ignore = "local data"] fn test_v14_polkadot_9100_9260() { - let diff = - analyze(RuntimeFile::new(Chain::Polkadot, 14, 9100), RuntimeFile::new(Chain::Polkadot, 14, 9260)).unwrap(); + let diff = analyze(RuntimeFile::new(Chain::Polkadot, 14, 9100), RuntimeFile::new(Chain::Polkadot, 14, 9260)) + .expect("Failed loading runtime"); assert!(!diff.require_tx_version_bump()) } @@ -213,8 +215,8 @@ mod test_diffanalyzer { #[cfg(feature = "v14")] #[ignore = "local data"] fn test_v14_polkadot_9260_9270_full() { - let diff = - analyze(RuntimeFile::new(Chain::Polkadot, 14, 9260), RuntimeFile::new(Chain::Polkadot, 14, 9270)).unwrap(); + let diff = analyze(RuntimeFile::new(Chain::Polkadot, 14, 9260), RuntimeFile::new(Chain::Polkadot, 14, 9270)) + .expect("Failed loading runtime"); assert!(!diff.require_tx_version_bump()) } @@ -224,7 +226,8 @@ mod test_diffanalyzer { #[ignore = "local data"] fn test_v14_polkadot_9260_9270_content() { let analyzer = - analyze(RuntimeFile::new(Chain::Polkadot, 14, 9260), RuntimeFile::new(Chain::Polkadot, 14, 9270)).unwrap(); + analyze(RuntimeFile::new(Chain::Polkadot, 14, 9260), RuntimeFile::new(Chain::Polkadot, 14, 9270)) + .expect("Failed loading runtime"); let pallet_changes = analyzer.changes.get_pallets_changes(); assert_eq!(4, pallet_changes.len()); assert!(!analyzer.require_tx_version_bump()); @@ -235,8 +238,8 @@ mod test_diffanalyzer { #[ignore = "local data"] #[should_panic] fn test_unsupported_variants() { - let diff = - analyze(RuntimeFile::new(Chain::Polkadot, 12, 9000), RuntimeFile::new(Chain::Polkadot, 12, 9000)).unwrap(); + let diff = analyze(RuntimeFile::new(Chain::Polkadot, 12, 9000), RuntimeFile::new(Chain::Polkadot, 12, 9000)) + .expect("Failed loading runtime"); assert!(!diff.require_tx_version_bump()) } @@ -245,8 +248,8 @@ mod test_diffanalyzer { #[cfg(feature = "v14")] #[ignore = "local data"] fn test_v14_polkadot_9280_9290_full() { - let diff = - analyze(RuntimeFile::new(Chain::Polkadot, 14, 9280), RuntimeFile::new(Chain::Polkadot, 14, 9290)).unwrap(); + let diff = analyze(RuntimeFile::new(Chain::Polkadot, 14, 9280), RuntimeFile::new(Chain::Polkadot, 14, 9290)) + .expect("Failed loading runtime"); assert!(!diff.require_tx_version_bump()); println!("changes = {:?}", diff.changes); diff --git a/libs/substrate-differ/src/differs/reduced/reduced_runtime.rs b/libs/substrate-differ/src/differs/reduced/reduced_runtime.rs index 3ba783c..b30e71e 100644 --- a/libs/substrate-differ/src/differs/reduced/reduced_runtime.rs +++ b/libs/substrate-differ/src/differs/reduced/reduced_runtime.rs @@ -227,7 +227,8 @@ mod test_reduced_runtime { let runtime_file = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9290)).expect("Runtime file should exist"); - let _reduced_runtime: ReducedRuntime = WasmTestBed::new(&Source::File(runtime_file)).unwrap().metadata().into(); + let _reduced_runtime: ReducedRuntime = + WasmTestBed::new(&Source::File(runtime_file)).expect("Failed loading runtime").metadata().into(); } #[test] @@ -240,9 +241,13 @@ mod test_reduced_runtime { let runtime_file = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9290)).expect("Runtime file should exist"); - let reduced_runtime: ReducedRuntime = WasmTestBed::new(&Source::File(runtime_file)).unwrap().metadata().into(); - assert_eq!(0_u32, reduced_runtime.get_pallet_by_name("System").unwrap().index); - assert_eq!(1_u32, reduced_runtime.get_pallet_by_name("Scheduler").unwrap().index); + let reduced_runtime: ReducedRuntime = + WasmTestBed::new(&Source::File(runtime_file)).expect("Failed loading runtime").metadata().into(); + assert_eq!(0_u32, reduced_runtime.get_pallet_by_name("System").expect("Failed getting pallet by name").index); + assert_eq!( + 1_u32, + reduced_runtime.get_pallet_by_name("Scheduler").expect("Failed getting pallet by name").index + ); } #[test] @@ -254,7 +259,8 @@ mod test_reduced_runtime { let runtime_file = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9290)).expect("Runtime file should exist"); - let reduced_runtime: ReducedRuntime = WasmTestBed::new(&Source::File(runtime_file)).unwrap().metadata().into(); + let reduced_runtime: ReducedRuntime = + WasmTestBed::new(&Source::File(runtime_file)).expect("Failed loading runtime").metadata().into(); println!("extrinsics = {:#?}", reduced_runtime.extrinsic); } diff --git a/libs/substrate-differ/src/differs/reduced/v14/reduced_runtime.rs b/libs/substrate-differ/src/differs/reduced/v14/reduced_runtime.rs index ef4bfeb..07f6141 100644 --- a/libs/substrate-differ/src/differs/reduced/v14/reduced_runtime.rs +++ b/libs/substrate-differ/src/differs/reduced/v14/reduced_runtime.rs @@ -16,19 +16,19 @@ mod test_reduced_conversion { #[cfg(feature = "v14")] fn test_reduce_v14_first_pallet_first_call() { let rtm1 = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Runtime file should exist"); - let testbed = WasmTestBed::new(&Source::File(rtm1)).unwrap(); + let testbed = WasmTestBed::new(&Source::File(rtm1)).expect("Failed loading runtime"); let metadata = testbed.metadata(); match metadata { RuntimeMetadata::V14(v14) => { - let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).unwrap(); + let rrtm = reduced_runtime::ReducedRuntime::from_v14(&v14).expect("Failed reducing runtime"); assert_eq!(rrtm.pallets.len(), 51); let first_pallet = &rrtm.pallets[&0]; assert_eq!(0, first_pallet.index); assert_eq!("System", first_pallet.name); assert_eq!(9, first_pallet.calls.len()); - assert_eq!("remark", &first_pallet.calls.get(&1).unwrap().name); + assert_eq!("remark", &first_pallet.calls.get(&1).expect("Failed getting call").name); } _ => unreachable!(), } @@ -40,12 +40,12 @@ mod test_reduced_conversion { fn test_reduce_v14_calls() { let rtm1 = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Runtime file should exist"); - let testbed = WasmTestBed::new(&Source::File(rtm1)).unwrap(); + let testbed = WasmTestBed::new(&Source::File(rtm1)).expect("Failed loading runtime"); let metadata = testbed.metadata(); match metadata { RuntimeMetadata::V14(v14) => { - let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).unwrap(); + let rrtm = reduced_runtime::ReducedRuntime::from_v14(&v14).expect("Failed reducing runtime"); assert_eq!(rrtm.pallets.len(), 51); let first_pallet = &rrtm.pallets[&0]; @@ -63,12 +63,12 @@ mod test_reduced_conversion { #[cfg(feature = "v14")] fn test_reduce_v14_events() { let rtm1 = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Runtime file should exist"); - let testbed = WasmTestBed::new(&Source::File(rtm1)).unwrap(); + let testbed = WasmTestBed::new(&Source::File(rtm1)).expect("Failed loading runtime"); let metadata = testbed.metadata(); match metadata { RuntimeMetadata::V14(v14) => { - let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).unwrap(); + let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).expect("Failed reducing runtime"); assert_eq!(rrtm.pallets.len(), 51); let first_pallet = &rrtm.pallets[&0]; @@ -86,12 +86,12 @@ mod test_reduced_conversion { #[cfg(feature = "v14")] fn test_reduce_v14_global() { let rtm1 = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Runtime file should exist"); - let testbed = WasmTestBed::new(&Source::File(rtm1)).unwrap(); + let testbed = WasmTestBed::new(&Source::File(rtm1)).expect("Failed loading wasm"); let metadata = testbed.metadata(); match metadata { RuntimeMetadata::V14(v14) => { - let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).unwrap(); + let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).expect("Failed reducing runtime"); assert_eq!(rrtm.pallets.len(), 51); let first_pallet = &rrtm.pallets[&0]; @@ -104,7 +104,7 @@ mod test_reduced_conversion { assert_eq!(6, first_pallet.constants.len()); assert_eq!(16, first_pallet.storages.len()); - assert_eq!("remark", &first_pallet.calls.get(&1).unwrap().name) + assert_eq!("remark", &first_pallet.calls.get(&1).expect("Failed getting pallet").name) } _ => unreachable!(), } @@ -115,12 +115,12 @@ mod test_reduced_conversion { #[cfg(feature = "v14")] fn test_reduce_v14_storages() { let rtm1 = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Runtime file should exist"); - let testbed = WasmTestBed::new(&Source::File(rtm1)).unwrap(); + let testbed = WasmTestBed::new(&Source::File(rtm1)).expect("Failed loading wasm"); let metadata = testbed.metadata(); match metadata { RuntimeMetadata::V14(v14) => { - let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).unwrap(); + let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).expect("Failed reducing runtime"); assert_eq!(rrtm.pallets.len(), 51); let first_pallet = &rrtm.pallets[&0]; @@ -138,12 +138,12 @@ mod test_reduced_conversion { #[cfg(feature = "v14")] fn test_reduce_v14_constants() { let rtm1 = get_runtime_file(RuntimeFile::new(Chain::Polkadot, 14, 9260)).expect("Runtime file should exist"); - let testbed = WasmTestBed::new(&Source::File(rtm1)).unwrap(); + let testbed = WasmTestBed::new(&Source::File(rtm1)).expect("Failed loading wasm"); let metadata = testbed.metadata(); match metadata { RuntimeMetadata::V14(v14) => { - let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).unwrap(); + let rrtm = reduced_runtime::ReducedRuntime::from_v14(v14).expect("Failed reducing runtime"); assert_eq!(rrtm.pallets.len(), 51); let first_pallet = &rrtm.pallets[&0]; diff --git a/libs/substrate-differ/src/differs/test_runtimes.rs b/libs/substrate-differ/src/differs/test_runtimes.rs index d410841..483fc2e 100644 --- a/libs/substrate-differ/src/differs/test_runtimes.rs +++ b/libs/substrate-differ/src/differs/test_runtimes.rs @@ -52,7 +52,7 @@ impl RuntimeFile { } pub fn get_runtime_file(runtime_file: RuntimeFile) -> Option { - let workspace_root = env::var("CARGO_WORKSPACE_DIR").unwrap(); + let workspace_root = env::var("CARGO_WORKSPACE_DIR").expect("Failed getting env"); let candidate = PathBuf::from_str(&format!( "{workspace_root}data/{chain}/V{meta}/{spec}.wasm", chain = runtime_file.chain, diff --git a/libs/substrate-runtime-proposal-hash/src/lib.rs b/libs/substrate-runtime-proposal-hash/src/lib.rs index b70119d..48e88bb 100644 --- a/libs/substrate-runtime-proposal-hash/src/lib.rs +++ b/libs/substrate-runtime-proposal-hash/src/lib.rs @@ -103,7 +103,7 @@ mod prop_hash_tests { #[test] fn test_proposal_hash() { assert_eq!( - get_proposal_hash(&[1, 2, 42]).unwrap(), + get_proposal_hash(&[1, 2, 42]).expect("Failed getting a hash"), [ 174, 123, 79, 240, 254, 106, 147, 26, 65, 61, 41, 84, 181, 102, 24, 182, 128, 135, 188, 31, 135, 187, 99, 34, 143, 35, 120, 100, 246, 90, 186, 106 @@ -114,7 +114,7 @@ mod prop_hash_tests { #[test] fn test_call_hash() { assert_eq!( - get_call_hash(PREFIX_SYSTEM_SETCODE, &[1, 2, 42]).unwrap(), + get_call_hash(PREFIX_SYSTEM_SETCODE, &[1, 2, 42]).expect("Failed getting a hash"), [ 174, 123, 79, 240, 254, 106, 147, 26, 65, 61, 41, 84, 181, 102, 24, 182, 128, 135, 188, 31, 135, 187, 99, 34, 143, 35, 120, 100, 246, 90, 186, 106 @@ -130,7 +130,7 @@ mod prop_hash_tests { get_parachainsystem_authorize_upgrade(&[ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f ]) - .unwrap(), + .expect("Failed getting a hash"), [ 231, 116, 0, 171, 31, 105, 209, 55, 219, 85, 107, 244, 188, 127, 92, 82, 111, 152, 5, 80, 44, 48, 66, 9, 156, 175, 248, 163, 40, 92, 101, 11 @@ -148,7 +148,7 @@ mod prop_hash_tests { get_parachainsystem_authorize_upgrade(&[ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f ]) - .unwrap(), + .expect("Failed getting a hash"), [ 51, 203, 30, 131, 48, 13, 150, 26, 217, 87, 213, 55, 43, 10, 200, 193, 248, 254, 202, 83, 165, 231, 4, 59, 213, 247, 98, 153, 119, 166, 175, 133 @@ -158,19 +158,19 @@ mod prop_hash_tests { #[test] fn test_hash_length() { - assert_eq!(32, get_proposal_hash(&[0]).unwrap().len()); + assert_eq!(32, get_proposal_hash(&[0]).expect("Failed getting a hash").len()); } #[test] fn test_get_result() { - let res = get_result(PREFIX_SYSTEM_SETCODE, &[1, 2, 42]).unwrap(); + let res = get_result(PREFIX_SYSTEM_SETCODE, &[1, 2, 42]).expect("Failed getting a hash"); assert_eq!(res.encoded_hash, "85233004e044626a6c08e469573369536d8de9b264b08eb6611b76b80148e429"); } #[test] fn test_long_input() { const SIZE_8MB: usize = 8 * 1024 * 1024; - let res = get_result(PREFIX_SYSTEM_SETCODE, &[0; SIZE_8MB]).unwrap(); + let res = get_result(PREFIX_SYSTEM_SETCODE, &[0; SIZE_8MB]).expect("Failed getting a hash"); assert_eq!(res.encoded_hash, "44de98eef7227a1f55c5d1cf2b437dc87e60177dc8607538a115773b567ed0d5"); } } diff --git a/libs/wasm-loader/src/compression.rs b/libs/wasm-loader/src/compression.rs index 45a9588..c0d7a0f 100644 --- a/libs/wasm-loader/src/compression.rs +++ b/libs/wasm-loader/src/compression.rs @@ -63,7 +63,7 @@ mod tests_compression { #[test] fn test_compression() { let bytes = vec![0, 42, 7, 27, 0, 0, 0, 27, 26, 27]; - let compressed = Compression::compress(&bytes).unwrap(); + let compressed = Compression::compress(&bytes).expect("Should be able to compress"); assert_eq!( vec![ 82, 188, 83, 118, 70, 219, 142, 5, 40, 181, 47, 253, 0, 88, 81, 0, 0, 0, 42, 7, 27, 0, 0, 0, 27, 26, 27 @@ -72,6 +72,6 @@ mod tests_compression { ); let decompressed = Compression::decompress(&compressed); - assert_eq!(bytes, decompressed.unwrap()); + assert_eq!(bytes, decompressed.expect("Failed decompressing")); } } diff --git a/libs/wasm-loader/src/lib.rs b/libs/wasm-loader/src/lib.rs index 008fdfa..1d11861 100644 --- a/libs/wasm-loader/src/lib.rs +++ b/libs/wasm-loader/src/lib.rs @@ -178,7 +178,7 @@ pub mod tests { const WASM_FILE: &str = "/tmp/runtime.wasm"; let mut retry = 0; - let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); + let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed loading wasm"); if PathBuf::from(WASM_FILE).exists() { return WASM_FILE.to_string(); @@ -224,7 +224,7 @@ pub mod tests { let url = get_ws_node(false); println!("Connecting to {:?}", &url); let reference = OnchainBlock { endpoint: NodeEndpoint::WebSocket(url), block_ref: None }; - let loader = WasmLoader::load_from_source(&Source::Chain(reference)).unwrap(); + let loader = WasmLoader::load_from_source(&Source::Chain(reference)).expect("Failed loading wasm"); let wasm = loader.uncompressed_bytes(); println!("uncompressed wasm size: {:?}", wasm.len()); assert!(wasm.len() > 1_000_000); @@ -236,7 +236,7 @@ pub mod tests { let url = get_ws_node(false); println!("Connecting to {:?}", &url); let reference = OnchainBlock { endpoint: NodeEndpoint::WebSocket(url), block_ref: None }; - let loader = WasmLoader::load_from_source(&Source::Chain(reference)).unwrap(); + let loader = WasmLoader::load_from_source(&Source::Chain(reference)).expect("Failed loading wasm"); let uncompressed_bytes = loader.uncompressed_bytes(); let original_bytes = loader.original_bytes(); println!("uncompressed wasm size: {:?}", uncompressed_bytes.len()); @@ -256,10 +256,10 @@ pub mod tests { let older = OnchainBlock { endpoint: NodeEndpoint::WebSocket(url), block_ref: Some(POLKADOT_BLOCK20.to_string()) }; - let loader_latest = WasmLoader::load_from_source(&Source::Chain(latest)).unwrap(); + let loader_latest = WasmLoader::load_from_source(&Source::Chain(latest)).expect("Failed loading wasm"); let wasm_latest = loader_latest.uncompressed_bytes(); - let loader_older = WasmLoader::load_from_source(&Source::Chain(older)).unwrap(); + let loader_older = WasmLoader::load_from_source(&Source::Chain(older)).expect("Failed loading wasm"); let wasm_older = loader_older.uncompressed_bytes(); println!("wasm latest size: {:?}", wasm_latest.len()); diff --git a/libs/wasm-loader/src/source.rs b/libs/wasm-loader/src/source.rs index 01c8252..761a9cf 100644 --- a/libs/wasm-loader/src/source.rs +++ b/libs/wasm-loader/src/source.rs @@ -58,7 +58,7 @@ mod tests_source { let urls = vec!["ws://localhost:9933", "wss://localhost:9933"]; for url in urls { - let src = Source::from_str(url).unwrap(); + let src = Source::from_str(url).expect("Failed getting a source"); match src { Source::Chain(r) => match r.endpoint { NodeEndpoint::WebSocket(ws) => assert_eq!(ws, url), @@ -74,7 +74,7 @@ mod tests_source { let urls = vec!["http://localhost:9933", "https://localhost:9933"]; for url in urls { - let src = Source::from_str(url).unwrap(); + let src = Source::from_str(url).expect("Failed loading wasm"); match src { Source::Chain(r) => match r.endpoint { NodeEndpoint::Http(http) => assert_eq!(http, url), diff --git a/libs/wasm-testbed/src/lib.rs b/libs/wasm-testbed/src/lib.rs index eb340c3..07b7cb3 100644 --- a/libs/wasm-testbed/src/lib.rs +++ b/libs/wasm-testbed/src/lib.rs @@ -236,7 +236,7 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_v12() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V12))).unwrap(); + let runtime = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V12))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 12); // assert!(runtime.core_version); @@ -246,7 +246,7 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_v13() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13))).unwrap(); + let runtime = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V13))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 13); // assert!(runtime.core_version); @@ -256,10 +256,8 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_v14() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V14))); - assert!(runtime.is_ok()); + let runtime = WasmTestBed::new(&Source::File(PathBuf::from(RUNTIME_V14))).expect("Failed loading runtime"); println!("runtime = {:?}", &runtime); - let runtime = runtime.unwrap(); assert!(runtime.metadata_version == 14); assert!(runtime.is_supported()); } @@ -273,7 +271,8 @@ mod tests { #[should_panic] #[ignore = "local data"] fn it_loads_kusama_1050() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_1050_VXX))).unwrap(); + let runtime = + WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_1050_VXX))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 11); assert!(runtime.is_supported()); @@ -283,7 +282,8 @@ mod tests { #[should_panic] #[ignore = "local data"] fn it_loads_kusama_1062() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_1062_VXX))).unwrap(); + let runtime = + WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_1062_VXX))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 11); assert!(runtime.is_supported()); @@ -300,7 +300,8 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_kusama_metadata() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_2030_VXX))).unwrap(); + let runtime = + WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_2030_VXX))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 12); assert!(runtime.is_supported()); @@ -309,7 +310,8 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_kusama_2030() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_2030_VXX))).unwrap(); + let runtime = + WasmTestBed::new(&Source::File(PathBuf::from(KUSAMA_2030_VXX))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 12); assert!(runtime.is_supported()); @@ -332,7 +334,8 @@ mod tests { #[should_panic] #[ignore = "local data"] fn it_loads_polkadot_01() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(POLKADOT_01_V11))).unwrap(); + let runtime = + WasmTestBed::new(&Source::File(PathBuf::from(POLKADOT_01_V11))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 11); assert!(runtime.is_supported()); @@ -341,7 +344,8 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_polkadot_29() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(POLKADOT_29_V12))).unwrap(); + let runtime = + WasmTestBed::new(&Source::File(PathBuf::from(POLKADOT_29_V12))).expect("Failed loading runtime"); println!("{runtime:#?}"); @@ -357,7 +361,8 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_westend_30() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(WESTEND_V30_V12))).unwrap(); + let runtime = + WasmTestBed::new(&Source::File(PathBuf::from(WESTEND_V30_V12))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 12); assert!(runtime.is_supported()); @@ -371,7 +376,7 @@ mod tests { #[test] #[ignore = "local data"] fn it_loads_polkadot_dev() { - let runtime = WasmTestBed::new(&Source::File(PathBuf::from(POLKADOT_DEV))).unwrap(); + let runtime = WasmTestBed::new(&Source::File(PathBuf::from(POLKADOT_DEV))).expect("Failed loading runtime"); println!("{runtime:#?}"); assert!(runtime.metadata_version == 12); assert!(runtime.is_supported()); From 848fbbae0d10216695f5c08da9c578984e374188 Mon Sep 17 00:00:00 2001 From: Chevdor Date: Tue, 20 Jun 2023 11:45:35 +0200 Subject: [PATCH 4/6] Fix some issues with tests --- Cargo.lock | 1 + cli/Cargo.toml | 33 +++++++------ cli/src/main.rs | 1 + cli/src/opts.rs | 2 +- cli/tests/compress.rs | 17 +++++-- cli/tests/show.rs | 4 +- cli/tests/test_utils.rs | 12 ++++- lib/src/runtime_info.rs | 1 - lib/src/source.rs | 7 +++ lib/src/subwasm.rs | 1 - lib/src/utils.rs | 3 +- .../src/lib.rs | 49 +++++++------------ libs/wasm-testbed/src/lib.rs | 24 +++++++-- 13 files changed, 92 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cd208cf..5ac1afc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3923,6 +3923,7 @@ dependencies = [ "text-style", "thiserror", "url", + "uuid", "wasm-loader", "wasm-testbed", ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index ee53bf6..060224f 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -6,13 +6,13 @@ authors.workspace = true description = "subwasm is a utility that works on WASM Runtime of Substrate based chains" homepage = "https://github.com/chevdor/subwasm" keywords = [ - "wasm", - "cli", - "substrate", - "blockchain", - "runtime", - "polkadot", - "kusama", + "wasm", + "cli", + "substrate", + "blockchain", + "runtime", + "polkadot", + "kusama", ] license = "MIT" readme = "README.md" @@ -25,15 +25,15 @@ path = "src/main.rs" [dependencies] assert_cmd = "2.0" clap = { version = "4.0", features = [ - "derive", - "env", - "unicode", - "cargo", - "color", - "help", - "usage", - "error-context", - "suggestions", + "derive", + "env", + "unicode", + "cargo", + "color", + "help", + "usage", + "error-context", + "suggestions", ] } color-eyre = "0.6" thiserror = "1.0" @@ -50,6 +50,7 @@ url = "2.3" [dev-dependencies] assert_cmd = "2.0" +uuid = { version = "1.3", features = ["v4"] } [package.metadata.deb] assets = [["target/release/subwasm", "usr/bin/", "755"]] diff --git a/cli/src/main.rs b/cli/src/main.rs index 5c7735a..45be10f 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -236,6 +236,7 @@ pub fn get_source( ) -> error::Result { let source: Source = Source::from_options(file, chain, block, dl_url)?; // If the source is a URL, we try to fetch it first + Ok(match source { Source::URL(u) => { debug!("Fetching runtime from {}", u); diff --git a/cli/src/opts.rs b/cli/src/opts.rs index 0fda612..e4e091d 100644 --- a/cli/src/opts.rs +++ b/cli/src/opts.rs @@ -168,7 +168,7 @@ pub struct MetaOpts { #[clap(long, short)] pub module: Option, - /// You may specifiy the output format. One of "human", "scale", "json", "json+scale", "hex+scale". + /// You may specify the output format. One of "human", "scale", "json", "json+scale", "hex+scale". /// If you use the default: human, you may want to check out the "show_reduced" command instead. #[clap(long, short, default_value = "human")] pub format: Option, diff --git a/cli/tests/compress.rs b/cli/tests/compress.rs index 7ceb4db..3b86b4f 100644 --- a/cli/tests/compress.rs +++ b/cli/tests/compress.rs @@ -4,29 +4,36 @@ mod test_utils; mod cli_tests { #[cfg(test)] mod cli_compress { + use crate::test_utils::temp_file; use assert_cmd::Command; - // todo: sporadic errors #[test] fn it_does_basic_compress_decompress() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); + let tmp_decompressed = temp_file(); + let tmp_recompressed = temp_file(); let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); - cmd.args(["decompress", test_wasm, "/tmp/decompressed.wasm"]).assert().success().code(0); + cmd.args(["decompress", test_wasm, tmp_decompressed.as_str()]).assert().success().code(0); let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); - cmd.args(["compress", "/tmp/decompressed.wasm", "/tmp/new_compressed.wasm"]).assert().success().code(0); + cmd.args(["compress", tmp_decompressed.as_str(), tmp_recompressed.as_str()]).assert().success().code(0); } #[test] fn it_does_decompress_on_already() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); + let tmp_decompressed = temp_file(); + let tmp_decompressed_again = temp_file(); let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); - cmd.args(["decompress", test_wasm, "/tmp/decompressed.wasm"]).assert().success().code(0); + cmd.args(["decompress", test_wasm, tmp_decompressed.as_str()]).assert().success().code(0); let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); - cmd.args(["decompress", "/tmp/decompressed.wasm", "/tmp/new_decompressed.wasm"]).assert().success().code(0); + cmd.args(["decompress", tmp_decompressed.as_str(), tmp_decompressed_again.as_str()]) + .assert() + .success() + .code(0); } } } diff --git a/cli/tests/show.rs b/cli/tests/show.rs index 92b9136..5742694 100644 --- a/cli/tests/show.rs +++ b/cli/tests/show.rs @@ -6,11 +6,11 @@ mod cli_tests { use assert_cmd::Command as AssertCommand; #[test] - fn it_shows_metadata() { + fn it_shows_runtime() { let test_wasm: &str = &crate::test_utils::ensure_local_wasm(); let mut cmd = AssertCommand::cargo_bin(env!("CARGO_PKG_NAME")).expect("Failed getting test bin"); - let assert = cmd.args(["show", "--json"]).arg(test_wasm).assert(); + let assert = cmd.args(["show", test_wasm]).assert(); assert.success().code(0); } } diff --git a/cli/tests/test_utils.rs b/cli/tests/test_utils.rs index 8aac83e..acd832a 100644 --- a/cli/tests/test_utils.rs +++ b/cli/tests/test_utils.rs @@ -1,9 +1,10 @@ use assert_cmd::Command; use core::panic; -use std::path::PathBuf; +use std::{env::temp_dir, path::PathBuf}; #[allow(dead_code)] #[cfg(test)] +/// Ensure we have a local wasm available at /tpm/runtime.wasm pub fn ensure_local_wasm() -> String { const MAX_RETRIES: u8 = 10; const WASM_FILE: &str = "/tmp/runtime.wasm"; @@ -29,3 +30,12 @@ pub fn ensure_local_wasm() -> String { panic!("Failed fetching a runtime") } + +/// Generate the path of a temp file +#[allow(dead_code)] +#[cfg(test)] +pub fn temp_file() -> String { + let mut res = PathBuf::from(temp_dir()); + res.push(PathBuf::from(uuid::Uuid::new_v4().to_string())); + String::from(res.to_str().expect("Failed generating temp file path")) +} diff --git a/lib/src/runtime_info.rs b/lib/src/runtime_info.rs index 49c79c9..cfbbf8a 100644 --- a/lib/src/runtime_info.rs +++ b/lib/src/runtime_info.rs @@ -25,7 +25,6 @@ pub struct RuntimeInfo { impl RuntimeInfo { pub fn new(testbed: &WasmTestBed) -> Result { let core_version = testbed.core_version(); - let hasher = IpfsHasher::default(); let proposal_hash = testbed.proposal_hash()?; let blake2_256 = testbed.blake2_256_hash()?; diff --git a/lib/src/source.rs b/lib/src/source.rs index 53e2c05..a4f0f4c 100644 --- a/lib/src/source.rs +++ b/lib/src/source.rs @@ -1,5 +1,6 @@ use error::*; use log::debug; +use log::trace; use std::{fmt::Display, path::PathBuf, str::FromStr}; use url::Url; use wasm_loader::{BlockRef, OnchainBlock, Source as WasmLoaderSource}; @@ -152,6 +153,12 @@ impl Source { block: Option, url: Option, ) -> Result { + trace!("Getting source from options:"); + trace!(" - file : {file:?}"); + trace!(" - chain: {chain:?}"); + trace!(" - block: {block:?}"); + trace!(" - url : {url:?}"); + if let Some(f) = file { return Ok(Self::File(f)); } diff --git a/lib/src/subwasm.rs b/lib/src/subwasm.rs index 16133ed..69b072d 100644 --- a/lib/src/subwasm.rs +++ b/lib/src/subwasm.rs @@ -32,7 +32,6 @@ impl Subwasm { SubwasmLibError::Generic("Failed loading runtime".to_string()) })?; - let runtime_info = RuntimeInfo::new(&testbed)?; Ok(Self { testbed, runtime_info }) } diff --git a/lib/src/utils.rs b/lib/src/utils.rs index fba4453..867c982 100644 --- a/lib/src/utils.rs +++ b/lib/src/utils.rs @@ -73,7 +73,8 @@ pub fn fetch_at_url(url: Url, target: Option) -> Result { debug!("Fetching from {url}"); let target = if let Some(target) = target { target } else { get_output_file_tmp()? }; - let mut resp = reqwest::blocking::get(url.to_owned()).map_err(|_e| error::SubwasmLibError::Io)?; + let mut resp = reqwest::blocking::get(url.to_owned()) + .map_err(|_e| error::SubwasmLibError::Generic("Request error".to_string()))?; if resp.status().is_success() { let mut out = std::fs::File::create(target.clone()).map_err(|_e| error::SubwasmLibError::Io)?; resp.copy_to(&mut out).map_err(|_e| error::SubwasmLibError::Io)?; diff --git a/libs/substrate-runtime-proposal-hash/src/lib.rs b/libs/substrate-runtime-proposal-hash/src/lib.rs index 48e88bb..2c6e421 100644 --- a/libs/substrate-runtime-proposal-hash/src/lib.rs +++ b/libs/substrate-runtime-proposal-hash/src/lib.rs @@ -4,10 +4,8 @@ use blake2::digest::{Update, VariableOutput}; use blake2::Blake2bVar; use codec::Encode; use error::*; -use hex::FromHex; use sp_core::Hasher; use sp_runtime::traits::BlakeTwo256; -use std::env; /// Expected size of the hash pub const SIZE: usize = 32; @@ -20,11 +18,11 @@ type Prefix = (u8, u8); /// The PREFIX is prepended to the data before hashing pub const PREFIX_SYSTEM_SETCODE: Prefix = (0x00, 0x02); -const PARACHAIN_PALLET_ID_ENV: &str = "PARACHAIN_PALLET_ID"; -const DEFAULT_PARACHAIN_PALLET_ID: &str = "0x01"; +pub const PARACHAIN_PALLET_ID_ENV: &str = "PARACHAIN_PALLET_ID"; +pub const DEFAULT_PARACHAIN_PALLET_ID: &str = "0x01"; -const AUTHORIZE_UPGRADE_PREFIX_ENV: &str = "AUTHORIZE_UPGRADE_PREFIX"; -const DEFAULT_AUTHORIZE_UPGRADE_PREFIX: &str = "0x02"; +pub const AUTHORIZE_UPGRADE_PREFIX_ENV: &str = "AUTHORIZE_UPGRADE_PREFIX"; +pub const DEFAULT_AUTHORIZE_UPGRADE_PREFIX: &str = "0x02"; /// This struct is a container for whatever we calculated. #[derive(Debug)] @@ -70,17 +68,11 @@ pub fn get_system_setcode(wasm_blob: &[u8]) -> Result { get_call_hash(PREFIX_SYSTEM_SETCODE, wasm_blob) } -pub fn get_parachainsystem_authorize_upgrade(wasm_blob: &[u8]) -> Result { - let s1 = - env::var(PARACHAIN_PALLET_ID_ENV).unwrap_or_else(|_| DEFAULT_PARACHAIN_PALLET_ID.into()).replacen("0x", "", 1); - let s2 = env::var(AUTHORIZE_UPGRADE_PREFIX_ENV) - .unwrap_or_else(|_| DEFAULT_AUTHORIZE_UPGRADE_PREFIX.into()) - .replacen("0x", "", 1); - let decoded1 = <[u8; 1]>::from_hex(&s1).map_err(|_| RuntimePropHashError::HexDecoding(s1))?; - let decoded2 = <[u8; 1]>::from_hex(&s2).map_err(|_| RuntimePropHashError::HexDecoding(s2))?; - - let parachain_pallet_id = *decoded1.first().expect("Failure while fecthing the Parachain Pallet ID"); - let authorize_upgrade_prefix = *decoded2.first().expect("Failure while fecthing the Auhtorize upgrade ID"); +pub fn get_parachainsystem_authorize_upgrade( + parachain_pallet_id: u8, + authorize_upgrade_prefix: u8, + wasm_blob: &[u8], +) -> Result { let prefix_parachainsystem_authorize_upgrade: Prefix = (parachain_pallet_id, authorize_upgrade_prefix); let code_hash = BlakeTwo256::hash(wasm_blob); let call_hash = get_call_hash(prefix_parachainsystem_authorize_upgrade, code_hash.as_bytes())?; @@ -98,7 +90,6 @@ fn get_call_hash(prefix: Prefix, wasm_blob: &[u8]) -> Result { #[cfg(test)] mod prop_hash_tests { use super::*; - use std::env; #[test] fn test_proposal_hash() { @@ -124,12 +115,12 @@ mod prop_hash_tests { #[test] fn test_parachain_upgrade() { - env::set_var(PARACHAIN_PALLET_ID_ENV, DEFAULT_PARACHAIN_PALLET_ID); - env::set_var(AUTHORIZE_UPGRADE_PREFIX_ENV, DEFAULT_AUTHORIZE_UPGRADE_PREFIX); assert_eq!( - get_parachainsystem_authorize_upgrade(&[ - 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f - ]) + get_parachainsystem_authorize_upgrade( + 0x01, + 0x02, + &[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f] + ) .expect("Failed getting a hash"), [ 231, 116, 0, 171, 31, 105, 209, 55, 219, 85, 107, 244, 188, 127, 92, 82, 111, 152, 5, 80, 44, 48, 66, @@ -138,16 +129,14 @@ mod prop_hash_tests { ); } - // todo: sporadic errors #[test] fn test_custom_parachain_upgrade() { - env::set_var(PARACHAIN_PALLET_ID_ENV, "0x32"); - env::set_var(AUTHORIZE_UPGRADE_PREFIX_ENV, DEFAULT_AUTHORIZE_UPGRADE_PREFIX); - assert_eq!( - get_parachainsystem_authorize_upgrade(&[ - 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f - ]) + get_parachainsystem_authorize_upgrade( + 0x32, + 0x02, + &[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f] + ) .expect("Failed getting a hash"), [ 51, 203, 30, 131, 48, 13, 150, 26, 217, 87, 213, 55, 43, 10, 200, 193, 248, 254, 202, 83, 165, 231, 4, diff --git a/libs/wasm-testbed/src/lib.rs b/libs/wasm-testbed/src/lib.rs index 07b7cb3..d74d418 100644 --- a/libs/wasm-testbed/src/lib.rs +++ b/libs/wasm-testbed/src/lib.rs @@ -3,14 +3,15 @@ mod logger_mock; pub use error::{Result, WasmTestbedError}; use frame_metadata::{RuntimeMetadata, RuntimeMetadataPrefixed}; +use hex::FromHex; use sc_executor::{WasmExecutionMethod, WasmExecutor}; use sc_executor_common::runtime_blob::RuntimeBlob; use scale::Decode; use sp_core::Hasher; use sp_runtime::traits::BlakeTwo256; use sp_version::RuntimeVersion as SubstrateRuntimeVersion; -use std::fmt; -use substrate_runtime_proposal_hash::{get_parachainsystem_authorize_upgrade, get_result, SrhResult}; +use std::{env, fmt}; +use substrate_runtime_proposal_hash::{error::RuntimePropHashError, *}; use wasm_loader::*; /// This is a "magic" number signaling that out Wasm is a substrate wasm. @@ -52,6 +53,8 @@ impl fmt::Debug for WasmTestBed { impl WasmTestBed { pub fn new(source: &Source) -> Result { + log::debug!("Loading testbed with source: {source:?}"); + let loader = WasmLoader::load_from_source(source).map_err(|_| WasmTestbedError::Loading(source.to_string()))?; let wasm = loader.uncompressed_bytes().to_vec(); let metadata_encoded = Self::call(&wasm, "Metadata_metadata", &[])?; @@ -63,8 +66,6 @@ impl WasmTestBed { return Err(WasmTestbedError::UnsupportedRuntime); } - // Self::print_magic_and_version(&metadata); - let runtime_metadata_prefixed: RuntimeMetadataPrefixed = scale::Decode::decode(&mut &metadata[..]).map_err(|e| { log::error!("e = {:#?}", e); @@ -190,7 +191,20 @@ impl WasmTestBed { /// Compute the proposal hash of the runtime pub fn parachain_authorize_upgrade_hash(&self) -> Result { - let result = get_parachainsystem_authorize_upgrade(&self.bytes)?; + let s1 = env::var(PARACHAIN_PALLET_ID_ENV) + .unwrap_or_else(|_| DEFAULT_PARACHAIN_PALLET_ID.into()) + .replacen("0x", "", 1); + let s2 = env::var(AUTHORIZE_UPGRADE_PREFIX_ENV) + .unwrap_or_else(|_| DEFAULT_AUTHORIZE_UPGRADE_PREFIX.into()) + .replacen("0x", "", 1); + + let decoded1 = <[u8; 1]>::from_hex(&s1).map_err(|_| RuntimePropHashError::HexDecoding(s1))?; + let decoded2 = <[u8; 1]>::from_hex(&s2).map_err(|_| RuntimePropHashError::HexDecoding(s2))?; + + let parachain_pallet_id = *decoded1.first().expect("Failure while fecthing the Parachain Pallet ID"); + let authorize_upgrade_prefix = *decoded2.first().expect("Failure while fecthing the Auhtorize upgrade ID"); + + let result = get_parachainsystem_authorize_upgrade(parachain_pallet_id, authorize_upgrade_prefix, &self.bytes)?; Ok(format!("0x{}", hex::encode(result))) } From 8e221458ba50470143975374034f7fdd7ea4267a Mon Sep 17 00:00:00 2001 From: Chevdor Date: Tue, 20 Jun 2023 11:57:06 +0200 Subject: [PATCH 5/6] Prefix refactoring --- .../src/lib.rs | 32 ++++++++++++------- libs/wasm-testbed/src/lib.rs | 3 +- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/libs/substrate-runtime-proposal-hash/src/lib.rs b/libs/substrate-runtime-proposal-hash/src/lib.rs index 2c6e421..cef7225 100644 --- a/libs/substrate-runtime-proposal-hash/src/lib.rs +++ b/libs/substrate-runtime-proposal-hash/src/lib.rs @@ -63,19 +63,20 @@ pub fn get_proposal_hash(wasm_blob: &[u8]) -> Result { get_call_hash(PREFIX_SYSTEM_SETCODE, wasm_blob) } +/// Calculate the proposal hash which is system.setCode +/// +/// # Arguments +/// * `wasm_blob` - The WASM blob +/// # Returns +/// * `CalllHash` - The hash of the proposal as calculated on chain /// This function replaces the deprecated `get_proposal_hash` pub fn get_system_setcode(wasm_blob: &[u8]) -> Result { get_call_hash(PREFIX_SYSTEM_SETCODE, wasm_blob) } -pub fn get_parachainsystem_authorize_upgrade( - parachain_pallet_id: u8, - authorize_upgrade_prefix: u8, - wasm_blob: &[u8], -) -> Result { - let prefix_parachainsystem_authorize_upgrade: Prefix = (parachain_pallet_id, authorize_upgrade_prefix); +pub fn get_parachainsystem_authorize_upgrade(prefix: Prefix, wasm_blob: &[u8]) -> Result { let code_hash = BlakeTwo256::hash(wasm_blob); - let call_hash = get_call_hash(prefix_parachainsystem_authorize_upgrade, code_hash.as_bytes())?; + let call_hash = get_call_hash(prefix, code_hash.as_bytes())?; Ok(call_hash) } @@ -113,12 +114,22 @@ mod prop_hash_tests { ); } + #[test] + fn test_call_hash2() { + assert_eq!( + get_call_hash(PREFIX_SYSTEM_SETCODE, &[0u8; 10 * 1024 * 1024]).expect("Failed getting a hash"), + [ + 174, 179, 75, 47, 133, 33, 33, 117, 227, 27, 2, 242, 183, 69, 3, 244, 244, 219, 39, 24, 243, 38, 98, + 214, 76, 225, 132, 3, 25, 124, 58, 225 + ] + ); + } + #[test] fn test_parachain_upgrade() { assert_eq!( get_parachainsystem_authorize_upgrade( - 0x01, - 0x02, + (0x01, 0x02), &[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f] ) .expect("Failed getting a hash"), @@ -133,8 +144,7 @@ mod prop_hash_tests { fn test_custom_parachain_upgrade() { assert_eq!( get_parachainsystem_authorize_upgrade( - 0x32, - 0x02, + (0x32, 0x02), &[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x97, 0x03, 0x39, 0x60, 0x03, 0x7f, 0x7f] ) .expect("Failed getting a hash"), diff --git a/libs/wasm-testbed/src/lib.rs b/libs/wasm-testbed/src/lib.rs index d74d418..65e2f4d 100644 --- a/libs/wasm-testbed/src/lib.rs +++ b/libs/wasm-testbed/src/lib.rs @@ -204,7 +204,8 @@ impl WasmTestBed { let parachain_pallet_id = *decoded1.first().expect("Failure while fecthing the Parachain Pallet ID"); let authorize_upgrade_prefix = *decoded2.first().expect("Failure while fecthing the Auhtorize upgrade ID"); - let result = get_parachainsystem_authorize_upgrade(parachain_pallet_id, authorize_upgrade_prefix, &self.bytes)?; + let parachainsystem_authorize_upgrade_prefix = (parachain_pallet_id, authorize_upgrade_prefix); + let result = get_parachainsystem_authorize_upgrade(parachainsystem_authorize_upgrade_prefix, &self.bytes)?; Ok(format!("0x{}", hex::encode(result))) } From 3719a1bde8541eec1097576f0be5b91318fc057c Mon Sep 17 00:00:00 2001 From: Chevdor Date: Tue, 20 Jun 2023 12:24:42 +0200 Subject: [PATCH 6/6] Upgrade substrate to the latest monthly --- Cargo.lock | 405 ++++++------------ cli/Cargo.toml | 2 +- lib/Cargo.toml | 2 +- .../Cargo.toml | 8 +- libs/wasm-loader/Cargo.toml | 2 +- libs/wasm-testbed/Cargo.toml | 16 +- libs/wasm-testbed/src/lib.rs | 2 +- 7 files changed, 157 insertions(+), 280 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5ac1afc..d672597 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,22 +12,13 @@ dependencies = [ "regex", ] -[[package]] -name = "addr2line" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" -dependencies = [ - "gimli 0.26.2", -] - [[package]] name = "addr2line" version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ - "gimli 0.27.3", + "gimli", ] [[package]] @@ -213,12 +204,12 @@ version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line 0.19.0", + "addr2line", "cc", "cfg-if", "libc", "miniz_oxide 0.6.2", - "object 0.30.4", + "object", "rustc-demangle", ] @@ -688,28 +679,27 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc42ba2e232e5b20ff7dc299a812d53337dadce9a7e39a238e6a5cb82d2e57b" +checksum = "1277fbfa94bc82c8ec4af2ded3e639d49ca5f7f3c7eeab2c66accd135ece4e70" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e" +checksum = "c6e8c31ad3b2270e9aeec38723888fe1b0ace3bea2b06b3f749ccf46661d3220" dependencies = [ - "arrayvec 0.7.4", "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", "cranelift-isle", - "gimli 0.26.2", - "hashbrown 0.12.3", + "gimli", + "hashbrown 0.13.2", "log", "regalloc2", "smallvec", @@ -718,33 +708,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72f2154365e2bff1b1b8537a7181591fdff50d8e27fa6e40d5c69c3bad0ca7c8" +checksum = "c8ac5ac30d62b2d66f12651f6b606dbdfd9c2cfd0908de6b387560a277c5c9da" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "687e14e3f5775248930e0d5a84195abef8b829958e9794bf8d525104993612b4" +checksum = "dd82b8b376247834b59ed9bdc0ddeb50f517452827d4a11bccf5937b213748b8" [[package]] name = "cranelift-entity" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" +checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8483c2db6f45fe9ace984e5adc5d058102227e4c62e5aa2054e16b0275fd3a6e" +checksum = "64a25d9d0a0ae3079c463c34115ec59507b4707175454f0eee0891e83e30e82d" dependencies = [ "cranelift-codegen", "log", @@ -754,15 +744,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9793158837678902446c411741d87b43f57dadfb944f2440db4287cda8cbd59" +checksum = "80de6a7d0486e4acbd5f9f87ec49912bf4c8fb6aea00087b989685460d4469ba" [[package]] name = "cranelift-native" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72668c7755f2b880665cb422c8ad2d56db58a88b9bebfef0b73edc2277c13c49" +checksum = "bb6b03e0e03801c4b3fd8ce0758a94750c07a44e7944cc0ffbf0d3f2e7c79b00" dependencies = [ "cranelift-codegen", "libc", @@ -771,9 +761,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.93.2" +version = "0.95.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852ce4b088b44ac4e29459573943009a70d1b192c8d77ef949b4e814f656fc1" +checksum = "ff3220489a3d928ad91e59dd7aeaa8b3de18afb554a6211213673a71c90737ac" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1048,12 +1038,6 @@ dependencies = [ "litrs", ] -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - [[package]] name = "dyn-clonable" version = "0.9.0" @@ -1466,21 +1450,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" dependencies = [ "fallible-iterator", "indexmap", "stable_deref_trait", ] -[[package]] -name = "gimli" -version = "0.27.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" - [[package]] name = "h2" version = "0.3.19" @@ -1880,12 +1858,6 @@ version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" -[[package]] -name = "libm" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" - [[package]] name = "libsecp256k1" version = "0.7.1" @@ -1970,11 +1942,11 @@ checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "lru" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +checksum = "03f1160296536f10c833a82dca22267d5486734230d47bf00bf435885814ba1e" dependencies = [ - "hashbrown 0.12.3", + "hashbrown 0.13.2", ] [[package]] @@ -2012,9 +1984,9 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.6.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] @@ -2037,12 +2009,6 @@ dependencies = [ "hash-db", ] -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" - [[package]] name = "merlin" version = "2.0.1" @@ -2213,17 +2179,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - [[package]] name = "num-format" version = "0.4.4" @@ -2234,28 +2189,6 @@ dependencies = [ "itoa", ] -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -2275,24 +2208,15 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" -dependencies = [ - "crc32fast", - "hashbrown 0.12.3", - "indexmap", - "memchr", -] - [[package]] name = "object" version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ + "crc32fast", + "hashbrown 0.13.2", + "indexmap", "memchr", ] @@ -2781,9 +2705,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" +checksum = "80535183cae11b149d618fbd3c37e38d7cda589d82d7769e196ca9a9042d7621" dependencies = [ "fxhash", "log", @@ -2823,18 +2747,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" -[[package]] -name = "region" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi", -] - [[package]] name = "reqwest" version = "0.11.18" @@ -2991,7 +2903,7 @@ checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "log", "sp-core", @@ -3002,13 +2914,12 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "lru", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", - "sc-executor-wasmi", "sc-executor-wasmtime", "sp-api", "sp-core", @@ -3020,39 +2931,24 @@ dependencies = [ "sp-version", "sp-wasm-interface", "tracing", - "wasmi", ] [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", "sp-wasm-interface", "thiserror", "wasm-instrument", - "wasmi", -] - -[[package]] -name = "sc-executor-wasmi" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" -dependencies = [ - "log", - "sc-allocator", - "sc-executor-common", - "sp-runtime-interface", - "sp-wasm-interface", - "wasmi", ] [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "anyhow", "cfg-if", @@ -3407,7 +3303,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "hash-db", "log", @@ -3427,7 +3323,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "Inflector", "blake2", @@ -3440,8 +3336,8 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "parity-scale-codec", "scale-info", @@ -3453,8 +3349,8 @@ dependencies = [ [[package]] name = "sp-arithmetic" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "16.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "integer-sqrt", "num-traits", @@ -3467,8 +3363,8 @@ dependencies = [ [[package]] name = "sp-core" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "21.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -3511,8 +3407,8 @@ dependencies = [ [[package]] name = "sp-core-hashing" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "blake2b_simd 1.0.1", "byteorder", @@ -3525,8 +3421,8 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "9.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "proc-macro2", "quote", @@ -3536,8 +3432,8 @@ dependencies = [ [[package]] name = "sp-debug-derive" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "proc-macro2", "quote", @@ -3546,8 +3442,8 @@ dependencies = [ [[package]] name = "sp-externalities" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "0.19.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "environmental", "parity-scale-codec", @@ -3557,8 +3453,8 @@ dependencies = [ [[package]] name = "sp-io" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "23.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "bytes", "ed25519", @@ -3583,8 +3479,8 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "0.27.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "futures", "parity-scale-codec", @@ -3597,7 +3493,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -3606,7 +3502,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "frame-metadata 15.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "parity-scale-codec", @@ -3616,8 +3512,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "backtrace", "lazy_static", @@ -3626,8 +3522,8 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "24.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "either", "hash256-std-hasher", @@ -3648,8 +3544,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "17.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -3666,8 +3562,8 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "11.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "Inflector", "proc-macro-crate", @@ -3678,8 +3574,8 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "0.28.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "hash-db", "log", @@ -3698,13 +3594,13 @@ dependencies = [ [[package]] name = "sp-std" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" [[package]] name = "sp-storage" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "13.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3716,8 +3612,8 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "10.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "parity-scale-codec", "sp-std", @@ -3728,8 +3624,8 @@ dependencies = [ [[package]] name = "sp-trie" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "ahash 0.8.3", "hash-db", @@ -3751,8 +3647,8 @@ dependencies = [ [[package]] name = "sp-version" -version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "22.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "impl-serde", "parity-scale-codec", @@ -3768,8 +3664,8 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "8.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -3779,22 +3675,21 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "14.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", "sp-std", - "wasmi", "wasmtime", ] [[package]] name = "sp-weights" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-05#bc8f2db2cca2bac2d780569050c9ba4d751be45c" +version = "20.0.0" +source = "git+https://github.com/paritytech/substrate?tag=monthly-2023-06#6ef184e33f6ce0f56999ae84b212ea6148c0624d" dependencies = [ "parity-scale-codec", "scale-info", @@ -4619,45 +4514,11 @@ dependencies = [ "wasm-loader", ] -[[package]] -name = "wasmi" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" -dependencies = [ - "parity-wasm", - "wasmi-validation", - "wasmi_core", -] - -[[package]] -name = "wasmi-validation" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" -dependencies = [ - "parity-wasm", -] - -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm", - "memory_units", - "num-rational", - "num-traits", - "region", -] - [[package]] name = "wasmparser" -version = "0.100.0" +version = "0.102.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" +checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" dependencies = [ "indexmap", "url", @@ -4665,9 +4526,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" +checksum = "f907fdead3153cb9bfb7a93bbd5b62629472dc06dee83605358c64c52ed3dda9" dependencies = [ "anyhow", "bincode", @@ -4675,7 +4536,7 @@ dependencies = [ "indexmap", "libc", "log", - "object 0.29.0", + "object", "once_cell", "paste", "psm", @@ -4688,26 +4549,26 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-asm-macros" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" +checksum = "d3b9daa7c14cd4fa3edbf69de994408d5f4b7b0959ac13fa69d465f6597f810d" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ceb3adf61d654be0be67fffdce42447b0880481348785be5fe40b5dd7663a4c" +checksum = "c86437fa68626fe896e5afc69234bb2b5894949083586535f200385adfd71213" dependencies = [ "anyhow", - "base64 0.13.1", + "base64 0.21.2", "bincode", "directories-next", "file-per-thread-logger", @@ -4716,15 +4577,15 @@ dependencies = [ "serde", "sha2 0.10.7", "toml", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "zstd 0.11.2+zstd.1.5.2", ] [[package]] name = "wasmtime-cranelift" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c366bb8647e01fd08cb5589976284b00abfded5529b33d7e7f3f086c68304a4" +checksum = "b1cefde0cce8cb700b1b21b6298a3837dba46521affd7b8c38a9ee2c869eee04" dependencies = [ "anyhow", "cranelift-codegen", @@ -4732,27 +4593,43 @@ dependencies = [ "cranelift-frontend", "cranelift-native", "cranelift-wasm", - "gimli 0.26.2", + "gimli", "log", - "object 0.29.0", + "object", "target-lexicon", "thiserror", "wasmparser", + "wasmtime-cranelift-shared", + "wasmtime-environ", +] + +[[package]] +name = "wasmtime-cranelift-shared" +version = "8.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd041e382ef5aea1b9fc78442394f1a4f6d676ce457e7076ca4cb3f397882f8b" +dependencies = [ + "anyhow", + "cranelift-codegen", + "cranelift-native", + "gimli", + "object", + "target-lexicon", "wasmtime-environ", ] [[package]] name = "wasmtime-environ" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" +checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" dependencies = [ "anyhow", "cranelift-entity", - "gimli 0.26.2", + "gimli", "indexmap", "log", - "object 0.29.0", + "object", "serde", "target-lexicon", "thiserror", @@ -4762,18 +4639,18 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" +checksum = "0de48df552cfca1c9b750002d3e07b45772dd033b0b206d5c0968496abf31244" dependencies = [ - "addr2line 0.17.0", + "addr2line", "anyhow", "bincode", "cfg-if", "cpp_demangle", - "gimli 0.26.2", + "gimli", "log", - "object 0.29.0", + "object", "rustc-demangle", "serde", "target-lexicon", @@ -4781,36 +4658,36 @@ dependencies = [ "wasmtime-jit-debug", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-jit-debug" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" +checksum = "6e0554b84c15a27d76281d06838aed94e13a77d7bf604bbbaf548aa20eb93846" dependencies = [ - "object 0.29.0", + "object", "once_cell", "rustix 0.36.14", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" +checksum = "aecae978b13f7f67efb23bd827373ace4578f2137ec110bbf6a4a7cde4121bbd" dependencies = [ "cfg-if", "libc", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-runtime" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" +checksum = "658cf6f325232b6760e202e5255d823da5e348fdea827eff0a2a22319000b441" dependencies = [ "anyhow", "cc", @@ -4820,21 +4697,21 @@ dependencies = [ "log", "mach", "memfd", - "memoffset 0.6.5", + "memoffset 0.8.0", "paste", "rand 0.8.5", "rustix 0.36.14", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "wasmtime-types" -version = "6.0.2" +version = "8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" +checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" dependencies = [ "cranelift-entity", "serde", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 060224f..d1a6b11 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -45,7 +45,7 @@ wasm-loader = { version = "0.20.0", path = "../libs/wasm-loader" } wasm-testbed = { version = "0.20.0", path = "../libs/wasm-testbed" } serde_json = "1.0" text-style = { version = "0.3", features = ["crossterm"] } -sp-runtime = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } +sp-runtime = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } url = "2.3" [dev-dependencies] diff --git a/lib/Cargo.toml b/lib/Cargo.toml index ef550e2..f703245 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -37,7 +37,7 @@ serde = { version = "1.0", features = ["derive"] } scale-info = { version = "2.1", default-features = false, features = [ "derive", ] } -sp-version = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } +sp-version = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } ipfs-hasher = { version = "0.20.0", path = "../libs/ipfs-hasher" } wasm-loader = { version = "0.20.0", path = "../libs/wasm-loader" } wasm-testbed = { version = "0.20.0", path = "../libs/wasm-testbed" } diff --git a/libs/substrate-runtime-proposal-hash/Cargo.toml b/libs/substrate-runtime-proposal-hash/Cargo.toml index 042cd61..f204d7a 100644 --- a/libs/substrate-runtime-proposal-hash/Cargo.toml +++ b/libs/substrate-runtime-proposal-hash/Cargo.toml @@ -22,10 +22,10 @@ hex = "0.4" blake2 = "0.10" thiserror = "1.0" codec = { version = "3.1", package = "parity-scale-codec" } -sp-core = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-io = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-runtime = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-wasm-interface = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } +sp-core = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-io = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-runtime = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-wasm-interface = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } frame-metadata = { package = "frame-metadata", git = "https://github.com/paritytech/frame-metadata", branch = "main", features = [ "v12", "v13", diff --git a/libs/wasm-loader/Cargo.toml b/libs/wasm-loader/Cargo.toml index b3ad4d7..b3e5e43 100644 --- a/libs/wasm-loader/Cargo.toml +++ b/libs/wasm-loader/Cargo.toml @@ -25,7 +25,7 @@ multibase = "0.9" multihash = "0.18" array-bytes = { version = "6.1" } serde = { version = "1.0", features = ["derive"] } -sp-maybe-compressed-blob = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate/" } +sp-maybe-compressed-blob = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate/" } url = "2.3" # RPC components diff --git a/libs/wasm-testbed/Cargo.toml b/libs/wasm-testbed/Cargo.toml index a532219..db07875 100644 --- a/libs/wasm-testbed/Cargo.toml +++ b/libs/wasm-testbed/Cargo.toml @@ -23,15 +23,15 @@ log = "0.4" thiserror = "1.0" wasm-loader = { version = "0.20.0", path = "../wasm-loader" } substrate-runtime-proposal-hash = { version = "0.20.0", path = "../substrate-runtime-proposal-hash" } -sc-executor = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sc-executor-common = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } +sc-executor = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sc-executor-common = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } scale = { version = "3", package = "parity-scale-codec", default-features = false } -sp-core = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-io = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-runtime = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-state-machine = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-wasm-interface = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } -sp-version = { tag = "monthly-2023-05", git = "https://github.com/paritytech/substrate" } +sp-core = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-io = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-runtime = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-state-machine = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-wasm-interface = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } +sp-version = { tag = "monthly-2023-06", git = "https://github.com/paritytech/substrate" } scale-info = { version = "2.1", default-features = false, features = [ "derive", ] } diff --git a/libs/wasm-testbed/src/lib.rs b/libs/wasm-testbed/src/lib.rs index 65e2f4d..1c4eb17 100644 --- a/libs/wasm-testbed/src/lib.rs +++ b/libs/wasm-testbed/src/lib.rs @@ -134,7 +134,7 @@ impl WasmTestBed { // Substrate V14 requires a heap of ~34. // Polkadot V14 requires a heap of ~20. let executor: WasmExecutor = WasmExecutor::builder() - .with_execution_method(WasmExecutionMethod::Interpreted) + .with_execution_method(WasmExecutionMethod::default()) .with_offchain_heap_alloc_strategy(sc_executor::HeapAllocStrategy::Dynamic { maximum_pages: Some(64) }) .with_max_runtime_instances(8) .with_runtime_cache_size(2)