diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 38b36316497..173593660bf 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -17,6 +17,8 @@ env: # Build smaller artifacts to avoid running out of space in CI # TODO: Try to remove once https://github.com/paritytech/substrate/issues/11538 is resolved RUSTFLAGS: -C strip=symbols -C opt-level=s + # Remove unnecessary WASM build artefacts + WASM_BUILD_CLEAN_TARGET: 1 jobs: cargo-fmt: @@ -26,6 +28,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Rust toolchain uses: actions-rs/toolchain@v1 # TODO: Below can be removed when https://github.com/actions-rs/toolchain/issues/126 is resolved @@ -63,6 +70,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Rust toolchain uses: actions-rs/toolchain@v1 # TODO: Below can be removed when https://github.com/actions-rs/toolchain/issues/126 is resolved @@ -97,6 +109,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Rust toolchain uses: actions-rs/toolchain@v1 # TODO: Below can be removed when https://github.com/actions-rs/toolchain/issues/126 is resolved @@ -132,6 +149,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Rust toolchain uses: actions-rs/toolchain@v1 # TODO: Below can be removed when https://github.com/actions-rs/toolchain/issues/126 is resolved diff --git a/.github/workflows/rustdoc.yml b/.github/workflows/rustdoc.yml index 1ce45f87603..27ac6da0df6 100644 --- a/.github/workflows/rustdoc.yml +++ b/.github/workflows/rustdoc.yml @@ -18,6 +18,11 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Install Rust toolchain uses: actions-rs/toolchain@v1 with: diff --git a/.github/workflows/snapshot-build.yml b/.github/workflows/snapshot-build.yml index a5f2230111c..01913977bfd 100644 --- a/.github/workflows/snapshot-build.yml +++ b/.github/workflows/snapshot-build.yml @@ -111,6 +111,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Rust toolchain (${{ matrix.build.target }}) uses: actions-rs/toolchain@v1 # TODO: Below can be removed when https://github.com/actions-rs/toolchain/issues/126 is resolved diff --git a/Cargo.lock b/Cargo.lock index c2043622a47..dbffc4f3970 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -133,6 +133,12 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" +[[package]] +name = "array-bytes" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a913633b0c922e6b745072795f50d90ebea78ba31a57e2ac8c2fc7b50950949" + [[package]] name = "arrayref" version = "0.3.6" @@ -290,9 +296,9 @@ dependencies = [ [[package]] name = "async-std-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f2f8a4a203be3325981310ab243a28e6e4ea55b6519bffce05d41ab60e09ad8" +checksum = "6ba50e24d9ee0a8950d3d03fc6d0dd10aa14b5de3b101949b4e160f7fee7c723" dependencies = [ "async-std", "async-trait", @@ -381,7 +387,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object 0.29.0", + "object", "rustc-demangle", ] @@ -409,6 +415,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + [[package]] name = "beef" version = "0.5.2" @@ -418,12 +430,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bimap" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0455254eb5c6964c4545d8bac815e1a1be4f3afe0ae695ea539c12d728d44b" - [[package]] name = "bincode" version = "1.3.3" @@ -679,12 +685,27 @@ dependencies = [ "jobserver", ] +[[package]] +name = "cfg-expr" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aacacf4d96c24b2ad6eb8ee6df040e4f27b0d0b39a5710c30091baa830485db" +dependencies = [ + "smallvec", +] + [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + [[package]] name = "chacha20" version = "0.9.0" @@ -753,9 +774,9 @@ dependencies = [ [[package]] name = "cid" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc949bff6704880faf064c42a4854032ab07bfcf3a4fcb82a57470acededb69c" +checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ "core2", "multibase", @@ -789,23 +810,33 @@ name = "clap" version = "3.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3dbbb6653e7c55cc8595ad3e1f7be8f32aba4eb7ff7f0fd1163d4f3d137c0a9" +dependencies = [ + "bitflags", + "clap_lex 0.2.4", + "indexmap", + "textwrap", +] + +[[package]] +name = "clap" +version = "4.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91b9970d7505127a162fdaa9b96428d28a479ba78c9ec7550a63a5d9863db682" dependencies = [ "atty", "bitflags", "clap_derive", - "clap_lex", - "indexmap", + "clap_lex 0.3.0", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap_derive" -version = "3.2.15" +version = "4.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba52acd3b0a5c33aeada5cdaa3267cdc7c594a98731d4268cdc1532f4264cb4" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" dependencies = [ "heck", "proc-macro-error", @@ -824,12 +855,22 @@ dependencies = [ ] [[package]] -name = "cmake" -version = "0.1.48" +name = "clap_lex" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ - "cc", + "os_str_bytes", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", ] [[package]] @@ -854,9 +895,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "722e23542a15cea1f65d4a1419c4cfd7a26706c70871a13a04238ca3f40f1661" [[package]] name = "constant_time_eq" @@ -915,19 +956,21 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7901fbba05decc537080b07cb3f1cadf53be7b7602ca8255786288a8692ae29a" +checksum = "44409ccf2d0f663920cab563d2b79fcd6b2e9a2bcc6e929fef76c8f82ad6c17a" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ba1b45d243a4a28e12d26cd5f2507da74e77c45927d40de8b6ffbf088b46b5" +checksum = "98de2018ad96eb97f621f7d6b900a0cc661aec8d02ea4a50e56ecb48e5a2fcaf" dependencies = [ + "arrayvec 0.7.2", + "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", @@ -942,33 +985,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54cc30032171bf230ce22b99c07c3a1de1221cb5375bd6dbe6dbe77d0eed743c" +checksum = "5287ce36e6c4758fbaf298bd1a8697ad97a4f2375a3d1b61142ea538db4877e5" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23f2672426d2bb4c9c3ef53e023076cfc4d8922f0eeaebaf372c92fae8b5c69" +checksum = "2855c24219e2f08827f3f4ffb2da92e134ae8d8ecc185b11ec8f9878cf5f588e" [[package]] name = "cranelift-entity" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "886c59a5e0de1f06dbb7da80db149c75de10d5e2caca07cdd9fef8a5918a6336" +checksum = "0b65673279d75d34bf11af9660ae2dbd1c22e6d28f163f5c72f4e1dc56d56103" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace74eeca11c439a9d4ed1a5cb9df31a54cd0f7fbddf82c8ce4ea8e9ad2a8fe0" +checksum = "3ed2b3d7a4751163f6c4a349205ab1b7d9c00eecf19dcea48592ef1f7688eefc" dependencies = [ "cranelift-codegen", "log", @@ -978,15 +1021,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db1ae52a5cc2cad0d86fdd3dcb16b7217d2f1e65ab4f5814aa4f014ad335fa43" +checksum = "3be64cecea9d90105fc6a2ba2d003e98c867c1d6c4c86cc878f97ad9fb916293" [[package]] name = "cranelift-native" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dadcfb7852900780d37102bce5698bcd401736403f07b52e714ff7a180e0e22f" +checksum = "c4a03a6ac1b063e416ca4b93f6247978c991475e8271465340caa6f92f3c16a4" dependencies = [ "cranelift-codegen", "libc", @@ -995,9 +1038,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.85.1" +version = "0.88.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84e3410960389110b88f97776f39f6d2c8becdaa4cd59e390e6b76d9d0e7190" +checksum = "c699873f7b30bc5f20dd03a796b4183e073a46616c91704792ec35e45d13f913" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1028,7 +1071,7 @@ dependencies = [ "atty", "cast", "ciborium", - "clap", + "clap 3.2.16", "criterion-plot", "itertools 0.10.3", "lazy_static", @@ -1131,9 +1174,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -1190,17 +1233,6 @@ dependencies = [ "cipher 0.3.0", ] -[[package]] -name = "cuckoofilter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" -dependencies = [ - "byteorder 1.4.3", - "fnv", - "rand 0.7.3", -] - [[package]] name = "curve25519-dalek" version = "2.1.3" @@ -1240,6 +1272,50 @@ dependencies = [ "zeroize", ] +[[package]] +name = "cxx" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97abf9f0eca9e52b7f81b945524e76710e6cb2366aead23b7d4fbf72e281f888" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc32cc5fea1d894b77d269ddb9f192110069a8a9c1f1d441195fba90553dea3" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca220e4794c934dc6b1207c3b42856ad4c302f2df1712e9f8d2eec5afaacf1f" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b846f081361125bfc8dc9d3940c84e1fd83ba54bbca7b17cd29483c828be0704" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "data-encoding" version = "2.3.2" @@ -1268,11 +1344,12 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" dependencies = [ "const-oid", + "zeroize", ] [[package]] @@ -1299,6 +1376,12 @@ dependencies = [ "syn", ] +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + [[package]] name = "digest" version = "0.8.1" @@ -1464,6 +1547,7 @@ dependencies = [ "substrate-test-runtime-client", "substrate-test-utils", "system-runtime-primitives", + "tempfile", "thiserror", "tokio", "tracing", @@ -1477,6 +1561,7 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "sc-network", + "sc-network-common", "sc-network-gossip", "sc-utils", "sp-core", @@ -1534,7 +1619,7 @@ dependencies = [ name = "domain-service" version = "0.1.0" dependencies = [ - "clap", + "clap 4.0.22", "domain-client-consensus-relay-chain", "domain-client-executor", "domain-client-executor-gossip", @@ -1546,13 +1631,13 @@ dependencies = [ "log", "pallet-transaction-payment-rpc", "sc-chain-spec", - "sc-cli", "sc-client-api", "sc-consensus", "sc-executor", "sc-network", "sc-rpc", "sc-rpc-api", + "sc-rpc-spec-v2", "sc-service", "sc-telemetry", "sc-transaction-pool", @@ -1636,6 +1721,7 @@ dependencies = [ "sc-consensus-slots", "sc-executor", "sc-network", + "sc-network-common", "sc-rpc", "sc-service", "sc-tracing", @@ -1658,6 +1744,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "downcast" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1" + [[package]] name = "downcast-rs" version = "1.2.0" @@ -1749,9 +1841,9 @@ checksum = "9d07a982d1fb29db01e5a59b1918e03da4df7297eaeee7686ac45542fd4e59c8" [[package]] name = "ecdsa" -version = "0.13.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0d69ae62e0ce582d56380743515fefaf1a8c70cec685d9677636d7e30ae9dc9" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ "der", "elliptic-curve", @@ -1782,6 +1874,20 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek 3.2.0", + "hashbrown 0.12.3", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "either" version = "1.7.0" @@ -1790,13 +1896,14 @@ checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" [[package]] name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", "der", + "digest 0.10.3", "ff", "generic-array 0.14.6", "group", @@ -1808,9 +1915,9 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ "heck", "proc-macro2", @@ -1916,9 +2023,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131655483be284720a17d74ff97592b8e76576dc25563148601df2d7c9080924" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -1943,7 +2050,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1964,9 +2071,9 @@ dependencies = [ [[package]] name = "fixed-hash" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ "byteorder 1.4.3", "rand 0.8.5", @@ -1991,6 +2098,15 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -2000,7 +2116,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", ] @@ -2015,10 +2131,16 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fragile" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" + [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-support", "frame-system", @@ -2030,6 +2152,7 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", + "sp-core", "sp-io", "sp-runtime", "sp-runtime-interface", @@ -2040,11 +2163,12 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "Inflector", + "array-bytes", "chrono", - "clap", + "clap 4.0.22", "comfy-table", "frame-benchmarking", "frame-support", @@ -2052,7 +2176,6 @@ dependencies = [ "gethostname", "handlebars", "hash-db", - "hex", "itertools 0.10.3", "kvdb", "lazy_static", @@ -2081,6 +2204,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "sp-state-machine", + "sp-std", "sp-storage", "sp-trie", "tempfile", @@ -2091,7 +2215,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-support", "frame-system", @@ -2119,7 +2243,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "bitflags", "frame-metadata", @@ -2144,16 +2268,19 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-tracing", + "sp-weights", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "Inflector", + "cfg-expr", "frame-support-procedural-tools", + "itertools 0.10.3", "proc-macro2", "quote", "syn", @@ -2162,7 +2289,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2174,7 +2301,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "proc-macro2", "quote", @@ -2184,7 +2311,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-support", "log", @@ -2196,12 +2323,13 @@ dependencies = [ "sp-runtime", "sp-std", "sp-version", + "sp-weights", ] [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-benchmarking", "frame-support", @@ -2216,7 +2344,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "sp-api", @@ -2533,9 +2661,9 @@ dependencies = [ [[package]] name = "group" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5ac374b108929de78460075f3dc439fa66df9d8fc77e8f12caa5165fcf0c89" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ "ff", "rand_core 0.6.4", @@ -2605,15 +2733,6 @@ dependencies = [ "ahash 0.4.7", ] -[[package]] -name = "hashbrown" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" -dependencies = [ - "ahash 0.7.6", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -2679,6 +2798,15 @@ dependencies = [ "digest 0.9.0", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.3", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -2709,7 +2837,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ "bytes", "fnv", - "itoa 1.0.2", + "itoa", ] [[package]] @@ -2756,7 +2884,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.2", + "itoa", "pin-project-lite 0.2.9", "socket2", "tokio", @@ -2817,9 +2945,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "1.1.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015a7df1eb6dda30df37f34b63ada9b7b352984b0e84de2a20ed526345000791" +checksum = "065c008e570a43c00de6aed9714035e5ea6a498c255323db9091722af6ee67dd" dependencies = [ "async-io", "core-foundation", @@ -2844,9 +2972,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -2902,15 +3030,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" - -[[package]] -name = "io-lifetimes" -version = "0.7.2" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24c3f4eff5495aee4c0399d7b6a0dc2b6e81be84242ffbfcf253ebacccc1d0cb" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] name = "ip_network" @@ -2956,15 +3078,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "jemalloc-sys" @@ -3189,14 +3305,14 @@ dependencies = [ [[package]] name = "k256" -version = "0.10.4" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c3a5e0a0b8450278feda242592512e09f61c72e018b8cd5c859482802daf2d" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.2", ] [[package]] @@ -3226,9 +3342,9 @@ dependencies = [ [[package]] name = "kvdb" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a301d8ecb7989d4a6e2c57a49baca77d353bdbf879909debe3f375fe25d61f86" +checksum = "585089ceadba0197ffe9af6740ab350b325e3c1f5fccfbc3522e0250c750409b" dependencies = [ "parity-util-mem", "smallvec", @@ -3236,9 +3352,9 @@ dependencies = [ [[package]] name = "kvdb-memorydb" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ece7e668abd21387aeb6628130a6f4c802787f014fa46bc83221448322250357" +checksum = "40d109c87bfb7759edd2a49b2649c1afe25af785d930ad6a38479b4dc70dd873" dependencies = [ "kvdb", "parity-util-mem", @@ -3253,9 +3369,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.131" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c3b4822ccebfa39c02fc03d1534441b22ead323fa0f48bb7ddd8e6ba076a40" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libm" @@ -3265,8 +3381,9 @@ checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db" [[package]] name = "libp2p" -version = "0.46.1" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" dependencies = [ "bytes", "futures 0.3.21", @@ -3274,11 +3391,8 @@ dependencies = [ "getrandom 0.2.7", "instant", "lazy_static", - "libp2p-autonat", "libp2p-core", - "libp2p-deflate", "libp2p-dns", - "libp2p-floodsub", "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", @@ -3287,47 +3401,24 @@ dependencies = [ "libp2p-mplex", "libp2p-noise", "libp2p-ping", - "libp2p-plaintext", - "libp2p-pnet", - "libp2p-relay", - "libp2p-rendezvous", "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-derive", "libp2p-tcp", - "libp2p-uds", "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", "multiaddr", "parking_lot 0.12.1", "pin-project", - "rand 0.7.3", "smallvec", ] -[[package]] -name = "libp2p-autonat" -version = "0.5.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "async-trait", - "futures 0.3.21", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-request-response", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.8.5", -] - [[package]] name = "libp2p-core" -version = "0.34.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" dependencies = [ "asn1_der", "bs58", @@ -3338,7 +3429,6 @@ dependencies = [ "futures-timer", "instant", "lazy_static", - "libsecp256k1", "log", "multiaddr", "multihash", @@ -3348,9 +3438,7 @@ dependencies = [ "prost", "prost-build", "rand 0.8.5", - "ring", "rw-stream-sink", - "schnorrkel", "serde", "sha2 0.10.2", "smallvec", @@ -3360,20 +3448,11 @@ dependencies = [ "zeroize", ] -[[package]] -name = "libp2p-deflate" -version = "0.34.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "flate2", - "futures 0.3.21", - "libp2p-core", -] - [[package]] name = "libp2p-dns" -version = "0.34.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720" dependencies = [ "async-std-resolver", "futures 0.3.21", @@ -3384,27 +3463,11 @@ dependencies = [ "trust-dns-resolver", ] -[[package]] -name = "libp2p-floodsub" -version = "0.37.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "cuckoofilter", - "fnv", - "futures 0.3.21", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec", -] - [[package]] name = "libp2p-gossipsub" -version = "0.39.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7b8d02b9089241196479c6fdae22df4d4444509edb3a8e7ef388218ca9b5e3e" dependencies = [ "asynchronous-codec", "base64", @@ -3420,7 +3483,7 @@ dependencies = [ "prometheus-client", "prost", "prost-build", - "rand 0.7.3", + "rand 0.8.5", "regex", "serde", "sha2 0.10.2", @@ -3431,8 +3494,9 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.37.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf9a121f699e8719bda2e6e9e9b6ddafc6cff4602471d6481c1067930ccb29b" dependencies = [ "asynchronous-codec", "futures 0.3.21", @@ -3440,7 +3504,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru", + "lru 0.8.1", "prost", "prost-build", "prost-codec", @@ -3451,8 +3515,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.38.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6721c200e2021f6c3fab8b6cf0272ead8912d871610ee194ebd628cecf428f22" dependencies = [ "arrayvec 0.7.2", "asynchronous-codec", @@ -3467,7 +3532,7 @@ dependencies = [ "log", "prost", "prost-build", - "rand 0.7.3", + "rand 0.8.5", "serde", "sha2 0.10.2", "smallvec", @@ -3479,15 +3544,15 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.38.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "761704e727f7d68d58d7bc2231eafae5fc1b9814de24290f126df09d4bd37a15" dependencies = [ "async-io", "data-encoding", "dns-parser", "futures 0.3.21", "if-watch", - "lazy_static", "libp2p-core", "libp2p-swarm", "log", @@ -3499,23 +3564,24 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.7.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ee31b08e78b7b8bfd1c4204a9dd8a87b4fcdf6dafc57eb51701c1c264a81cb9" dependencies = [ "libp2p-core", "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-ping", - "libp2p-relay", "libp2p-swarm", "prometheus-client", ] [[package]] name = "libp2p-mplex" -version = "0.34.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692664acfd98652de739a8acbb0a0d670f1d67190a49be6b4395e22c37337d89" dependencies = [ "asynchronous-codec", "bytes", @@ -3524,15 +3590,16 @@ dependencies = [ "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.37.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "048155686bd81fe6cb5efdef0c6290f25ad32a0a42e8f4f72625cf6a505a206f" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -3552,8 +3619,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.37.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.40.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7228b9318d34689521349a86eb39a3c3a802c9efc99a0568062ffb80913e3f91" dependencies = [ "futures 0.3.21", "futures-timer", @@ -3561,90 +3629,15 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", - "void", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.34.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "asynchronous-codec", - "bytes", - "futures 0.3.21", - "libp2p-core", - "log", - "prost", - "prost-build", - "unsigned-varint", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.22.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "futures 0.3.21", - "log", - "pin-project", - "rand 0.7.3", - "salsa20", - "sha3", -] - -[[package]] -name = "libp2p-relay" -version = "0.10.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "asynchronous-codec", - "bytes", - "either", - "futures 0.3.21", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "pin-project", - "prost", - "prost-build", - "prost-codec", - "rand 0.8.5", - "smallvec", - "static_assertions", - "thiserror", - "void", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.7.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "asynchronous-codec", - "bimap", - "futures 0.3.21", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.8.5", - "sha2 0.10.2", - "thiserror", - "unsigned-varint", + "rand 0.8.5", "void", ] [[package]] name = "libp2p-request-response" -version = "0.19.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8827af16a017b65311a410bb626205a9ad92ec0473967618425039fa5231adc1" dependencies = [ "async-trait", "bytes", @@ -3653,15 +3646,16 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "unsigned-varint", ] [[package]] name = "libp2p-swarm" -version = "0.37.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.40.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" dependencies = [ "either", "fnv", @@ -3671,7 +3665,7 @@ dependencies = [ "libp2p-core", "log", "pin-project", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "thiserror", "void", @@ -3679,24 +3673,25 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.28.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" dependencies = [ + "heck", "quote", "syn", ] [[package]] name = "libp2p-tcp" -version = "0.34.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92" dependencies = [ "async-io", "futures 0.3.21", "futures-timer", - "if-addrs", "if-watch", - "ipnet", "libc", "libp2p-core", "log", @@ -3704,21 +3699,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "libp2p-uds" -version = "0.33.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" -dependencies = [ - "async-std", - "futures 0.3.21", - "libp2p-core", - "log", -] - [[package]] name = "libp2p-wasm-ext" -version = "0.34.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b5b8e7a73e379e47b1b77f8a82c4721e97eca01abcd18e9cd91a23ca6ce97" dependencies = [ "futures 0.3.21", "js-sys", @@ -3730,8 +3715,9 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.36.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3758ae6f89b2531a24b6d9f5776bda6a626b60a57600d7185d43dfa75ca5ecc4" dependencies = [ "either", "futures 0.3.21", @@ -3748,11 +3734,13 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.38.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30f079097a21ad017fc8139460630286f02488c8c13b26affb46623aa20d8845" dependencies = [ "futures 0.3.21", "libp2p-core", + "log", "parking_lot 0.12.1", "thiserror", "yamux", @@ -3817,6 +3805,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -3842,12 +3839,6 @@ dependencies = [ "statrs", ] -[[package]] -name = "linux-raw-sys" -version = "0.0.42" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7" - [[package]] name = "linux-raw-sys" version = "0.0.46" @@ -3883,6 +3874,15 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "lru" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" +dependencies = [ + "hashbrown 0.12.3", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -3974,11 +3974,11 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" -version = "0.4.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6627dc657574b49d6ad27105ed671822be56e0d2547d413bfbf3e8d8fa92e7a" +checksum = "480b5a5de855d11ff13195950bdc8b98b5e942ef47afc447f6615cdcc4e15d80" dependencies = [ - "libc", + "rustix", ] [[package]] @@ -4011,9 +4011,9 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" +checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" dependencies = [ "hash-db", "hashbrown 0.12.3", @@ -4022,9 +4022,9 @@ dependencies = [ [[package]] name = "memory_units" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" +checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" [[package]] name = "merkle_light" @@ -4093,14 +4093,35 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] -name = "more-asserts" -version = "0.2.2" +name = "mockall" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" +checksum = "50e4a1c770583dac7ab5e2f6c139153b783a53a1bbee9729613f193e59828326" +dependencies = [ + "cfg-if", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", +] + +[[package]] +name = "mockall_derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "832663583d5fa284ca8810bf7015e46c9fff9622d3cf34bd1eea5003fec06dd0" +dependencies = [ + "cfg-if", + "proc-macro2", + "quote", + "syn", +] [[package]] name = "multiaddr" @@ -4172,8 +4193,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.11.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bc41247ec209813e2fd414d6e16b9d94297dacf3cd613fa6ef09cd4d9755c10" dependencies = [ "bytes", "futures 0.3.21", @@ -4193,7 +4215,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.1", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -4310,11 +4332,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" +[[package]] +name = "normalize-line-endings" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" + [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -4332,12 +4360,12 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +checksum = "54b862ff8df690cf089058c98b183676a7ed0f974cc08b426800093227cbff3b" dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", + "arrayvec 0.7.2", + "itoa", ] [[package]] @@ -4350,18 +4378,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "num-rational" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" -dependencies = [ - "autocfg", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-rational" version = "0.4.1" @@ -4369,6 +4385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -4393,24 +4410,15 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.28.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" -dependencies = [ - "crc32fast", - "hashbrown 0.11.2", - "indexmap", - "memchr", -] - [[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", ] @@ -4466,19 +4474,10 @@ version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4" -[[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-benchmarking", "frame-support", @@ -4716,7 +4715,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-support", "frame-system", @@ -4730,7 +4729,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-benchmarking", "frame-support", @@ -4759,7 +4758,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-support", "frame-system", @@ -4775,7 +4774,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -4785,17 +4784,19 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", + "sp-weights", ] [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", "sp-api", "sp-runtime", + "sp-weights", ] [[package]] @@ -4818,7 +4819,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-benchmarking", "frame-support", @@ -4885,9 +4886,9 @@ checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parity-util-mem" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" +checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" dependencies = [ "cfg-if", "hashbrown 0.12.3", @@ -4911,18 +4912,9 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.32.0" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder 1.4.3", -] - -[[package]] -name = "parity-wasm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking" @@ -4975,7 +4967,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -5063,18 +5055,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78203e83c48cffbe01e4a2d35d566ca4de445d79a85372fc64e378bfc812a260" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710faf75e1b33345361201d36d04e98ac1ed8909151a017ed384700836104c74" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -5099,6 +5091,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.25" @@ -5193,11 +5195,51 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +[[package]] +name = "predicates" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab68289ded120dcbf9d571afcf70163233229052aec9b08ab09532f698d0e1e6" +dependencies = [ + "difflib", + "float-cmp", + "itertools 0.10.3", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e7125585d872860e9955ca571650b27a4979c5823084168c5ed5bbfb016b56" + +[[package]] +name = "predicates-tree" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad3f7fa8d61e139cbc7c3edfebf3b6678883a53f5ffac65d1259329a93ee43a5" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "prettyplease" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +dependencies = [ + "proc-macro2", + "syn", +] + [[package]] name = "primitive-types" -version = "0.11.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28720988bff275df1f51b171e1b2a18c30d194c4d2b61defdacecd625a5d94a" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" dependencies = [ "fixed-hash", "impl-codec", @@ -5242,9 +5284,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -5265,21 +5307,21 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.16.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" +checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" dependencies = [ "dtoa", - "itoa 1.0.2", - "owning_ref", + "itoa", + "parking_lot 0.12.1", "prometheus-client-derive-text-encode", ] [[package]] name = "prometheus-client-derive-text-encode" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" +checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" dependencies = [ "proc-macro2", "quote", @@ -5288,9 +5330,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.10.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" +checksum = "a0841812012b2d4a6145fae9a6af1534873c32aa67fff26bd09f8fa42c83f95a" dependencies = [ "bytes", "prost-derive", @@ -5298,30 +5340,31 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.10.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" +checksum = "1d8b442418ea0822409d9e7d047cbf1e7e9e1760b172bf9982cf29d517c93511" dependencies = [ "bytes", - "cfg-if", - "cmake", "heck", "itertools 0.10.3", "lazy_static", "log", "multimap", "petgraph", + "prettyplease", "prost", "prost-types", "regex", + "syn", "tempfile", "which", ] [[package]] name = "prost-codec" -version = "0.1.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "011ae9ff8359df7915f97302d591cdd9e0e27fbd5a4ddc5bd13b71079bb20987" dependencies = [ "asynchronous-codec", "bytes", @@ -5332,9 +5375,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.10.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" +checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" dependencies = [ "anyhow", "itertools 0.10.3", @@ -5345,9 +5388,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.10.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" +checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" dependencies = [ "bytes", "prost", @@ -5590,7 +5633,7 @@ dependencies = [ "cc", "libc", "libm", - "lru", + "lru 0.7.8", "parking_lot 0.11.2", "smallvec", "spin 0.9.4", @@ -5618,9 +5661,9 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.2.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a8d23b35d7177df3b9d31ed8a9ab4bf625c668be77a319d4f5efd4a5257701c" +checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" dependencies = [ "fxhash", "log", @@ -5654,18 +5697,6 @@ version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" -[[package]] -name = "region" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" -dependencies = [ - "bitflags", - "libc", - "mach", - "winapi 0.3.9", -] - [[package]] name = "remove_dir_all" version = "0.5.3" @@ -5687,12 +5718,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ef608575f6392792f9ecf7890c00086591d29a83910939d430753f7c050525" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ "crypto-bigint", - "hmac 0.11.0", + "hmac 0.12.1", "zeroize", ] @@ -5713,9 +5744,9 @@ dependencies = [ [[package]] name = "rpassword" -version = "5.0.1" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" +checksum = "20c9f5d2a0c3e2ea729ab3706d22217177770654c3ef5056b68b69d07332d3f5" dependencies = [ "libc", "winapi 0.3.9", @@ -5765,30 +5796,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.33.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes 0.5.3", - "libc", - "linux-raw-sys 0.0.42", - "winapi 0.3.9", -] - -[[package]] -name = "rustix" -version = "0.35.7" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51cc38aa10f6bbb377ed28197aa052aa4e2b762c22be9d3153d01822587e787" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", - "io-lifetimes 0.7.2", + "io-lifetimes", "libc", - "linux-raw-sys 0.0.46", - "windows-sys", + "linux-raw-sys", + "windows-sys 0.42.0", ] [[package]] @@ -5833,7 +5850,8 @@ checksum = "24c8ad4f0c00e1eb5bc7614d236a7f1300e3dbd76b68cac8e06fb00b015ad8d8" [[package]] name = "rw-stream-sink" version = "0.3.0" -source = "git+https://github.com/subspace/rust-libp2p?branch=subspace-v3#e0bc2171945da9f4ac79aee8c4a0678cb8f72c04" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" dependencies = [ "futures 0.3.21", "pin-project", @@ -5844,16 +5862,7 @@ dependencies = [ name = "ryu" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" - -[[package]] -name = "salsa20" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" -dependencies = [ - "cipher 0.3.0", -] +checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" [[package]] name = "same-file" @@ -5867,7 +5876,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "log", "sp-core", @@ -5878,7 +5887,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "futures-timer", @@ -5901,7 +5910,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -5917,13 +5926,13 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "impl-trait-for-tuples", "memmap2", "parity-scale-codec", "sc-chain-spec-derive", - "sc-network", + "sc-network-common", "sc-telemetry", "serde", "serde_json", @@ -5934,7 +5943,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5945,13 +5954,13 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "chrono", - "clap", + "clap 4.0.22", "fdlimit", "futures 0.3.21", - "hex", "libp2p", "log", "names", @@ -5963,6 +5972,7 @@ dependencies = [ "sc-client-db", "sc-keystore", "sc-network", + "sc-network-common", "sc-service", "sc-telemetry", "sc-tracing", @@ -5984,7 +5994,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "fnv", "futures 0.3.21", @@ -6012,7 +6022,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "hash-db", "kvdb", @@ -6036,7 +6046,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "futures 0.3.21", @@ -6074,7 +6084,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "futures 0.3.21", @@ -6092,7 +6102,6 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-timestamp", "thiserror", ] @@ -6105,7 +6114,7 @@ dependencies = [ "futures 0.3.21", "futures-timer", "log", - "lru", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "rand 0.8.5", @@ -6175,10 +6184,10 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "lazy_static", - "lru", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "sc-executor-common", @@ -6202,7 +6211,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "environmental", "parity-scale-codec", @@ -6218,7 +6227,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "log", "parity-scale-codec", @@ -6233,15 +6242,15 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "cfg-if", "libc", "log", "once_cell", "parity-scale-codec", - "parity-wasm 0.42.2", - "rustix 0.35.7", + "parity-wasm", + "rustix", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -6253,7 +6262,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "ansi_term", "futures 0.3.21", @@ -6270,10 +6279,10 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "async-trait", - "hex", "parking_lot 0.12.1", "serde_json", "sp-application-crypto", @@ -6285,8 +6294,9 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "async-trait", "asynchronous-codec", "bitflags", @@ -6297,18 +6307,16 @@ dependencies = [ "fork-tree", "futures 0.3.21", "futures-timer", - "hex", "ip_network", "libp2p", "linked-hash-map", "linked_hash_set", "log", - "lru", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "pin-project", "prost", - "prost-build", "rand 0.7.3", "sc-block-builder", "sc-client-api", @@ -6327,44 +6335,68 @@ dependencies = [ "substrate-prometheus-endpoint", "thiserror", "unsigned-varint", - "void", "zeroize", ] +[[package]] +name = "sc-network-bitswap" +version = "0.10.0-dev" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" +dependencies = [ + "cid", + "futures 0.3.21", + "libp2p", + "log", + "prost", + "prost-build", + "sc-client-api", + "sc-network-common", + "sp-blockchain", + "sp-runtime", + "thiserror", + "unsigned-varint", + "void", +] + [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "bitflags", "bytes", "futures 0.3.21", + "futures-timer", "libp2p", + "linked_hash_set", "parity-scale-codec", "prost-build", "sc-consensus", "sc-peerset", + "serde", "smallvec", + "sp-blockchain", "sp-consensus", "sp-finality-grandpa", "sp-runtime", + "substrate-prometheus-endpoint", "thiserror", ] [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "ahash 0.7.6", "futures 0.3.21", "futures-timer", "libp2p", "log", - "lru", - "sc-network", + "lru 0.7.8", "sc-network-common", + "sc-peerset", "sp-runtime", "substrate-prometheus-endpoint", "tracing", @@ -6373,10 +6405,10 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "futures 0.3.21", - "hex", "libp2p", "log", "parity-scale-codec", @@ -6394,14 +6426,15 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "fork-tree", "futures 0.3.21", - "hex", "libp2p", "log", - "lru", + "lru 0.7.8", + "mockall", "parity-scale-codec", "prost", "prost-build", @@ -6409,6 +6442,7 @@ dependencies = [ "sc-consensus", "sc-network-common", "sc-peerset", + "sc-utils", "smallvec", "sp-arithmetic", "sp-blockchain", @@ -6448,26 +6482,46 @@ dependencies = [ "substrate-test-runtime-client", ] +[[package]] +name = "sc-network-transactions" +version = "0.10.0-dev" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" +dependencies = [ + "array-bytes", + "futures 0.3.21", + "hex", + "libp2p", + "log", + "parity-scale-codec", + "pin-project", + "sc-network-common", + "sc-peerset", + "sp-consensus", + "sp-runtime", + "substrate-prometheus-endpoint", +] + [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "bytes", "fnv", "futures 0.3.21", "futures-timer", - "hex", "hyper", "hyper-rustls", + "libp2p", "num_cpus", "once_cell", "parity-scale-codec", "parking_lot 0.12.1", "rand 0.7.3", "sc-client-api", - "sc-network", "sc-network-common", + "sc-peerset", "sc-utils", "sp-api", "sp-core", @@ -6480,7 +6534,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "libp2p", @@ -6503,7 +6557,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -6512,7 +6566,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "hash-db", @@ -6542,7 +6596,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "jsonrpsee", @@ -6565,7 +6619,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "jsonrpsee", @@ -6575,10 +6629,29 @@ dependencies = [ "tokio", ] +[[package]] +name = "sc-rpc-spec-v2" +version = "0.10.0-dev" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" +dependencies = [ + "futures 0.3.21", + "hex", + "jsonrpsee", + "parity-scale-codec", + "sc-chain-spec", + "sc-transaction-pool-api", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-runtime", + "thiserror", +] + [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "directories", @@ -6602,12 +6675,15 @@ dependencies = [ "sc-informant", "sc-keystore", "sc-network", + "sc-network-bitswap", "sc-network-common", "sc-network-light", "sc-network-sync", + "sc-network-transactions", "sc-offchain", "sc-rpc", "sc-rpc-server", + "sc-rpc-spec-v2", "sc-sysinfo", "sc-telemetry", "sc-tracing", @@ -6634,6 +6710,7 @@ dependencies = [ "sp-transaction-storage-proof", "sp-trie", "sp-version", + "static_init", "substrate-prometheus-endpoint", "tempfile", "thiserror", @@ -6645,7 +6722,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "log", "parity-scale-codec", @@ -6671,7 +6748,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "libc", @@ -6690,7 +6767,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "chrono", "futures 0.3.21", @@ -6708,7 +6785,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "ansi_term", "atty", @@ -6739,7 +6816,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6750,8 +6827,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "async-trait", "futures 0.3.21", "futures-timer", "linked-hash-map", @@ -6776,8 +6854,9 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "async-trait", "futures 0.3.21", "log", "serde", @@ -6789,7 +6868,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "futures-timer", @@ -6832,7 +6911,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -6859,6 +6938,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "sct" version = "0.7.0" @@ -6871,12 +6956,14 @@ dependencies = [ [[package]] name = "sec1" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ + "base16ct", "der", "generic-array 0.14.6", + "pkcs8", "subtle", "zeroize", ] @@ -7001,11 +7088,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.83" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ - "itoa 1.0.2", + "itoa", "ryu", "serde", ] @@ -7120,11 +7207,11 @@ dependencies = [ [[package]] name = "signature" -version = "1.4.0" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02658e48d89f2bec991f9a78e69cfa4c316f8d6a6c4ec12fae1aeb263d486788" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.3", "rand_core 0.6.4", ] @@ -7213,7 +7300,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "hash-db", "log", @@ -7223,6 +7310,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-version", "thiserror", ] @@ -7230,7 +7318,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "blake2", "proc-macro-crate", @@ -7242,7 +7330,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "scale-info", @@ -7255,7 +7343,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "integer-sqrt", "num-traits", @@ -7270,7 +7358,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "parity-scale-codec", @@ -7282,7 +7370,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "sp-api", @@ -7294,11 +7382,11 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "log", - "lru", + "lru 0.7.8", "parity-scale-codec", "parking_lot 0.12.1", "sp-api", @@ -7312,7 +7400,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "futures 0.3.21", @@ -7331,7 +7419,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "scale-info", @@ -7372,18 +7460,18 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder 1.4.3", "dyn-clonable", - "ed25519-dalek", + "ed25519-zebra", "futures 0.3.21", "hash-db", "hash256-std-hasher", - "hex", "impl-serde", "lazy_static", "libsecp256k1", @@ -7418,7 +7506,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "blake2", "byteorder 1.4.3", @@ -7432,7 +7520,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "proc-macro2", "quote", @@ -7443,7 +7531,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -7452,7 +7540,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "proc-macro2", "quote", @@ -7504,7 +7592,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "environmental", "parity-scale-codec", @@ -7515,7 +7603,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "finality-grandpa", "log", @@ -7533,7 +7621,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -7547,7 +7635,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "bytes", "futures 0.3.21", @@ -7573,7 +7661,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "lazy_static", "sp-core", @@ -7584,7 +7672,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "futures 0.3.21", @@ -7622,7 +7710,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "thiserror", "zstd", @@ -7654,7 +7742,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "sp-api", "sp-core", @@ -7664,7 +7752,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "backtrace", "lazy_static", @@ -7674,7 +7762,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "rustc-hash", "serde", @@ -7684,7 +7772,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "either", "hash256-std-hasher", @@ -7701,12 +7789,13 @@ dependencies = [ "sp-core", "sp-io", "sp-std", + "sp-weights", ] [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -7724,7 +7813,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "Inflector", "proc-macro-crate", @@ -7736,7 +7825,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "log", "parity-scale-codec", @@ -7750,7 +7839,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "scale-info", @@ -7764,7 +7853,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "scale-info", @@ -7775,7 +7864,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "hash-db", "log", @@ -7797,12 +7886,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "impl-serde", "parity-scale-codec", @@ -7815,7 +7904,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "log", "sp-core", @@ -7828,7 +7917,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "futures-timer", @@ -7844,7 +7933,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "sp-std", @@ -7856,7 +7945,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "sp-api", "sp-runtime", @@ -7865,7 +7954,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "async-trait", "log", @@ -7881,15 +7970,22 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "ahash 0.7.6", "hash-db", + "hashbrown 0.12.3", + "lazy_static", + "lru 0.7.8", "memory-db", + "nohash-hasher", "parity-scale-codec", + "parking_lot 0.12.1", "scale-info", "sp-core", "sp-std", "thiserror", + "tracing", "trie-db", "trie-root", ] @@ -7897,11 +7993,11 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "impl-serde", "parity-scale-codec", - "parity-wasm 0.42.2", + "parity-wasm", "scale-info", "serde", "sp-core-hashing-proc-macro", @@ -7914,7 +8010,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -7925,7 +8021,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "impl-trait-for-tuples", "log", @@ -7935,6 +8031,22 @@ dependencies = [ "wasmtime", ] +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", +] + [[package]] name = "spin" version = "0.5.2" @@ -7947,11 +8059,21 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "ss58-registry" -version = "1.25.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a039906277e0d8db996cd9d1ef19278c10209d994ecfc1025ced16342873a17c" +checksum = "3ab7554f8a8b6f8d71cd5a8e6536ef116e2ce0504cf97ebf16311d58065dc8a6" dependencies = [ "Inflector", "num-format", @@ -7974,6 +8096,34 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "static_init" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a2a1c578e98c1c16fc3b8ec1328f7659a500737d7a0c6d625e73e830ff9c1f6" +dependencies = [ + "bitflags", + "cfg_aliases", + "libc", + "parking_lot 0.11.2", + "parking_lot_core 0.8.5", + "static_init_macro", + "winapi 0.3.9", +] + +[[package]] +name = "static_init_macro" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a2595fc3aa78f2d0e45dd425b22282dd863273761cc77780914b2cf3003acf" +dependencies = [ + "cfg_aliases", + "memchr", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "statrs" version = "0.15.0" @@ -8072,7 +8222,7 @@ dependencies = [ "bitvec", "blake2-rfc", "bytesize", - "clap", + "clap 4.0.22", "criterion", "derive_more", "dirs", @@ -8084,7 +8234,7 @@ dependencies = [ "jemallocator", "jsonrpsee", "libc", - "lru", + "lru 0.7.8", "memmap2", "num-traits", "parity-db", @@ -8139,6 +8289,7 @@ dependencies = [ "sp-trie", "substrate-test-utils", "system-runtime-primitives", + "tempfile", "tokio", "tracing", ] @@ -8151,13 +8302,13 @@ dependencies = [ "async-trait", "bytes", "chrono", - "clap", + "clap 4.0.22", "derive_more", "event-listener-primitives", "futures 0.3.21", "hex", "libp2p", - "lru", + "lru 0.7.8", "nohash-hasher", "parity-db", "parity-scale-codec", @@ -8178,7 +8329,7 @@ dependencies = [ name = "subspace-node" version = "0.1.0" dependencies = [ - "clap", + "clap 4.0.22", "dirs", "domain-service", "frame-benchmarking-cli", @@ -8302,6 +8453,7 @@ dependencies = [ "parity-scale-codec", "parity-util-mem", "sc-basic-authorship", + "sc-chain-spec", "sc-client-api", "sc-consensus", "sc-consensus-fraud-proof", @@ -8313,6 +8465,7 @@ dependencies = [ "sc-piece-cache", "sc-rpc", "sc-rpc-api", + "sc-rpc-spec-v2", "sc-service", "sc-telemetry", "sc-tracing", @@ -8442,6 +8595,7 @@ dependencies = [ "sc-consensus-slots", "sc-executor", "sc-network", + "sc-network-common", "sc-service", "sc-tracing", "sp-arithmetic", @@ -8454,6 +8608,7 @@ dependencies = [ "subspace-test-runtime", "substrate-test-client", "substrate-test-utils", + "tempfile", "tokio", ] @@ -8493,7 +8648,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "platforms", ] @@ -8501,7 +8656,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "frame-system-rpc-runtime-api", "futures 0.3.21", @@ -8522,7 +8677,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures-util", "hyper", @@ -8535,11 +8690,11 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ + "array-bytes", "async-trait", "futures 0.3.21", - "hex", "parity-scale-codec", "sc-client-api", "sc-client-db", @@ -8638,7 +8793,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "futures 0.3.21", "substrate-test-utils-derive", @@ -8648,7 +8803,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8659,7 +8814,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/subspace/substrate?rev=1a7c28721fa77ecce9632ad9ce473f2d3cf1a598#1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" +source = "git+https://github.com/subspace/substrate?rev=66d3f73c5ef66c975fa5f54b6736ccd6821e395f#66d3f73c5ef66c975fa5f54b6736ccd6821e395f" dependencies = [ "ansi_term", "build-helper", @@ -8670,7 +8825,7 @@ dependencies = [ "tempfile", "toml", "walkdir", - "wasm-gc-api", + "wasm-opt", ] [[package]] @@ -8817,6 +8972,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "termtree" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95059e91184749cb66be6dc994f67f182b6d897cb3df74a5bf66b5e709295fd8" + [[package]] name = "textwrap" version = "0.15.0" @@ -9113,9 +9274,9 @@ dependencies = [ [[package]] name = "trie-db" -version = "0.23.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32d034c0d3db64b43c31de38e945f15b40cd4ca6d2dcfc26d4798ce8de4ab83" +checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", "hashbrown 0.12.3", @@ -9135,9 +9296,9 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" dependencies = [ "async-trait", "cfg-if", @@ -9149,32 +9310,32 @@ dependencies = [ "idna", "ipnet", "lazy_static", - "log", "rand 0.8.5", "smallvec", "thiserror", "tinyvec", "tokio", + "tracing", "url", ] [[package]] name = "trust-dns-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" dependencies = [ "cfg-if", "futures-util", "ipconfig", "lazy_static", - "log", "lru-cache", "parking_lot 0.12.1", "resolv-conf", "smallvec", "thiserror", "tokio", + "tracing", "trust-dns-proto", ] @@ -9466,23 +9627,53 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" [[package]] -name = "wasm-gc-api" -version = "0.1.11" +name = "wasm-instrument" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c32691b6c7e6c14e7f8fd55361a9088b507aa49620fcd06c09b3a1082186b9" +checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" dependencies = [ - "log", - "parity-wasm 0.32.0", - "rustc-demangle", + "parity-wasm", ] [[package]] -name = "wasm-instrument" -version = "0.1.1" +name = "wasm-opt" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68e8037b4daf711393f4be2056246d12d975651b14d581520ad5d1f19219cec" +dependencies = [ + "anyhow", + "libc", + "strum", + "strum_macros", + "tempfile", + "thiserror", + "wasm-opt-cxx-sys", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-cxx-sys" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91adbad477e97bba3fbd21dd7bfb594e7ad5ceb9169ab1c93ab9cb0ada636b6f" +dependencies = [ + "anyhow", + "cxx", + "cxx-build", + "wasm-opt-sys", +] + +[[package]] +name = "wasm-opt-sys" +version = "0.110.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962e5b0401bbb6c887f54e69b8c496ea36f704df65db73e81fd5ff8dc3e63a9f" +checksum = "ec4fa5a322a4e6ac22fd141f498d56afbdbf9df5debeac32380d2dcaa3e06941" dependencies = [ - "parity-wasm 0.42.2", + "anyhow", + "cc", + "cxx", + "cxx-build", + "regex", ] [[package]] @@ -9502,58 +9693,63 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "libc", - "libm", - "memory_units", - "num-rational 0.2.4", - "num-traits", - "parity-wasm 0.42.2", + "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +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 = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" dependencies = [ - "parity-wasm 0.42.2", + "downcast-rs", + "libm", + "memory_units", + "num-rational", + "num-traits", ] [[package]] name = "wasmparser" -version = "0.85.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570460c58b21e9150d2df0eaaedbb7816c34bcec009ae0dcc976e40ba81463e7" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" dependencies = [ "indexmap", ] [[package]] name = "wasmtime" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e76e2b2833bb0ece666ccdbed7b71b617d447da11f1bb61f4f2bab2648f745ee" +checksum = "f1f511c4917c83d04da68333921107db75747c4e11a2f654a8e909cc5e0520dc" dependencies = [ "anyhow", - "backtrace", "bincode", "cfg-if", "indexmap", - "lazy_static", "libc", "log", - "object 0.28.4", + "object", "once_cell", "paste", "psm", "rayon", - "region", "serde", "target-lexicon", "wasmparser", @@ -9562,14 +9758,23 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "winapi 0.3.9", + "windows-sys 0.36.1", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39bf3debfe744bf19dd3732990ce6f8c0ced7439e2370ba4e1d8f5a3660a3178" +dependencies = [ + "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "743a9f142d93318262d7e1fe329394ff2e8f86a1df45ae5e4f0eedba215ca5ce" +checksum = "ece42fa4676a263f7558cdaaf5a71c2592bebcbac22a0580e33cf3406c103da2" dependencies = [ "anyhow", "base64", @@ -9577,19 +9782,19 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix 0.33.7", + "rustix", "serde", "sha2 0.9.9", "toml", - "winapi 0.3.9", + "windows-sys 0.36.1", "zstd", ] [[package]] name = "wasmtime-cranelift" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dc0f80afa1ce97083a7168e6b6948d015d6237369e9f4a511d38c9c4ac8fbb9" +checksum = "058217e28644b012bdcdf0e445f58d496d78c2e0b6a6dd93558e701591dad705" dependencies = [ "anyhow", "cranelift-codegen", @@ -9599,8 +9804,7 @@ dependencies = [ "cranelift-wasm", "gimli", "log", - "more-asserts", - "object 0.28.4", + "object", "target-lexicon", "thiserror", "wasmparser", @@ -9609,17 +9813,16 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0816d9365196f1f447060087e0f87239ccded830bd54970a1168b0c9c8e824c9" +checksum = "c7af06848df28b7661471d9a80d30a973e0f401f2e3ed5396ad7e225ed217047" dependencies = [ "anyhow", "cranelift-entity", "gimli", "indexmap", "log", - "more-asserts", - "object 0.28.4", + "object", "serde", "target-lexicon", "thiserror", @@ -9629,9 +9832,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c687f33cfa0f89ec1646929d0ff102087052cf9f0d15533de56526b0da0d1b3" +checksum = "9028fb63a54185b3c192b7500ef8039c7bb8d7f62bfc9e7c258483a33a3d13bb" dependencies = [ "addr2line", "anyhow", @@ -9640,38 +9843,36 @@ dependencies = [ "cpp_demangle", "gimli", "log", - "object 0.28.4", - "region", + "object", "rustc-demangle", - "rustix 0.33.7", + "rustix", "serde", "target-lexicon", "thiserror", "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-runtime", - "winapi 0.3.9", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-jit-debug" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b252d1d025f94f3954ba2111f12f3a22826a0764a11c150c2d46623115a69e27" +checksum = "25e82d4ef93296785de7efca92f7679dc67fe68a13b625a5ecc8d7503b377a37" dependencies = [ - "lazy_static", - "object 0.28.4", - "rustix 0.33.7", + "object", + "once_cell", + "rustix", ] [[package]] name = "wasmtime-runtime" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace251693103c9facbbd7df87a29a75e68016e48bc83c09133f2fda6b575e0ab" +checksum = "9f0e9bea7d517d114fe66b930b2124ee086516ee93eeebfd97f75f366c5b0553" dependencies = [ "anyhow", - "backtrace", "cc", "cfg-if", "indexmap", @@ -9680,21 +9881,21 @@ dependencies = [ "mach", "memfd", "memoffset", - "more-asserts", + "paste", "rand 0.8.5", - "region", - "rustix 0.33.7", + "rustix", "thiserror", + "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "winapi 0.3.9", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-types" -version = "0.38.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d129b0487a95986692af8708ffde9c50b0568dcefd79200941d475713b4f40bb" +checksum = "69b83e93ed41b8fdc936244cfd5e455480cf1eca1fd60c78a0040038b4ce5075" dependencies = [ "cranelift-entity", "serde", @@ -9826,6 +10027,27 @@ dependencies = [ "windows_x86_64_msvc 0.36.1", ] +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.34.0" @@ -9838,6 +10060,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.34.0" @@ -9850,6 +10078,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.34.0" @@ -9862,6 +10096,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.34.0" @@ -9874,6 +10114,18 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.34.0" @@ -9886,6 +10138,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winreg" version = "0.7.0" diff --git a/Cargo.toml b/Cargo.toml index 5f4aacfdde6..12b9e727892 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,4 +82,3 @@ codegen-units = 1 [patch.crates-io] # TODO: Remove once chacha20poly1305 0.10 appears in libp2p's dependencies chacha20poly1305 = { git = "https://github.com/RustCrypto/AEADs", rev = "06dbfb5571687fd1bbe9d3c9b2193a1ba17f8e99" } -libp2p = { git = "https://github.com/subspace/rust-libp2p", branch = "subspace-v3" } diff --git a/crates/pallet-domains/Cargo.toml b/crates/pallet-domains/Cargo.toml index 1cca5a08fa5..12420fbd1de 100644 --- a/crates/pallet-domains/Cargo.toml +++ b/crates/pallet-domains/Cargo.toml @@ -13,18 +13,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", default-features = false, path = "../sp-domains" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [dev-dependencies] -sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/crates/pallet-domains/src/lib.rs b/crates/pallet-domains/src/lib.rs index a9ff95ca0f7..43f2e8f5f6c 100644 --- a/crates/pallet-domains/src/lib.rs +++ b/crates/pallet-domains/src/lib.rs @@ -58,7 +58,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Secondary chain block hash type. type SecondaryHash: Parameter diff --git a/crates/pallet-domains/src/tests.rs b/crates/pallet-domains/src/tests.rs index 7e9225d3fd0..36ca732ae4f 100644 --- a/crates/pallet-domains/src/tests.rs +++ b/crates/pallet-domains/src/tests.rs @@ -35,8 +35,8 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = BlockNumber; type Hash = Hash; @@ -44,7 +44,7 @@ impl frame_system::Config for Test { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<2>; type Version = (); type PalletInfo = PalletInfo; @@ -64,7 +64,7 @@ parameter_types! { } impl pallet_domains::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SecondaryHash = H256; type ReceiptsPruningDepth = ReceiptsPruningDepth; type MaximumReceiptDrift = MaximumReceiptDrift; @@ -182,7 +182,7 @@ fn submit_execution_receipt_incrementally_should_work() { } )); assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[index].clone(), )); @@ -191,7 +191,7 @@ fn submit_execution_receipt_incrementally_should_work() { assert!(Receipts::::get(receipt_hash(257)).is_none()); assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[256].clone(), )); // The oldest ER should be deleted. @@ -210,7 +210,7 @@ fn submit_execution_receipt_incrementally_should_work() { ); assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[257].clone(), )); assert!(Receipts::::get(receipt_hash(2)).is_none()); @@ -251,7 +251,7 @@ fn submit_execution_receipt_with_huge_gap_should_work() { assert!(!frame_system::BlockHash::::contains_key(255)); (0..255).for_each(|index| { assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[index].clone(), )); }); @@ -259,21 +259,21 @@ fn submit_execution_receipt_with_huge_gap_should_work() { // Reaching the receipts pruning depth, block hash mapping will be pruned as well. assert!(BlockHash::::contains_key(0)); assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[255].clone(), )); assert!(!BlockHash::::contains_key(0)); assert!(BlockHash::::contains_key(1)); assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[256].clone(), )); assert!(!BlockHash::::contains_key(1)); assert!(BlockHash::::contains_key(2)); assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[257].clone(), )); assert!(!BlockHash::::contains_key(2)); @@ -326,22 +326,22 @@ fn submit_bundle_with_many_reeipts_should_work() { // in System has been removed. assert!(!frame_system::BlockHash::::contains_key(1)); assert!(!frame_system::BlockHash::::contains_key(255)); - assert_ok!(Domains::submit_bundle(Origin::none(), bundle1)); + assert_ok!(Domains::submit_bundle(RuntimeOrigin::none(), bundle1)); assert_eq!(Domains::best_execution_chain_number(), 255); // Reaching the receipts pruning depth, block hash mapping will be pruned as well. assert!(BlockHash::::contains_key(0)); - assert_ok!(Domains::submit_bundle(Origin::none(), bundle2)); + assert_ok!(Domains::submit_bundle(RuntimeOrigin::none(), bundle2)); assert!(!BlockHash::::contains_key(0)); assert_eq!(OldestReceiptNumber::::get(), 1); assert!(BlockHash::::contains_key(1)); - assert_ok!(Domains::submit_bundle(Origin::none(), bundle3)); + assert_ok!(Domains::submit_bundle(RuntimeOrigin::none(), bundle3)); assert!(!BlockHash::::contains_key(1)); assert_eq!(OldestReceiptNumber::::get(), 2); assert!(BlockHash::::contains_key(2)); - assert_ok!(Domains::submit_bundle(Origin::none(), bundle4)); + assert_ok!(Domains::submit_bundle(RuntimeOrigin::none(), bundle4)); assert!(!BlockHash::::contains_key(2)); assert_eq!(OldestReceiptNumber::::get(), 3); assert_eq!(Domains::finalized_receipt_number(), 2); @@ -374,7 +374,7 @@ fn submit_fraud_proof_should_work() { BlockHash::::insert((index + 1) as u64, block_hash); assert_ok!(Domains::submit_bundle( - Origin::none(), + RuntimeOrigin::none(), dummy_bundles[index].clone(), )); @@ -385,7 +385,10 @@ fn submit_fraud_proof_should_work() { assert_eq!(votes.next(), None); }); - assert_ok!(Domains::submit_fraud_proof(Origin::none(), dummy_proof)); + assert_ok!(Domains::submit_fraud_proof( + RuntimeOrigin::none(), + dummy_proof + )); assert_eq!(Domains::best_execution_chain_number(), 99); let receipt_hash = dummy_bundles[98].clone().bundle.receipts[0].hash(); assert!(Receipts::::get(receipt_hash).is_some()); diff --git a/crates/pallet-feeds/Cargo.toml b/crates/pallet-feeds/Cargo.toml index 9d785144751..27230cc3d38 100644 --- a/crates/pallet-feeds/Cargo.toml +++ b/crates/pallet-feeds/Cargo.toml @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" } [dev-dependencies] serde = "1.0.143" -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/crates/pallet-feeds/src/lib.rs b/crates/pallet-feeds/src/lib.rs index fa579c051da..a704612a7cd 100644 --- a/crates/pallet-feeds/src/lib.rs +++ b/crates/pallet-feeds/src/lib.rs @@ -43,7 +43,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// `pallet-feeds` events - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; // Feed ID uniquely identifies a Feed type FeedId: Parameter + Member + Default + Copy + PartialOrd + CheckedAdd + One; diff --git a/crates/pallet-feeds/src/mock.rs b/crates/pallet-feeds/src/mock.rs index f8047c49fb3..4200935ef47 100644 --- a/crates/pallet-feeds/src/mock.rs +++ b/crates/pallet-feeds/src/mock.rs @@ -28,8 +28,8 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -37,7 +37,7 @@ impl frame_system::Config for Test { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); type PalletInfo = PalletInfo; @@ -69,7 +69,7 @@ impl Default for MockFeedProcessorKind { } impl pallet_feeds::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type FeedId = FeedId; type FeedProcessorKind = MockFeedProcessorKind; type MaxFeeds = MaxFeeds; diff --git a/crates/pallet-feeds/src/tests.rs b/crates/pallet-feeds/src/tests.rs index f2670843ae8..fd3d8344901 100644 --- a/crates/pallet-feeds/src/tests.rs +++ b/crates/pallet-feeds/src/tests.rs @@ -1,5 +1,6 @@ use crate::mock::{ - new_test_ext, ContentEnum, Event, Feeds, MockFeedProcessorKind, Origin, System, Test, + new_test_ext, ContentEnum, Feeds, MockFeedProcessorKind, RuntimeEvent, RuntimeOrigin, System, + Test, }; use crate::{Call as FeedsCall, Error, Object, SuccessfulPuts, TotalObjectsAndSize}; use codec::{Decode, Encode}; @@ -16,14 +17,14 @@ const NOT_OWNER: u64 = 101; fn create_feed() { new_test_ext().execute_with(|| { assert_ok!(Feeds::create( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), Default::default(), None )); assert_eq!(Feeds::totals(0), TotalObjectsAndSize::default()); - System::assert_last_event(Event::Feeds(crate::Event::::FeedCreated { + System::assert_last_event(RuntimeEvent::Feeds(crate::Event::::FeedCreated { feed_id: FEED_ID, who: OWNER, })); @@ -39,12 +40,16 @@ fn can_do_put() { let object_size = object.len() as u64; // create feed before putting any data assert_ok!(Feeds::create( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), Default::default(), None )); - assert_ok!(Feeds::put(Origin::signed(OWNER), FEED_ID, object.clone())); + assert_ok!(Feeds::put( + RuntimeOrigin::signed(OWNER), + FEED_ID, + object.clone() + )); // check Metadata hashmap for updated metadata assert_eq!(Feeds::metadata(FEED_ID), Some(vec![])); @@ -70,7 +75,7 @@ fn can_do_put() { ) ); - System::assert_last_event(Event::Feeds(crate::Event::::ObjectSubmitted { + System::assert_last_event(RuntimeEvent::Feeds(crate::Event::::ObjectSubmitted { feed_id: FEED_ID, who: OWNER, metadata: vec![], @@ -79,7 +84,7 @@ fn can_do_put() { // only owner can put assert_noop!( - Feeds::put(Origin::signed(NOT_OWNER), FEED_ID, object), + Feeds::put(RuntimeOrigin::signed(NOT_OWNER), FEED_ID, object), Error::::NotFeedOwner ); }); @@ -90,7 +95,7 @@ fn cannot_do_put_without_creating_feed() { new_test_ext().execute_with(|| { let object: Object = vec![1, 2, 3, 4, 5]; assert_noop!( - Feeds::put(Origin::signed(OWNER), FEED_ID, object), + Feeds::put(RuntimeOrigin::signed(OWNER), FEED_ID, object), Error::::UnknownFeedId ); @@ -104,29 +109,33 @@ fn can_close_open_feed() { let object: Object = vec![1, 2, 3, 4, 5]; // create feed before putting any data assert_ok!(Feeds::create( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), Default::default(), None )); - assert_ok!(Feeds::put(Origin::signed(OWNER), FEED_ID, object.clone())); + assert_ok!(Feeds::put( + RuntimeOrigin::signed(OWNER), + FEED_ID, + object.clone() + )); // only owner can close assert_noop!( - Feeds::close(Origin::signed(NOT_OWNER), FEED_ID), + Feeds::close(RuntimeOrigin::signed(NOT_OWNER), FEED_ID), Error::::NotFeedOwner ); - assert_ok!(Feeds::close(Origin::signed(OWNER), FEED_ID)); + assert_ok!(Feeds::close(RuntimeOrigin::signed(OWNER), FEED_ID)); - System::assert_last_event(Event::Feeds(crate::Event::::FeedClosed { + System::assert_last_event(RuntimeEvent::Feeds(crate::Event::::FeedClosed { feed_id: FEED_ID, who: OWNER, })); // cannot put a closed feed assert_noop!( - Feeds::put(Origin::signed(OWNER), FEED_ID, object), + Feeds::put(RuntimeOrigin::signed(OWNER), FEED_ID, object), Error::::FeedClosed ); }); @@ -137,7 +146,7 @@ fn cannot_close_invalid_feed() { new_test_ext().execute_with(|| { let feed_id = 10; // invalid assert_noop!( - Feeds::close(Origin::signed(OWNER), feed_id), + Feeds::close(RuntimeOrigin::signed(OWNER), feed_id), Error::::UnknownFeedId ); }); @@ -147,23 +156,28 @@ fn cannot_close_invalid_feed() { fn can_update_existing_feed() { new_test_ext().execute_with(|| { assert_ok!(Feeds::create( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), Default::default(), None )); // only owner can update assert_noop!( - Feeds::update(Origin::signed(NOT_OWNER), FEED_ID, Default::default(), None), + Feeds::update( + RuntimeOrigin::signed(NOT_OWNER), + FEED_ID, + Default::default(), + None + ), Error::::NotFeedOwner ); assert_ok!(Feeds::update( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), FEED_ID, Default::default(), None )); - System::assert_last_event(Event::Feeds(crate::Event::::FeedUpdated { + System::assert_last_event(RuntimeEvent::Feeds(crate::Event::::FeedUpdated { feed_id: FEED_ID, who: OWNER, })); @@ -174,7 +188,12 @@ fn can_update_existing_feed() { fn cannot_update_unknown_feed() { new_test_ext().execute_with(|| { assert_noop!( - Feeds::update(Origin::signed(OWNER), FEED_ID, Default::default(), None), + Feeds::update( + RuntimeOrigin::signed(OWNER), + FEED_ID, + Default::default(), + None + ), Error::::UnknownFeedId ); }); @@ -184,7 +203,7 @@ fn cannot_update_unknown_feed() { fn transfer_feed_ownership() { new_test_ext().execute_with(|| { assert_ok!(Feeds::create( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), Default::default(), None )); @@ -193,10 +212,14 @@ fn transfer_feed_ownership() { let new_owner = 102u64; // only owner can transfer assert_noop!( - Feeds::transfer(Origin::signed(NOT_OWNER), FEED_ID, new_owner), + Feeds::transfer(RuntimeOrigin::signed(NOT_OWNER), FEED_ID, new_owner), Error::::NotFeedOwner ); - assert_ok!(Feeds::transfer(Origin::signed(OWNER), FEED_ID, new_owner)); + assert_ok!(Feeds::transfer( + RuntimeOrigin::signed(OWNER), + FEED_ID, + new_owner + )); assert_eq!(Feeds::feeds(OWNER), None); assert_eq!(Feeds::feeds(new_owner).unwrap().to_vec(), vec![FEED_ID]); }); @@ -206,7 +229,7 @@ fn transfer_feed_ownership() { fn cannot_create_after_max_feeds() { new_test_ext().execute_with(|| { assert_ok!(Feeds::create( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), Default::default(), None )); @@ -214,7 +237,7 @@ fn cannot_create_after_max_feeds() { // mock limits one feed per user assert_noop!( - Feeds::create(Origin::signed(OWNER), Default::default(), None), + Feeds::create(RuntimeOrigin::signed(OWNER), Default::default(), None), Error::::MaxFeedsReached ); }); @@ -222,7 +245,7 @@ fn cannot_create_after_max_feeds() { fn create_content_feed(object: Object, kind: MockFeedProcessorKind, contents: Vec>) { new_test_ext().execute_with(|| { - assert_ok!(Feeds::create(Origin::signed(OWNER), kind, None)); + assert_ok!(Feeds::create(RuntimeOrigin::signed(OWNER), kind, None)); let call = FeedsCall::::put { feed_id: FEED_ID, @@ -250,7 +273,7 @@ fn create_custom_content_feed( ) { new_test_ext().execute_with(|| { assert_ok!(Feeds::create( - Origin::signed(OWNER), + RuntimeOrigin::signed(OWNER), feed_processor_kind, None )); diff --git a/crates/pallet-grandpa-finality-verifier/Cargo.toml b/crates/pallet-grandpa-finality-verifier/Cargo.toml index 450d1ba2d30..fbc6030d14a 100644 --- a/crates/pallet-grandpa-finality-verifier/Cargo.toml +++ b/crates/pallet-grandpa-finality-verifier/Cargo.toml @@ -19,18 +19,18 @@ serde = { version = "1.0.143", optional = true } # Substrate Dependencies -frame-support = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -frame-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-finality-grandpa = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-std = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-trie = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +frame-support = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +frame-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-finality-grandpa = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-std = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-trie = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } [dev-dependencies] ed25519-dalek = { version = "1.0", default-features = false, features = ["u64_backend"] } -sp-io = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-application-crypto = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-io = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-application-crypto = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/crates/pallet-grandpa-finality-verifier/src/tests/mock.rs b/crates/pallet-grandpa-finality-verifier/src/tests/mock.rs index aa429bd9ae8..078dc6540c7 100644 --- a/crates/pallet-grandpa-finality-verifier/src/tests/mock.rs +++ b/crates/pallet-grandpa-finality-verifier/src/tests/mock.rs @@ -24,22 +24,22 @@ construct_runtime! { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Config for TestRuntime { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; - type Call = Call; + type RuntimeCall = RuntimeCall; type BlockNumber = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = (); + type RuntimeEvent = (); type BlockHashCount = BlockHashCount; type Version = (); type PalletInfo = PalletInfo; diff --git a/crates/pallet-object-store/Cargo.toml b/crates/pallet-object-store/Cargo.toml index c49fd86d814..74c2eac2ed8 100644 --- a/crates/pallet-object-store/Cargo.toml +++ b/crates/pallet-object-store/Cargo.toml @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } hex = { version = "0.4.3", default-features = false, features = ["alloc"] } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" } [dev-dependencies] serde = "1.0.143" -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/crates/pallet-object-store/src/lib.rs b/crates/pallet-object-store/src/lib.rs index a9ac6e1a9a0..3ce569428b2 100644 --- a/crates/pallet-object-store/src/lib.rs +++ b/crates/pallet-object-store/src/lib.rs @@ -38,7 +38,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// `pallet-object-store` events - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; } /// Pallet object-store, used for storing arbitrary user-provided data combined into object-store. diff --git a/crates/pallet-object-store/src/mock.rs b/crates/pallet-object-store/src/mock.rs index adf79fb3aed..31537a5968d 100644 --- a/crates/pallet-object-store/src/mock.rs +++ b/crates/pallet-object-store/src/mock.rs @@ -23,8 +23,8 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -32,7 +32,7 @@ impl frame_system::Config for Test { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); type PalletInfo = PalletInfo; @@ -50,7 +50,7 @@ parameter_types! { } impl crate::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; } pub fn new_test_ext() -> sp_io::TestExternalities { diff --git a/crates/pallet-object-store/src/tests.rs b/crates/pallet-object-store/src/tests.rs index 1eec0141ac4..982226578dc 100644 --- a/crates/pallet-object-store/src/tests.rs +++ b/crates/pallet-object-store/src/tests.rs @@ -1,4 +1,4 @@ -use crate::mock::{new_test_ext, Event, ObjectStore, Origin, System, Test}; +use crate::mock::{new_test_ext, ObjectStore, RuntimeEvent, RuntimeOrigin, System, Test}; use frame_support::assert_ok; use subspace_core_primitives::crypto; @@ -11,12 +11,14 @@ fn can_do_put() { let object_id = crypto::blake2b_256_hash(&object); let object_size = object.len() as u32; - assert_ok!(ObjectStore::put(Origin::signed(ACCOUNT_ID), object)); + assert_ok!(ObjectStore::put(RuntimeOrigin::signed(ACCOUNT_ID), object)); - System::assert_last_event(Event::ObjectStore(crate::Event::::ObjectSubmitted { - who: ACCOUNT_ID, - object_id, - object_size, - })); + System::assert_last_event(RuntimeEvent::ObjectStore( + crate::Event::::ObjectSubmitted { + who: ACCOUNT_ID, + object_id, + object_size, + }, + )); }); } diff --git a/crates/pallet-offences-subspace/Cargo.toml b/crates/pallet-offences-subspace/Cargo.toml index 5ee39eb0e44..37a121df089 100644 --- a/crates/pallet-offences-subspace/Cargo.toml +++ b/crates/pallet-offences-subspace/Cargo.toml @@ -14,17 +14,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } sp-consensus-subspace = { version = "0.1.0", default-features = false, path = "../sp-consensus-subspace" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [dev-dependencies] -sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } schnorrkel = "0.9.1" [features] diff --git a/crates/pallet-offences-subspace/src/lib.rs b/crates/pallet-offences-subspace/src/lib.rs index 693fdc2db8b..0c910ad80b3 100644 --- a/crates/pallet-offences-subspace/src/lib.rs +++ b/crates/pallet-offences-subspace/src/lib.rs @@ -56,7 +56,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// The overarching event type. - type Event: From + IsType<::Event>; + type RuntimeEvent: From + IsType<::RuntimeEvent>; /// A handler called for every offence report. type OnOffenceHandler: OnOffenceHandler; } diff --git a/crates/pallet-offences-subspace/src/mock.rs b/crates/pallet-offences-subspace/src/mock.rs index 245893f5ce9..6a52ad2cce6 100644 --- a/crates/pallet-offences-subspace/src/mock.rs +++ b/crates/pallet-offences-subspace/src/mock.rs @@ -70,16 +70,16 @@ impl frame_system::Config for Runtime { type BlockWeights = (); type BlockLength = (); type DbWeight = RocksDbWeight; - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = u64; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); type PalletInfo = PalletInfo; @@ -93,7 +93,7 @@ impl frame_system::Config for Runtime { } impl Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnOffenceHandler = OnOffenceHandler; } diff --git a/crates/pallet-offences-subspace/src/tests.rs b/crates/pallet-offences-subspace/src/tests.rs index 62efa3be176..34c3d3ee6be 100644 --- a/crates/pallet-offences-subspace/src/tests.rs +++ b/crates/pallet-offences-subspace/src/tests.rs @@ -19,8 +19,8 @@ #![cfg(test)] use crate::mock::{ - new_test_ext, offence_reports, report_id, with_on_offence_fractions, Event, Offence, - OffencesSubspace, System, KIND, + new_test_ext, offence_reports, report_id, with_on_offence_fractions, Offence, OffencesSubspace, + RuntimeEvent, System, KIND, }; use codec::{Decode, Encode}; use frame_system::{EventRecord, Phase}; @@ -137,7 +137,7 @@ fn should_deposit_event() { System::events(), vec![EventRecord { phase: Phase::Initialization, - event: Event::OffencesSubspace(crate::Event::Offence { + event: RuntimeEvent::OffencesSubspace(crate::Event::Offence { kind: KIND, timeslot: time_slot.encode() }), @@ -177,7 +177,7 @@ fn doesnt_deposit_event_for_dups() { System::events(), vec![EventRecord { phase: Phase::Initialization, - event: Event::OffencesSubspace(crate::Event::Offence { + event: RuntimeEvent::OffencesSubspace(crate::Event::Offence { kind: KIND, timeslot: time_slot.encode() }), diff --git a/crates/pallet-rewards/Cargo.toml b/crates/pallet-rewards/Cargo.toml index db3b3232222..9a479eb8a62 100644 --- a/crates/pallet-rewards/Cargo.toml +++ b/crates/pallet-rewards/Cargo.toml @@ -19,10 +19,10 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-runtime-primitives = { version = "0.1.0", default-features = false, path = "../subspace-runtime-primitives" } [features] diff --git a/crates/pallet-rewards/src/default_weights.rs b/crates/pallet-rewards/src/default_weights.rs index 813e0306297..af96863360e 100644 --- a/crates/pallet-rewards/src/default_weights.rs +++ b/crates/pallet-rewards/src/default_weights.rs @@ -21,6 +21,6 @@ use frame_support::weights::Weight; impl crate::WeightInfo for () { fn on_initialize() -> Weight { // TODO: Correct value - 1 + Weight::from_ref_time(1) } } diff --git a/crates/pallet-rewards/src/lib.rs b/crates/pallet-rewards/src/lib.rs index 8ff9e990613..3f2a5b5b26b 100644 --- a/crates/pallet-rewards/src/lib.rs +++ b/crates/pallet-rewards/src/lib.rs @@ -49,7 +49,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// `pallet-rewards` events - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; type Currency: Currency; diff --git a/crates/pallet-runtime-configs/Cargo.toml b/crates/pallet-runtime-configs/Cargo.toml index ee081f2abfb..02bc4915bd6 100644 --- a/crates/pallet-runtime-configs/Cargo.toml +++ b/crates/pallet-runtime-configs/Cargo.toml @@ -17,8 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } [features] diff --git a/crates/pallet-subspace/Cargo.toml b/crates/pallet-subspace/Cargo.toml index 9cfa23c90ff..583d74a7361 100644 --- a/crates/pallet-subspace/Cargo.toml +++ b/crates/pallet-subspace/Cargo.toml @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } log = { version = "0.4.17", default-features = false } -pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] } serde = { version = "1.0.143", optional = true, default-features = false, features = ["derive"] } sp-consensus-subspace = { version = "0.1.0", default-features = false, path = "../sp-consensus-subspace" } -sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" } subspace-runtime-primitives = { version = "0.1.0", default-features = false, path = "../subspace-runtime-primitives" } subspace-solving = { version = "0.1.0", default-features = false, path = "../subspace-solving" } @@ -33,10 +33,10 @@ subspace-verification = { version = "0.1.0", path = "../subspace-verification", [dev-dependencies] env_logger = "0.9.0" -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-offences-subspace = { version = "0.1.0", path = "../pallet-offences-subspace" } rand = { version = "0.8.5", features = ["min_const_gen"] } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving" } [features] diff --git a/crates/pallet-subspace/src/default_weights.rs b/crates/pallet-subspace/src/default_weights.rs index 9bb0a3cd7cb..2eddbf6a21b 100644 --- a/crates/pallet-subspace/src/default_weights.rs +++ b/crates/pallet-subspace/src/default_weights.rs @@ -21,11 +21,11 @@ use frame_support::weights::Weight; impl crate::WeightInfo for () { fn report_equivocation() -> Weight { // TODO: Proper value - 10_000 + Weight::from_ref_time(10_000) } fn store_root_blocks(root_blocks_count: usize) -> Weight { // TODO: Proper value - 10_000 * (root_blocks_count as u64 + 1) + Weight::from_ref_time(10_000 * (root_blocks_count as u64 + 1)) } } diff --git a/crates/pallet-subspace/src/lib.rs b/crates/pallet-subspace/src/lib.rs index 61553a16937..fbcd280cc50 100644 --- a/crates/pallet-subspace/src/lib.rs +++ b/crates/pallet-subspace/src/lib.rs @@ -29,9 +29,9 @@ mod tests; use codec::{Decode, Encode, MaxEncodedLen}; use core::num::NonZeroU64; use equivocation::{HandleEquivocation, SubspaceEquivocationOffence}; -use frame_support::dispatch::{DispatchResult, DispatchResultWithPostInfo}; +use frame_support::dispatch::{DispatchResult, DispatchResultWithPostInfo, Pays}; use frame_support::traits::{Get, OnTimestampSet}; -use frame_support::weights::{Pays, Weight}; +use frame_support::weights::Weight; use frame_system::offchain::{SendTransactionTypes, SubmitTransaction}; use log::{debug, error, warn}; pub use pallet::*; @@ -173,7 +173,7 @@ mod pallet { #[pallet::disable_frame_system_supertrait_check] pub trait Config: pallet_timestamp::Config { /// The overarching event type. - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// The amount of time, in blocks, between updates of global randomness. #[pallet::constant] @@ -428,7 +428,7 @@ mod pallet { impl Hooks for Pallet { fn on_initialize(block_number: T::BlockNumber) -> Weight { Self::do_initialize(block_number); - 0 + Weight::zero() } fn on_finalize(block_number: T::BlockNumber) { diff --git a/crates/pallet-subspace/src/mock.rs b/crates/pallet-subspace/src/mock.rs index b8061f33e63..4f4c5ba5db1 100644 --- a/crates/pallet-subspace/src/mock.rs +++ b/crates/pallet-subspace/src/mock.rs @@ -21,6 +21,7 @@ use crate::{ self as pallet_subspace, Config, CurrentSlot, FarmerPublicKey, NormalEraChange, NormalGlobalRandomnessInterval, }; +use frame_support::pallet_prelude::Weight; use frame_support::parameter_types; use frame_support::traits::{ConstU128, ConstU32, ConstU64, GenesisBuild, OnInitialize}; use rand::Rng; @@ -66,7 +67,7 @@ frame_support::construct_runtime!( parameter_types! { pub const DisabledValidatorsThreshold: Perbill = Perbill::from_percent(16); pub BlockWeights: frame_system::limits::BlockWeights = - frame_system::limits::BlockWeights::simple_max(1024); + frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1024)); } impl frame_system::Config for Test { @@ -74,17 +75,17 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = u64; type BlockNumber = u64; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Version = (); type Hashing = sp_runtime::traits::BlakeTwo256; type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type PalletInfo = PalletInfo; type AccountData = pallet_balances::AccountData; @@ -98,10 +99,10 @@ impl frame_system::Config for Test { impl frame_system::offchain::SendTransactionTypes for Test where - Call: From, + RuntimeCall: From, { - type OverarchingCall = Call; - type Extrinsic = TestXt; + type OverarchingCall = RuntimeCall; + type Extrinsic = TestXt; } impl pallet_timestamp::Config for Test { @@ -117,14 +118,14 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = [u8; 8]; type Balance = u128; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ConstU128<1>; type AccountStore = System; type WeightInfo = (); } impl pallet_offences_subspace::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnOffenceHandler = Subspace; } @@ -150,7 +151,7 @@ parameter_types! { } impl Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type GlobalRandomnessUpdateInterval = GlobalRandomnessUpdateInterval; type EraDuration = EraDuration; type InitialSolutionRange = InitialSolutionRange; diff --git a/crates/pallet-subspace/src/tests.rs b/crates/pallet-subspace/src/tests.rs index 351c0ace871..12ce358a967 100644 --- a/crates/pallet-subspace/src/tests.rs +++ b/crates/pallet-subspace/src/tests.rs @@ -18,8 +18,8 @@ use crate::mock::{ create_archived_segment, create_root_block, create_signed_vote, generate_equivocation_proof, - go_to_block, new_test_ext, progress_to_block, Event, GlobalRandomnessUpdateInterval, Origin, - ReportLongevity, Subspace, System, Test, INITIAL_SOLUTION_RANGE, SLOT_PROBABILITY, + go_to_block, new_test_ext, progress_to_block, GlobalRandomnessUpdateInterval, ReportLongevity, + RuntimeEvent, RuntimeOrigin, Subspace, System, Test, INITIAL_SOLUTION_RANGE, SLOT_PROBABILITY, }; use crate::{ pallet, AllowAuthoringByAnyone, BlockList, Call, CheckVoteError, Config, @@ -27,7 +27,8 @@ use crate::{ ParentBlockVoters, RecordsRoot, SubspaceEquivocationOffence, WeightInfo, }; use codec::Encode; -use frame_support::weights::{GetDispatchInfo, Pays}; +use frame_support::dispatch::{GetDispatchInfo, Pays}; +use frame_support::weights::Weight; use frame_support::{assert_err, assert_ok}; use frame_system::{EventRecord, Phase}; use schnorrkel::Keypair; @@ -115,7 +116,7 @@ fn can_update_solution_range_on_era_change() { assert_eq!(Subspace::solution_ranges(), initial_solution_ranges); // enable solution range adjustment assert_ok!(Subspace::enable_solution_range_adjustment( - Origin::root(), + RuntimeOrigin::root(), None, None )); @@ -188,7 +189,7 @@ fn can_override_solution_range_update() { let random_solution_range = rand::random(); let random_voting_solution_range = random_solution_range + 5; assert_ok!(Subspace::enable_solution_range_adjustment( - Origin::root(), + RuntimeOrigin::root(), Some(random_solution_range), Some(random_voting_solution_range), )); @@ -300,7 +301,7 @@ fn report_equivocation_current_session_works() { assert!(!Subspace::is_in_block_list(&farmer_public_key)); // report the equivocation - Subspace::report_equivocation(Origin::none(), Box::new(equivocation_proof)).unwrap(); + Subspace::report_equivocation(RuntimeOrigin::none(), Box::new(equivocation_proof)).unwrap(); progress_to_block(&keypair, 2, 1); @@ -328,7 +329,7 @@ fn report_equivocation_old_session_works() { assert!(!Subspace::is_in_block_list(&farmer_public_key)); // report the equivocation - Subspace::report_equivocation(Origin::none(), Box::new(equivocation_proof)).unwrap(); + Subspace::report_equivocation(RuntimeOrigin::none(), Box::new(equivocation_proof)).unwrap(); progress_to_block(&keypair, 3, 1); @@ -346,7 +347,7 @@ fn report_equivocation_invalid_equivocation_proof() { let assert_invalid_equivocation = |equivocation_proof| { assert_err!( - Subspace::report_equivocation(Origin::none(), Box::new(equivocation_proof),), + Subspace::report_equivocation(RuntimeOrigin::none(), Box::new(equivocation_proof),), Error::::InvalidEquivocationProof, ) }; @@ -446,7 +447,7 @@ fn report_equivocation_validate_unsigned_prevents_duplicates() { assert_ok!(::pre_dispatch(&inner)); // Submit the report - Subspace::report_equivocation(Origin::none(), Box::new(equivocation_proof)).unwrap(); + Subspace::report_equivocation(RuntimeOrigin::none(), Box::new(equivocation_proof)).unwrap(); // The report should now be considered stale and the transaction is invalid. // The check for staleness should be done on both `validate_unsigned` and on `pre_dispatch` @@ -470,7 +471,7 @@ fn report_equivocation_has_valid_weight() { // the weight is always the same. assert!((1..=1000) .map(|_| { ::WeightInfo::report_equivocation() }) - .all(|w| w == 10_000)); + .all(|w| w == Weight::from_ref_time(10_000))); } #[test] @@ -490,13 +491,15 @@ fn valid_equivocation_reports_dont_pay_fees() { .get_dispatch_info(); // it should have non-zero weight and the fee has to be paid. - assert!(info.weight > 0); + assert!(info.weight.ref_time() > 0); assert_eq!(info.pays_fee, Pays::Yes); // report the equivocation. - let post_info = - Subspace::report_equivocation(Origin::none(), Box::new(equivocation_proof.clone())) - .unwrap(); + let post_info = Subspace::report_equivocation( + RuntimeOrigin::none(), + Box::new(equivocation_proof.clone()), + ) + .unwrap(); // the original weight should be kept, but given that the report // is valid the fee is waived. @@ -505,10 +508,11 @@ fn valid_equivocation_reports_dont_pay_fees() { // report the equivocation again which is invalid now since it is // duplicate. - let post_info = Subspace::report_equivocation(Origin::none(), Box::new(equivocation_proof)) - .err() - .unwrap() - .post_info; + let post_info = + Subspace::report_equivocation(RuntimeOrigin::none(), Box::new(equivocation_proof)) + .err() + .unwrap() + .post_info; // the fee is not waived and the original weight is kept. assert!(post_info.actual_weight.is_none()); @@ -531,12 +535,12 @@ fn store_root_block_works() { // Root blocks don't require fee assert_eq!(call.get_dispatch_info().pays_fee, Pays::No); - Subspace::store_root_blocks(Origin::none(), vec![root_block]).unwrap(); + Subspace::store_root_blocks(RuntimeOrigin::none(), vec![root_block]).unwrap(); assert_eq!( System::events(), vec![EventRecord { phase: Phase::Initialization, - event: Event::Subspace(crate::Event::RootBlockStored { root_block }), + event: RuntimeEvent::Subspace(crate::Event::RootBlockStored { root_block }), topics: vec![], }] ); @@ -584,7 +588,7 @@ fn store_root_block_validate_unsigned_prevents_duplicates() { assert_ok!(::pre_dispatch(&inner)); // Submit the report - Subspace::store_root_blocks(Origin::none(), vec![root_block]).unwrap(); + Subspace::store_root_blocks(RuntimeOrigin::none(), vec![root_block]).unwrap(); // The report should now be considered stale and the transaction is invalid. // The check for staleness should be done on both `validate_unsigned` and on `pre_dispatch` @@ -1235,7 +1239,7 @@ fn vote_equivocation_parent_block_plus_vote() { Subspace::pre_dispatch_vote(&signed_vote).unwrap(); assert_err!( - Subspace::vote(Origin::none(), Box::new(signed_vote)), + Subspace::vote(RuntimeOrigin::none(), Box::new(signed_vote)), DispatchError::Other("Equivocated"), ); @@ -1312,7 +1316,7 @@ fn vote_equivocation_current_voters_duplicate() { // Different vote for the same sector index and time slot leads to equivocation Subspace::pre_dispatch_vote(&signed_vote).unwrap(); assert_err!( - Subspace::vote(Origin::none(), Box::new(signed_vote)), + Subspace::vote(RuntimeOrigin::none(), Box::new(signed_vote)), DispatchError::Other("Equivocated"), ); @@ -1501,10 +1505,10 @@ fn allow_authoring_by_anyone_works() { // Unlock authoring by anyone assert_err!( - Subspace::enable_authoring_by_anyone(Origin::signed(1)), + Subspace::enable_authoring_by_anyone(RuntimeOrigin::signed(1)), DispatchError::BadOrigin ); - Subspace::enable_authoring_by_anyone(Origin::root()).unwrap(); + Subspace::enable_authoring_by_anyone(RuntimeOrigin::root()).unwrap(); // Both must be able to create blocks again progress_to_block( &keypair1, diff --git a/crates/pallet-transaction-fees/Cargo.toml b/crates/pallet-transaction-fees/Cargo.toml index 03f9f2a36cd..33b85a253a5 100644 --- a/crates/pallet-transaction-fees/Cargo.toml +++ b/crates/pallet-transaction-fees/Cargo.toml @@ -19,8 +19,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } subspace-runtime-primitives = { version = "0.1.0", default-features = false, path = "../subspace-runtime-primitives" } diff --git a/crates/pallet-transaction-fees/src/default_weights.rs b/crates/pallet-transaction-fees/src/default_weights.rs index 813e0306297..af96863360e 100644 --- a/crates/pallet-transaction-fees/src/default_weights.rs +++ b/crates/pallet-transaction-fees/src/default_weights.rs @@ -21,6 +21,6 @@ use frame_support::weights::Weight; impl crate::WeightInfo for () { fn on_initialize() -> Weight { // TODO: Correct value - 1 + Weight::from_ref_time(1) } } diff --git a/crates/pallet-transaction-fees/src/lib.rs b/crates/pallet-transaction-fees/src/lib.rs index d882f56747c..73610e91ceb 100644 --- a/crates/pallet-transaction-fees/src/lib.rs +++ b/crates/pallet-transaction-fees/src/lib.rs @@ -56,7 +56,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// `pallet-transaction-fees` events - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Minimum desired number of replicas of the blockchain to be stored by the network, /// impacts storage fees. diff --git a/crates/sc-consensus-fraud-proof/Cargo.toml b/crates/sc-consensus-fraud-proof/Cargo.toml index fa48dde95da..c1932e2bcf3 100644 --- a/crates/sc-consensus-fraud-proof/Cargo.toml +++ b/crates/sc-consensus-fraud-proof/Cargo.toml @@ -13,9 +13,9 @@ include = [ [dependencies] async-trait = "0.1.57" codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", path = "../sp-domains" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-fraud-proof = { version = "0.1.0", path = "../subspace-fraud-proof" } diff --git a/crates/sc-consensus-fraud-proof/src/lib.rs b/crates/sc-consensus-fraud-proof/src/lib.rs index 631880f4771..35166142153 100644 --- a/crates/sc-consensus-fraud-proof/src/lib.rs +++ b/crates/sc-consensus-fraud-proof/src/lib.rs @@ -18,7 +18,6 @@ use codec::{Decode, Encode}; use sc_consensus::block_import::{BlockCheckParams, BlockImport, BlockImportParams, ImportResult}; -use sc_consensus::StateAction; use sp_api::{ProvideRuntimeApi, TransactionFor}; use sp_consensus::{CacheKeyId, Error as ConsensusError}; use sp_domains::ExecutorApi; @@ -89,7 +88,7 @@ where let parent_hash = *block.header.parent_hash(); let parent_block_id = BlockId::Hash(parent_hash); - if !matches!(block.state_action, StateAction::Skip) { + if !block.state_action.skip_execution_checks() { if let Some(extrinsics) = &block.body { let fraud_proofs = self .client diff --git a/crates/sc-consensus-subspace-rpc/Cargo.toml b/crates/sc-consensus-subspace-rpc/Cargo.toml index adbee780743..5c060367060 100644 --- a/crates/sc-consensus-subspace-rpc/Cargo.toml +++ b/crates/sc-consensus-subspace-rpc/Cargo.toml @@ -20,17 +20,17 @@ jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } log = "0.4.17" parity-scale-codec = "3.1.5" parking_lot = "0.12.1" -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sc-consensus-subspace = { version = "0.1.0", path = "../sc-consensus-subspace" } sc-piece-cache = { version = "0.1.0", path = "../sc-piece-cache" } -sc-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-consensus-subspace = { version = "0.1.0", path = "../sp-consensus-subspace" } -sp-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving" } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" } subspace-rpc-primitives = { version = "0.1.0", path = "../subspace-rpc-primitives" } diff --git a/crates/sc-consensus-subspace/Cargo.toml b/crates/sc-consensus-subspace/Cargo.toml index 7f597e96468..c798ad32795 100644 --- a/crates/sc-consensus-subspace/Cargo.toml +++ b/crates/sc-consensus-subspace/Cargo.toml @@ -16,33 +16,33 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-trait = "0.1.57" codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] } -fork-tree = { version = "3.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +fork-tree = { version = "3.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" futures-timer = "3.0.2" log = "0.4.17" lru = "0.7.8" parking_lot = "0.12.1" -prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", version = "0.10.0-dev" } +prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", version = "0.10.0-dev" } rand = "0.8.5" schnorrkel = "0.9.1" -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } serde = { version = "1.0.143", features = ["derive"] } -sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-consensus-subspace = { version = "0.1.0", path = "../sp-consensus-subspace" } -sp-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-objects = { version = "0.1.0", path = "../sp-objects" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-version = { version = "5.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-version = { version = "5.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving" } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" } subspace-solving = { version = "0.1.0", path = "../subspace-solving" } @@ -50,12 +50,12 @@ subspace-verification = { version = "0.1.0", path = "../subspace-verification" } thiserror = "1.0.32" [dev-dependencies] -sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-cli = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-tracing = { version = "5.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-cli = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-tracing = { version = "5.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sc-network-test = { version = "0.8.0", path = "../../substrate/sc-network-test" } substrate-test-runtime = { version = "2.0.0", path = "../../substrate/substrate-test-runtime" } substrate-test-runtime-client = { version = "2.0.0", path = "../../substrate/substrate-test-runtime-client" } diff --git a/crates/sc-consensus-subspace/src/archiver.rs b/crates/sc-consensus-subspace/src/archiver.rs index 068bab57f86..b6cd2db4ed9 100644 --- a/crates/sc-consensus-subspace/src/archiver.rs +++ b/crates/sc-consensus-subspace/src/archiver.rs @@ -353,7 +353,7 @@ fn finalize_block( // Ideally some handle to a synchronization oracle would be used to avoid unconditionally // notifying. client - .apply_finality(import_op, BlockId::Hash(hash), None, true) + .apply_finality(import_op, hash, None, true) .map_err(|error| { warn!(target: "subspace", "Error applying finality to block {:?}: {}", (hash, number), error); error diff --git a/crates/sc-consensus-subspace/src/lib.rs b/crates/sc-consensus-subspace/src/lib.rs index 0f3793c1023..c8811aafbec 100644 --- a/crates/sc-consensus-subspace/src/lib.rs +++ b/crates/sc-consensus-subspace/src/lib.rs @@ -45,7 +45,7 @@ use sc_consensus::block_import::{ use sc_consensus::import_queue::{ BasicQueue, BoxJustificationImport, DefaultImportQueue, Verifier, }; -use sc_consensus::{JustificationSyncLink, StateAction}; +use sc_consensus::JustificationSyncLink; use sc_consensus_slots::{ check_equivocation, BackoffAuthoringBlocksStrategy, InherentDataProviderExt, SlotProportion, }; @@ -56,8 +56,8 @@ use sp_api::{ApiError, ApiExt, BlockT, HeaderT, NumberFor, ProvideRuntimeApi, Tr use sp_block_builder::BlockBuilder as BlockBuilderApi; use sp_blockchain::{Error as ClientError, HeaderBackend, HeaderMetadata, Result as ClientResult}; use sp_consensus::{ - BlockOrigin, CacheKeyId, CanAuthorWith, Environment, Error as ConsensusError, Proposer, - SelectChain, SyncOracle, + BlockOrigin, CacheKeyId, Environment, Error as ConsensusError, Proposer, SelectChain, + SyncOracle, }; use sp_consensus_slots::{Slot, SlotDuration}; use sp_consensus_subspace::digests::{ @@ -267,48 +267,32 @@ where } } -/// A slot duration. -/// -/// Create with [`Self::get`]. -#[derive(Clone)] -pub struct Config(SlotDuration); - -impl Config { - /// Fetch the config from the runtime. - pub fn get(client: &Client) -> ClientResult - where - Block: BlockT, - Client: AuxStore + ProvideRuntimeApi + UsageProvider, - Client::Api: SubspaceApi, - { - trace!(target: "subspace", "Getting slot duration"); - - let mut best_block_id = BlockId::Hash(client.usage_info().chain.best_hash); - if client.usage_info().chain.finalized_state.is_none() { - debug!( - target: "subspace", - "No finalized state is available. Reading config from genesis" - ); - best_block_id = BlockId::Hash(client.usage_info().chain.genesis_hash); - } - let slot_duration = client.runtime_api().slot_duration(&best_block_id)?; - - Ok(Self(SlotDuration::from_millis( - slot_duration - .as_millis() - .try_into() - .expect("Slot duration in ms never exceeds u64; qed"), - ))) - } +/// Read configuration from the runtime state at current best block. +pub fn slot_duration(client: &Client) -> ClientResult +where + Block: BlockT, + Client: AuxStore + ProvideRuntimeApi + UsageProvider, + Client::Api: SubspaceApi, +{ + let block_id = if client.usage_info().chain.finalized_state.is_some() { + BlockId::Hash(client.usage_info().chain.best_hash) + } else { + debug!(target: "subspace", "No finalized state is available. Reading config from genesis"); + BlockId::Hash(client.usage_info().chain.genesis_hash) + }; - /// Get the inner slot duration - pub fn slot_duration(&self) -> SlotDuration { - self.0 - } + Ok(SlotDuration::from_millis( + client + .runtime_api() + .slot_duration(&block_id)? + .as_millis() + .try_into() + .expect("Slot duration in ms never exceeds u64; qed"), + )) } /// Parameters for Subspace. -pub struct SubspaceParams { +pub struct SubspaceParams { /// The client to use pub client: Arc, @@ -341,9 +325,6 @@ pub struct SubspaceParams { /// The source of timestamps for relative slots pub subspace_link: SubspaceLink, - /// Checks if the current native implementation can author with a runtime at a given block. - pub can_author_with: CAW, - /// The proportion of the slot dedicated to proposing. /// /// The block proposing will be limited to this proportion of the slot from the starting of the @@ -360,7 +341,7 @@ pub struct SubspaceParams { } /// Start the Subspace worker. -pub fn start_subspace( +pub fn start_subspace( SubspaceParams { client, select_chain, @@ -372,11 +353,10 @@ pub fn start_subspace( force_authoring, backoff_authoring_blocks, subspace_link, - can_author_with, block_proposal_slot_portion, max_block_proposal_slot_portion, telemetry, - }: SubspaceParams, + }: SubspaceParams, ) -> Result where Block: BlockT, @@ -401,7 +381,6 @@ where CIDP: CreateInherentDataProviders + Send + Sync + 'static, CIDP::InherentDataProviders: InherentDataProviderExt + Send, BS: BackoffAuthoringBlocksStrategy> + Send + Sync + 'static, - CAW: CanAuthorWith + Send + Sync + 'static, Error: std::error::Error + Send + From + From + 'static, { let worker = SubspaceSlotWorker { @@ -421,7 +400,7 @@ where info!(target: "subspace", "🧑‍🌾 Starting Subspace Authorship worker"); let inner = sc_consensus_slots::start_slot_worker( - subspace_link.config.0, + subspace_link.slot_duration(), select_chain, sc_consensus_slots::SimpleSlotWorkerToSlotWorker(worker), SlotWorkerSyncOracle { @@ -429,7 +408,6 @@ where inner: sync_oracle, }, create_inherent_data_providers, - can_author_with, ); Ok(SubspaceWorker { @@ -457,7 +435,7 @@ impl Future for SubspaceWorker { /// State that must be shared between the import queue and the authoring logic. #[derive(Clone)] pub struct SubspaceLink { - config: Config, + slot_duration: SlotDuration, new_slot_notification_sender: SubspaceNotificationSender, new_slot_notification_stream: SubspaceNotificationStream, reward_signing_notification_sender: SubspaceNotificationSender, @@ -473,9 +451,9 @@ pub struct SubspaceLink { } impl SubspaceLink { - /// Get the config of this link. - pub fn config(&self) -> &Config { - &self.config + /// Get the slot duration from this link. + pub fn slot_duration(&self) -> SlotDuration { + self.slot_duration } /// Get stream with notifications about new slot arrival with ability to send solution back. @@ -643,7 +621,7 @@ where &pre_digest.solution.public_key, ) .or_else(|error| { - if matches!(block.state_action, StateAction::Skip) { + if block.state_action.skip_execution_checks() { Ok(false) } else { Err(Error::::RuntimeApi(error)) @@ -751,21 +729,19 @@ where /// it is missing. /// /// The epoch change tree should be pruned as blocks are finalized. -pub struct SubspaceBlockImport { +pub struct SubspaceBlockImport { inner: I, client: Arc, imported_block_notification_sender: SubspaceNotificationSender>, subspace_link: SubspaceLink, - can_author_with: CAW, create_inherent_data_providers: CIDP, } -impl Clone for SubspaceBlockImport +impl Clone for SubspaceBlockImport where Block: BlockT, I: Clone, - CAW: Clone, CIDP: Clone, { fn clone(&self) -> Self { @@ -774,18 +750,16 @@ where client: self.client.clone(), imported_block_notification_sender: self.imported_block_notification_sender.clone(), subspace_link: self.subspace_link.clone(), - can_author_with: self.can_author_with.clone(), create_inherent_data_providers: self.create_inherent_data_providers.clone(), } } } -impl SubspaceBlockImport +impl SubspaceBlockImport where Block: BlockT, Client: ProvideRuntimeApi + BlockBackend + HeaderBackend + AuxStore, Client::Api: BlockBuilderApi + SubspaceApi + ApiExt, - CAW: CanAuthorWith + Send + Sync + 'static, CIDP: CreateInherentDataProviders> + Send + Sync + 'static, { fn new( @@ -795,7 +769,6 @@ where ImportedBlockNotification, >, subspace_link: SubspaceLink, - can_author_with: CAW, create_inherent_data_providers: CIDP, ) -> Self { SubspaceBlockImport { @@ -803,7 +776,6 @@ where inner: block_import, imported_block_notification_sender, subspace_link, - can_author_with, create_inherent_data_providers, } } @@ -976,39 +948,31 @@ where // internally-set timestamp in the inherents actually matches the slot set in the seal // and root blocks in the inherents are set correctly. if let Some(extrinsics) = extrinsics { - if let Err(error) = self.can_author_with.can_author_with(&parent_block_id) { - debug!( - target: "subspace", - "Skipping `check_inherents` as authoring version is not compatible: {}", - error, - ); - } else { - let create_inherent_data_providers = self - .create_inherent_data_providers - .create_inherent_data_providers(parent_hash, self.subspace_link.clone()) - .await - .map_err(|error| Error::Client(sp_blockchain::Error::from(error)))?; - - let inherent_data = create_inherent_data_providers - .create_inherent_data() - .map_err(Error::CreateInherents)?; - - let inherent_res = self.client.runtime_api().check_inherents_with_context( - &parent_block_id, - origin.into(), - Block::new(header, extrinsics), - inherent_data, - )?; - - if !inherent_res.ok() { - for (i, e) in inherent_res.into_errors() { - match create_inherent_data_providers - .try_handle_error(&i, &e) - .await - { - Some(res) => res.map_err(Error::CheckInherents)?, - None => return Err(Error::CheckInherentsUnhandled(i)), - } + let create_inherent_data_providers = self + .create_inherent_data_providers + .create_inherent_data_providers(parent_hash, self.subspace_link.clone()) + .await + .map_err(|error| Error::Client(sp_blockchain::Error::from(error)))?; + + let inherent_data = create_inherent_data_providers + .create_inherent_data() + .map_err(Error::CreateInherents)?; + + let inherent_res = self.client.runtime_api().check_inherents_with_context( + &parent_block_id, + origin.into(), + Block::new(header, extrinsics), + inherent_data, + )?; + + if !inherent_res.ok() { + for (i, e) in inherent_res.into_errors() { + match create_inherent_data_providers + .try_handle_error(&i, &e) + .await + { + Some(res) => res.map_err(Error::CheckInherents)?, + None => return Err(Error::CheckInherentsUnhandled(i)), } } } @@ -1020,8 +984,8 @@ where } #[async_trait::async_trait] -impl BlockImport - for SubspaceBlockImport +impl BlockImport + for SubspaceBlockImport where Block: BlockT, Inner: BlockImport, Error = ConsensusError> @@ -1035,7 +999,6 @@ where + Send + Sync, Client::Api: BlockBuilderApi + SubspaceApi + ApiExt, - CAW: CanAuthorWith + Send + Sync + 'static, CIDP: CreateInherentDataProviders> + Send + Sync + 'static, { type Error = ConsensusError; @@ -1065,7 +1028,7 @@ where let subspace_digest_items = extract_subspace_digest_items(&block.header) .map_err(|error| ConsensusError::ClientImport(error.to_string()))?; - let skip_state_computation = matches!(block.state_action, StateAction::Skip); + let skip_execution_checks = block.state_action.skip_execution_checks(); let root_plot_public_key = self .client @@ -1081,7 +1044,7 @@ where block.body.clone(), &root_plot_public_key, &subspace_digest_items, - skip_state_computation, + skip_execution_checks, ) .await .map_err(|error| ConsensusError::ClientImport(error.to_string()))?; @@ -1255,21 +1218,19 @@ where /// /// Also returns a link object used to correctly instantiate the import queue and background worker. #[allow(clippy::type_complexity)] -pub fn block_import( - config: Config, +pub fn block_import( + slot_duration: SlotDuration, wrapped_block_import: I, client: Arc, - can_author_with: CAW, create_inherent_data_providers: CIDP, ) -> ClientResult<( - SubspaceBlockImport, + SubspaceBlockImport, SubspaceLink, )> where Block: BlockT, Client: ProvideRuntimeApi + BlockBackend + HeaderBackend + AuxStore, Client::Api: BlockBuilderApi + SubspaceApi, - CAW: CanAuthorWith + Send + Sync + 'static, CIDP: CreateInherentDataProviders> + Send + Sync + 'static, { let (new_slot_notification_sender, new_slot_notification_stream) = @@ -1289,7 +1250,7 @@ where let kzg = Kzg::new(kzg::test_public_parameters()); let link = SubspaceLink { - config, + slot_duration, new_slot_notification_sender, new_slot_notification_stream, reward_signing_notification_sender, @@ -1306,7 +1267,6 @@ where wrapped_block_import, imported_block_notification_sender, link.clone(), - can_author_with, create_inherent_data_providers, ); diff --git a/crates/sc-consensus-subspace/src/slot_worker.rs b/crates/sc-consensus-subspace/src/slot_worker.rs index 5df9051b1ba..2580a8640ef 100644 --- a/crates/sc-consensus-subspace/src/slot_worker.rs +++ b/crates/sc-consensus-subspace/src/slot_worker.rs @@ -114,7 +114,7 @@ where Pin> + Send + 'static>>; type Proposer = E::Proposer; type Claim = PreDigest; - type EpochData = (); + type AuxData = (); fn logging_target(&self) -> &'static str { "subspace" @@ -124,15 +124,15 @@ where &mut self.block_import } - fn epoch_data( + fn aux_data( &self, _parent: &Block::Header, _slot: Slot, - ) -> Result { + ) -> Result { Ok(()) } - fn authorities_len(&self, _epoch_data: &Self::EpochData) -> Option { + fn authorities_len(&self, _epoch_data: &Self::AuxData) -> Option { // This function is used in `sc-consensus-slots` in order to determine whether it is // possible to skip block production under certain circumstances, returning `None` or any // number smaller or equal to `1` disables that functionality and we don't want that. @@ -143,7 +143,7 @@ where &self, parent_header: &Block::Header, slot: Slot, - _epoch_data: &Self::EpochData, + _epoch_data: &Self::AuxData, ) -> Option { debug!(target: "subspace", "Attempting to claim slot {}", slot); @@ -302,7 +302,7 @@ where body: Vec, storage_changes: sc_consensus_slots::StorageChanges, pre_digest: Self::Claim, - _epoch_data: Self::EpochData, + _epoch_data: Self::AuxData, ) -> Result, ConsensusError> { let signature = self .sign_reward( diff --git a/crates/sc-consensus-subspace/src/tests.rs b/crates/sc-consensus-subspace/src/tests.rs index 1211cd5fb3f..365a9bb7927 100644 --- a/crates/sc-consensus-subspace/src/tests.rs +++ b/crates/sc-consensus-subspace/src/tests.rs @@ -21,8 +21,8 @@ #![allow(unused_imports, unused_variables, unused_mut)] use crate::{ - extract_pre_digest, start_subspace, Config, NewSlotNotification, SubspaceLink, SubspaceParams, - SubspaceVerifier, + extract_pre_digest, slot_duration, start_subspace, NewSlotNotification, SubspaceLink, + SubspaceParams, SubspaceVerifier, }; use codec::Encode; use futures::channel::oneshot; @@ -48,8 +48,8 @@ use sc_service::TaskManager; use schnorrkel::Keypair; use sp_api::HeaderT; use sp_consensus::{ - AlwaysCanAuthor, BlockOrigin, CacheKeyId, DisableProofRecording, Environment, - NoNetwork as DummyOracle, Proposal, Proposer, + BlockOrigin, CacheKeyId, DisableProofRecording, Environment, NoNetwork as DummyOracle, + Proposal, Proposer, }; use sp_consensus_slots::{Slot, SlotDuration}; use sp_consensus_subspace::digests::{CompatibleDigestItem, PreDigest}; @@ -59,7 +59,7 @@ use sp_core::crypto::UncheckedFrom; use sp_inherents::{CreateInherentDataProviders, InherentData}; use sp_runtime::generic::{BlockId, Digest, DigestItem}; use sp_runtime::traits::{Block as BlockT, Zero}; -use sp_timestamp::InherentDataProvider as TimestampInherentDataProvider; +use sp_timestamp::Timestamp; use std::cell::RefCell; use std::collections::HashMap; use std::future::Future; @@ -100,7 +100,7 @@ pub struct TestCreateInherentDataProviders { dyn CreateInherentDataProviders< TestBlock, SubspaceLink, - InherentDataProviders = (TimestampInherentDataProvider, InherentDataProvider), + InherentDataProviders = (InherentDataProvider,), >, >, } @@ -109,7 +109,7 @@ pub struct TestCreateInherentDataProviders { impl CreateInherentDataProviders> for TestCreateInherentDataProviders { - type InherentDataProviders = (TimestampInherentDataProvider, InherentDataProvider); + type InherentDataProviders = (InherentDataProvider,); async fn create_inherent_data_providers( &self, @@ -127,7 +127,6 @@ type SubspaceBlockImport = PanickingBlockImport< TestBlock, TestClient, Arc, - AlwaysCanAuthor, TestCreateInherentDataProviders, >, >; @@ -337,22 +336,20 @@ impl TestNetFactory for SubspaceTestNet { ) { let client = client.as_client(); - let config = Config::get(&*client).expect("config available"); + let slot_duration = slot_duration(&*client).expect("slot duration available"); let (block_import, link) = crate::block_import( - config, + slot_duration, client.clone(), client, - AlwaysCanAuthor, TestCreateInherentDataProviders { inner: Arc::new(|_, _| async { - let timestamp = TimestampInherentDataProvider::from_system_time(); let slot = InherentDataProvider::from_timestamp_and_slot_duration( - *timestamp, + Timestamp::current(), SlotDuration::from_millis(6000), vec![], ); - Ok((timestamp, slot)) + Ok((slot,)) }), }, ) @@ -388,9 +385,7 @@ impl TestNetFactory for SubspaceTestNet { client, select_chain: longest_chain, slot_now: Box::new(|| { - let timestamp = TimestampInherentDataProvider::from_system_time(); - - Slot::from_timestamp(*timestamp, SlotDuration::from_millis(6000)) + Slot::from_timestamp(Timestamp::current(), SlotDuration::from_millis(6000)) }), telemetry: None, reward_signing_context: schnorrkel::context::signing_context( @@ -530,19 +525,17 @@ fn run_one_test(mutator: impl Fn(&mut TestHeader, Stage) + Send + Sync + 'static env: environ, sync_oracle: DummyOracle, create_inherent_data_providers: Box::new(|_, _| async { - let timestamp = TimestampInherentDataProvider::from_system_time(); let slot = InherentDataProvider::from_timestamp_and_slot_duration( - *timestamp, + Timestamp::current(), SlotDuration::from_millis(6000), vec![], ); - Ok((timestamp, slot)) + Ok((slot,)) }), force_authoring: false, backoff_authoring_blocks: Some(BackoffAuthoringOnFinalizedHeadLagging::default()), subspace_link: data.link.clone(), - can_author_with: sp_consensus::AlwaysCanAuthor, justification_sync_link: (), block_proposal_slot_portion: SlotProportion::new(0.5), max_block_proposal_slot_portion: None, diff --git a/crates/sc-piece-cache/Cargo.toml b/crates/sc-piece-cache/Cargo.toml index 7ac4354039d..64121b65d75 100644 --- a/crates/sc-piece-cache/Cargo.toml +++ b/crates/sc-piece-cache/Cargo.toml @@ -13,6 +13,6 @@ include = [ [dependencies] parity-scale-codec = { version = "3.1.5" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" } subspace-networking = { version = "0.1.0", path = "../subspace-networking" } diff --git a/crates/sc-subspace-chain-specs/Cargo.toml b/crates/sc-subspace-chain-specs/Cargo.toml index 361efb63ff9..d6f522645ba 100644 --- a/crates/sc-subspace-chain-specs/Cargo.toml +++ b/crates/sc-subspace-chain-specs/Cargo.toml @@ -12,9 +12,9 @@ include = [ ] [dependencies] -sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["wasmtime"] } -sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["wasmtime"] } +sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } serde = "1.0.143" -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } diff --git a/crates/sp-consensus-subspace/Cargo.toml b/crates/sp-consensus-subspace/Cargo.toml index 5290cd2b46e..143096a7bec 100644 --- a/crates/sp-consensus-subspace/Cargo.toml +++ b/crates/sp-consensus-subspace/Cargo.toml @@ -18,17 +18,17 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features = log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-arithmetic = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { version = "0.10.0-dev", optional = true, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-arithmetic = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { version = "0.10.0-dev", optional = true, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving", default-features = false } subspace-solving = { version = "0.1.0", path = "../subspace-solving", default-features = false } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives", default-features = false } diff --git a/crates/sp-domains/Cargo.toml b/crates/sp-domains/Cargo.toml index ab61219310a..3f73fe27ad0 100644 --- a/crates/sp-domains/Cargo.toml +++ b/crates/sp-domains/Cargo.toml @@ -17,15 +17,15 @@ parity-scale-codec = { version = "3.1.5", default-features = false, features = [ scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] } serde = { version = "1.0.143", optional = true, features = ["derive"] } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-keystore = { version = "0.12.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", optional = true } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-state-machine = { version = "0.12.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-keystore = { version = "0.12.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", optional = true } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-state-machine = { version = "0.12.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" } subspace-runtime-primitives = { version = "0.1.0", default-features = false, path = "../subspace-runtime-primitives" } thiserror = { version = "1.0.32", optional = true } diff --git a/crates/sp-domains/src/bundle_election.rs b/crates/sp-domains/src/bundle_election.rs index 7032599233f..e55c937031e 100644 --- a/crates/sp-domains/src/bundle_election.rs +++ b/crates/sp-domains/src/bundle_election.rs @@ -8,7 +8,6 @@ use sp_core::H256; #[cfg(feature = "std")] use sp_keystore::vrf::{VRFTranscriptData, VRFTranscriptValue}; use sp_runtime::traits::BlakeTwo256; -use sp_std::vec; use sp_std::vec::Vec; use sp_trie::{read_trie_value, LayoutV1, StorageProof}; use subspace_core_primitives::crypto::blake2b_256_hash_list; @@ -191,7 +190,7 @@ pub fn read_bundle_election_params( let db = storage_proof.into_memory_db::(); let read_value = |storage_key| { - read_trie_value::, _>(&db, state_root, storage_key) + read_trie_value::, _>(&db, state_root, storage_key, None, None) .map_err(|_| ReadBundleElectionParamsError::TrieError) }; diff --git a/crates/sp-lightclient/Cargo.toml b/crates/sp-lightclient/Cargo.toml index 86f54d9ea3b..a5334d1ebe3 100644 --- a/crates/sp-lightclient/Cargo.toml +++ b/crates/sp-lightclient/Cargo.toml @@ -19,18 +19,18 @@ include = [ codec = { package = "parity-scale-codec", version = "3.1.2", default-features = false } scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] } -sp-arithmetic = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-arithmetic = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-consensus-subspace = { version = "0.1.0", path = "../sp-consensus-subspace", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives", default-features = false } subspace-solving = { version = "0.1.0", path = "../subspace-solving", default-features = false } subspace-verification = { version = "0.1.0", path = "../subspace-verification", default-features = false } [dev-dependencies] bitvec = "1.0.1" -frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } rand = { version = "0.8.5", features = ["min_const_gen"] } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving"} diff --git a/crates/sp-objects/Cargo.toml b/crates/sp-objects/Cargo.toml index 31c4c08d4ef..217f6a57005 100644 --- a/crates/sp-objects/Cargo.toml +++ b/crates/sp-objects/Cargo.toml @@ -13,8 +13,8 @@ readme = "README.md" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" } subspace-runtime-primitives = { version = "0.1.0", default-features = false, path = "../subspace-runtime-primitives" } diff --git a/crates/subspace-farmer/Cargo.toml b/crates/subspace-farmer/Cargo.toml index 3e8f6cfb754..911c6c0bd5e 100644 --- a/crates/subspace-farmer/Cargo.toml +++ b/crates/subspace-farmer/Cargo.toml @@ -25,7 +25,7 @@ base58 = "0.2.0" bitvec = "1.0.1" blake2-rfc = "0.2.18" bytesize = "1.1.0" -clap = { version = "3.2.16", features = ["color", "derive"] } +clap = { version = "4.0.22", features = ["color", "derive"] } derive_more = "0.99.17" dirs = "4.0.0" event-listener-primitives = "2.0.1" diff --git a/crates/subspace-farmer/src/bin/subspace-farmer/main.rs b/crates/subspace-farmer/src/bin/subspace-farmer/main.rs index e5bb38c19fe..13cff820eed 100644 --- a/crates/subspace-farmer/src/bin/subspace-farmer/main.rs +++ b/crates/subspace-farmer/src/bin/subspace-farmer/main.rs @@ -7,7 +7,7 @@ mod utils; use crate::utils::get_usable_plot_space; use anyhow::Result; use bytesize::ByteSize; -use clap::{ArgEnum, Parser, ValueHint}; +use clap::{Parser, ValueEnum, ValueHint}; use ss58::parse_ss58_reward_address; use std::fs; use std::num::NonZeroU16; @@ -36,19 +36,19 @@ static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; #[derive(Debug, Parser)] struct FarmingArgs { /// WebSocket RPC URL of the Subspace node to connect to - #[clap(long, value_hint = ValueHint::Url, default_value = "ws://127.0.0.1:9944")] + #[arg(long, value_hint = ValueHint::Url, default_value = "ws://127.0.0.1:9944")] node_rpc_url: String, /// Address for farming rewards - #[clap(long, parse(try_from_str = parse_ss58_reward_address))] + #[arg(long, value_parser = parse_ss58_reward_address)] reward_address: PublicKey, /// Maximum plot size in human readable format (e.g. 10GB, 2TiB) or just bytes (e.g. 4096). - #[clap(long, default_value_t)] + #[arg(long, default_value_t)] plot_size: ByteSize, /// Number of major concurrent operations to allow for disk - #[clap(long, default_value = "2")] + #[arg(long, default_value = "2")] disk_concurrency: NonZeroU16, /// Disable farming - #[clap(long)] + #[arg(long)] disable_farming: bool, /// DSN parameters #[clap(flatten)] @@ -59,21 +59,21 @@ struct FarmingArgs { #[derive(Debug, Parser)] struct DsnArgs { /// Enable DSN and use DSN piece provider for plotting - #[clap(long)] + #[arg(long)] enable_dsn: bool, /// Multiaddrs of bootstrap nodes to connect to on startup, multiple are supported - #[clap(long)] + #[arg(long)] bootstrap_nodes: Vec, /// Multiaddr to listen on for subspace networking, for instance `/ip4/0.0.0.0/tcp/0`, /// multiple are supported. - #[clap(long, default_value = "/ip4/0.0.0.0/tcp/40333")] + #[arg(long, default_value = "/ip4/0.0.0.0/tcp/40333")] listen_on: Vec, /// Record cache size in items. - #[clap(long, default_value_t = 32768)] + #[arg(long, default_value_t = 32768)] record_cache_size: usize, } -#[derive(Debug, Clone, Copy, ArgEnum)] +#[derive(Debug, Clone, Copy, ValueEnum)] enum WriteToDisk { Nothing, Everything, @@ -97,10 +97,10 @@ enum Subcommand { // /// Benchmark disk in order to see a throughput of the disk for plotting // Bench { // /// Maximum plot size in human readable format (e.g. 10GB, 2TiB) or just bytes (e.g. 4096). - // #[clap(long)] + // #[arg(long)] // plot_size: ByteSize, // /// Number of major concurrent operations to allow for disk - // #[clap(long, default_value = "2")] + // #[arg(long, default_value = "2")] // disk_concurrency: NonZeroU16, // /// How much things to write on disk (the more we write during benchmark, the more accurate // /// it is) @@ -109,15 +109,15 @@ enum Subcommand { // /// Amount of data to plot for benchmarking. // /// // /// Only `G` and `T` endings are supported. - // #[clap(long)] + // #[arg(long)] // write_pieces_size: ByteSize, // /// Skip recommitment benchmark - // #[clap(long)] + // #[arg(long)] // no_recommitments: bool, // }, } -#[derive(Debug)] +#[derive(Debug, Clone)] struct DiskFarm { /// Path to directory where data is stored. directory: PathBuf, @@ -189,7 +189,7 @@ struct Command { #[clap(subcommand)] subcommand: Subcommand, /// Base path for data storage. - #[clap( + #[arg( long, default_value_os_t = utils::default_base_path(), value_hint = ValueHint::FilePath, @@ -206,11 +206,11 @@ struct Command { /// TODO: Update overhead number here or account for it automatically /// Note that `size` is how much data will be plotted, you also need to account for metadata, /// which right now occupies up to 8% of the disk space. - #[clap(long, conflicts_with = "base-path", conflicts_with = "tmp")] + #[arg(long)] farm: Vec, /// Run temporary farmer, this will create a temporary directory for storing farmer data that /// will be delete at the end of the process - #[clap(long, conflicts_with = "base-path", conflicts_with = "farm")] + #[arg(long, conflicts_with = "base_path", conflicts_with = "farm")] tmp: bool, } diff --git a/crates/subspace-fraud-proof/Cargo.toml b/crates/subspace-fraud-proof/Cargo.toml index c85079792e8..96902cadf82 100644 --- a/crates/subspace-fraud-proof/Cargo.toml +++ b/crates/subspace-fraud-proof/Cargo.toml @@ -14,25 +14,26 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] } hash-db = "0.15.2" -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", path = "../sp-domains" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-state-machine = { version = "0.12.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-state-machine = { version = "0.12.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } tracing = "0.1.36" [dev-dependencies] domain-block-builder = { version = "0.1.0", path = "../../domains/client/block-builder" } domain-test-service = { version = "0.1.0", path = "../../domains/test/service" } futures = "0.3.21" -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-cli = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-keyring = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -substrate-test-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-cli = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-keyring = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +substrate-test-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } system-runtime-primitives = { version = "0.1.0", path = "../../domains/primitives/system-runtime" } +tempfile = "3.3.0" tokio = "1.20.1" diff --git a/crates/subspace-fraud-proof/src/lib.rs b/crates/subspace-fraud-proof/src/lib.rs index be1fbf3ccd5..796d24325bc 100644 --- a/crates/subspace-fraud-proof/src/lib.rs +++ b/crates/subspace-fraud-proof/src/lib.rs @@ -13,13 +13,14 @@ mod tests; use codec::{Codec, Decode, Encode}; use hash_db::{HashDB, Hasher, Prefix}; use sc_client_api::backend; -use sp_api::{ProvideRuntimeApi, StateBackend, StorageProof}; +use sp_api::{ProvideRuntimeApi, StorageProof}; use sp_core::traits::{CodeExecutor, FetchRuntimeCode, RuntimeCode, SpawnNamed}; use sp_core::H256; use sp_domains::{ExecutionPhase, ExecutorApi, FraudProof, VerificationError}; use sp_runtime::generic::BlockId; use sp_runtime::traits::{BlakeTwo256, Block as BlockT, HashFor}; -use sp_state_machine::{TrieBackend, TrieBackendStorage}; +use sp_state_machine::backend::AsTrieBackend; +use sp_state_machine::{TrieBackend, TrieBackendBuilder, TrieBackendStorage}; use sp_trie::DBValue; use std::marker::PhantomData; use std::sync::Arc; @@ -52,16 +53,13 @@ where /// the execution by someone who does not own the whole state. pub fn prove_execution, DBValue>>( &self, - at: BlockId, + at: Block::Hash, execution_phase: &ExecutionPhase, delta_changes: Option<(DB, Block::Hash)>, ) -> sp_blockchain::Result { let state = self.backend.state_at(at)?; - let trie_backend = state.as_trie_backend().ok_or_else(|| { - Box::new(sp_state_machine::ExecutionError::UnableToGenerateProof) - as Box - })?; + let trie_backend = state.as_trie_backend(); let state_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(trie_backend); let runtime_code = state_runtime_code @@ -105,17 +103,14 @@ where /// so that it can be used to compare with the one specified in the fraud proof. pub fn check_execution_proof( &self, - at: BlockId, + at: Block::Hash, execution_phase: &ExecutionPhase, pre_execution_root: H256, proof: StorageProof, ) -> sp_blockchain::Result> { let state = self.backend.state_at(at)?; - let trie_backend = state.as_trie_backend().ok_or_else(|| { - Box::new(sp_state_machine::ExecutionError::UnableToGenerateProof) - as Box - })?; + let trie_backend = state.as_trie_backend(); let state_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(trie_backend); let runtime_code = state_runtime_code @@ -154,7 +149,7 @@ where delta, _phantom: PhantomData::, }; - TrieBackend::new(delta_backend, post_delta_root) + TrieBackendBuilder::new(delta_backend, post_delta_root).build() } struct DeltaBackend<'a, S: 'a + TrieBackendStorage, H: 'a + Hasher, DB: HashDB> { diff --git a/crates/subspace-fraud-proof/src/tests.rs b/crates/subspace-fraud-proof/src/tests.rs index 9238ef8f09f..d426aef465b 100644 --- a/crates/subspace-fraud-proof/src/tests.rs +++ b/crates/subspace-fraud-proof/src/tests.rs @@ -6,17 +6,20 @@ use domain_test_service::runtime::Header; use domain_test_service::Keyring::{Alice, Bob, Charlie, Dave, Ferdie}; use sc_client_api::{HeaderBackend, StorageProof}; use sc_consensus::ForkChoiceStrategy; -use sc_service::Role; +use sc_service::{BasePath, Role}; use sp_api::ProvideRuntimeApi; use sp_domains::{BundleHeader, ExecutionPhase, ExecutionReceipt, FraudProof, OpaqueBundle}; use sp_runtime::generic::BlockId; use sp_runtime::traits::{BlakeTwo256, Hash as HashT, Header as HeaderT}; use sp_runtime::OpaqueExtrinsic; use system_runtime_primitives::{Hash, SystemDomainApi}; +use tempfile::TempDir; #[substrate_test_utils::test(flavor = "multi_thread")] #[ignore] async fn execution_proof_creation_and_verification_should_work() { + let directory = TempDir::new().expect("Must be able to create temporary directory"); + let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_colors(false); let _ = builder.init(); @@ -24,21 +27,34 @@ async fn execution_proof_creation_and_verification_should_work() { let tokio_handle = tokio::runtime::Handle::current(); // Start Ferdie - let (ferdie, ferdie_network_starter) = - run_primary_chain_validator_node(tokio_handle.clone(), Ferdie, vec![]).await; + let (ferdie, ferdie_network_starter) = run_primary_chain_validator_node( + tokio_handle.clone(), + Ferdie, + vec![], + BasePath::new(directory.path().join("ferdie")), + ) + .await; ferdie_network_starter.start_network(); // Run Alice (a secondary chain authority node) - let alice = domain_test_service::TestNodeBuilder::new(tokio_handle.clone(), Alice) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Authority, false, false) - .await; + let alice = domain_test_service::TestNodeBuilder::new( + tokio_handle.clone(), + Alice, + BasePath::new(directory.path().join("alice")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Authority, false, false) + .await; // Run Bob (a secondary chain full node) - let bob = domain_test_service::TestNodeBuilder::new(tokio_handle, Bob) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Full, false, false) - .await; + let bob = domain_test_service::TestNodeBuilder::new( + tokio_handle, + Bob, + BasePath::new(directory.path().join("bob")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Full, false, false) + .await; // Bob is able to sync blocks. futures::future::join(alice.wait_for_blocks(1), bob.wait_for_blocks(1)).await; @@ -201,7 +217,7 @@ async fn execution_proof_creation_and_verification_should_work() { // Test `initialize_block`. let storage_proof = prover .prove_execution::>( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, None, ) @@ -210,7 +226,7 @@ async fn execution_proof_creation_and_verification_should_work() { // Test `initialize_block` verification. let execution_result = prover .check_execution_proof( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, *parent_header.state_root(), storage_proof.clone(), @@ -263,7 +279,7 @@ async fn execution_proof_creation_and_verification_should_work() { let storage_proof = prover .prove_execution( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, Some((delta, post_delta_root)), ) @@ -275,7 +291,7 @@ async fn execution_proof_creation_and_verification_should_work() { // Test `apply_extrinsic` verification. let execution_result = prover .check_execution_proof( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, post_delta_root, storage_proof.clone(), @@ -315,7 +331,7 @@ async fn execution_proof_creation_and_verification_should_work() { let storage_proof = prover .prove_execution( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, Some((delta, post_delta_root)), ) @@ -324,7 +340,7 @@ async fn execution_proof_creation_and_verification_should_work() { // Test `finalize_block` verification. let execution_result = prover .check_execution_proof( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, post_delta_root, storage_proof.clone(), @@ -350,6 +366,8 @@ async fn execution_proof_creation_and_verification_should_work() { #[substrate_test_utils::test(flavor = "multi_thread")] #[ignore] async fn invalid_execution_proof_should_not_work() { + let directory = TempDir::new().expect("Must be able to create temporary directory"); + let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_colors(false); let _ = builder.init(); @@ -357,21 +375,34 @@ async fn invalid_execution_proof_should_not_work() { let tokio_handle = tokio::runtime::Handle::current(); // Start Ferdie - let (ferdie, ferdie_network_starter) = - run_primary_chain_validator_node(tokio_handle.clone(), Ferdie, vec![]).await; + let (ferdie, ferdie_network_starter) = run_primary_chain_validator_node( + tokio_handle.clone(), + Ferdie, + vec![], + BasePath::new(directory.path().join("ferdie")), + ) + .await; ferdie_network_starter.start_network(); // Run Alice (a secondary chain authority node) - let alice = domain_test_service::TestNodeBuilder::new(tokio_handle.clone(), Alice) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Authority, false, false) - .await; + let alice = domain_test_service::TestNodeBuilder::new( + tokio_handle.clone(), + Alice, + BasePath::new(directory.path().join("alice")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Authority, false, false) + .await; // Run Bob (a secondary chain full node) - let bob = domain_test_service::TestNodeBuilder::new(tokio_handle, Bob) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Full, false, false) - .await; + let bob = domain_test_service::TestNodeBuilder::new( + tokio_handle, + Bob, + BasePath::new(directory.path().join("bob")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Full, false, false) + .await; // Bob is able to sync blocks. futures::future::join(alice.wait_for_blocks(1), bob.wait_for_blocks(1)).await; @@ -458,7 +489,7 @@ async fn invalid_execution_proof_should_not_work() { let proof = prover .prove_execution( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, Some((delta, post_delta_root)), ) @@ -475,7 +506,7 @@ async fn invalid_execution_proof_should_not_work() { call_data: transfer_to_charlie_again.encode(), }; prover.check_execution_proof( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, post_delta_root, proof, diff --git a/crates/subspace-networking/Cargo.toml b/crates/subspace-networking/Cargo.toml index 8c6fdd1d6d7..f55f3265015 100644 --- a/crates/subspace-networking/Cargo.toml +++ b/crates/subspace-networking/Cargo.toml @@ -20,7 +20,7 @@ anyhow = "1.0.61" async-trait = "0.1.57" bytes = "1.2.1" chrono = {version = "0.4.21", features = ["clock", "serde", "std",]} -clap = { version = "3.2.16", features = ["color", "derive"] } +clap = { version = "4.0.22", features = ["color", "derive"] } derive_more = "0.99.17" event-listener-primitives = "2.0.1" futures = "0.3.21" @@ -41,7 +41,7 @@ tracing-subscriber = "0.3.15" unsigned-varint = { version = "0.7.1", features = ["futures", "asynchronous_codec"] } [dependencies.libp2p] -version = "0.46.1" +version = "0.49.0" default-features = false features = [ "dns-tokio", @@ -53,7 +53,6 @@ features = [ "ping", "request-response", "serde", - "sr25519", "tcp-tokio", "websocket", "yamux", diff --git a/crates/subspace-networking/examples/announce-piece-complex.rs b/crates/subspace-networking/examples/announce-piece-complex.rs index ba8374ef872..e8e27ff1bc2 100644 --- a/crates/subspace-networking/examples/announce-piece-complex.rs +++ b/crates/subspace-networking/examples/announce-piece-complex.rs @@ -1,5 +1,5 @@ use futures::channel::oneshot; -use libp2p::identity::sr25519::Keypair; +use libp2p::identity::ed25519::Keypair; use libp2p::multiaddr::Protocol; use parking_lot::Mutex; use std::sync::Arc; diff --git a/crates/subspace-networking/examples/get-peers-complex.rs b/crates/subspace-networking/examples/get-peers-complex.rs index 55af1bbe8ef..e9e70fbcd23 100644 --- a/crates/subspace-networking/examples/get-peers-complex.rs +++ b/crates/subspace-networking/examples/get-peers-complex.rs @@ -1,5 +1,5 @@ use futures::channel::oneshot; -use libp2p::identity::sr25519::Keypair; +use libp2p::identity::ed25519::Keypair; use libp2p::multiaddr::Protocol; use libp2p::multihash::{Code, MultihashDigest}; use libp2p::PeerId; diff --git a/crates/subspace-networking/src/behavior.rs b/crates/subspace-networking/src/behavior.rs index cc478f7fa75..6d4059ded05 100644 --- a/crates/subspace-networking/src/behavior.rs +++ b/crates/subspace-networking/src/behavior.rs @@ -10,9 +10,9 @@ use crate::request_responses::{ use custom_record_store::CustomRecordStore; use derive_more::From; use libp2p::gossipsub::{Gossipsub, GossipsubConfig, GossipsubEvent, MessageAuthenticity}; -use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent}; +use libp2p::identify::{Behaviour as Identify, Config as IdentifyConfig, Event as IdentifyEvent}; use libp2p::kad::{Kademlia, KademliaConfig, KademliaEvent}; -use libp2p::ping::{Ping, PingEvent}; +use libp2p::ping::{Behaviour as Ping, Event as PingEvent}; use libp2p::{NetworkBehaviour, PeerId}; pub(crate) struct BehaviorConfig { diff --git a/crates/subspace-networking/src/behavior/record_binary_heap.rs b/crates/subspace-networking/src/behavior/record_binary_heap.rs index 3cb9a69a2a3..e5b51f5e5cf 100644 --- a/crates/subspace-networking/src/behavior/record_binary_heap.rs +++ b/crates/subspace-networking/src/behavior/record_binary_heap.rs @@ -1,10 +1,10 @@ -use libp2p::kad::kbucket::{Distance, Sha256Hash}; +use libp2p::kad::kbucket::Distance; pub use libp2p::kad::record::Key; pub use libp2p::PeerId; use std::cmp::Ordering; use std::collections::BinaryHeap; -type KademliaBucketKey = libp2p::kad::kbucket::Key; +type KademliaBucketKey = libp2p::kad::kbucket::Key; // Helper structure. It wraps Kademlia distance to a given peer for heap-metrics. #[derive(Debug, Clone)] @@ -57,7 +57,7 @@ impl RecordBinaryHeap { /// Constructs a heap with given PeerId and size limit. pub fn new(peer_id: PeerId, limit: usize) -> Self { Self { - peer_key: KademliaBucketKey::new(peer_id), + peer_key: KademliaBucketKey::from(peer_id), max_heap: BinaryHeap::new(), limit, } diff --git a/crates/subspace-networking/src/behavior/tests.rs b/crates/subspace-networking/src/behavior/tests.rs index f59abfd5b95..ae979e404db 100644 --- a/crates/subspace-networking/src/behavior/tests.rs +++ b/crates/subspace-networking/src/behavior/tests.rs @@ -4,7 +4,6 @@ use crate::behavior::custom_record_store::{ }; use crate::behavior::record_binary_heap::RecordBinaryHeap; use chrono::Duration; -use libp2p::kad::kbucket::Sha256Hash; use libp2p::kad::record::Key; use libp2p::kad::store::RecordStore; use libp2p::kad::ProviderRecord; @@ -188,7 +187,7 @@ fn binary_heap_limit_works() { #[test] fn binary_heap_eviction_works() { - type KademliaBucketKey = libp2p::kad::kbucket::Key; + type KademliaBucketKey = libp2p::kad::kbucket::Key; let peer_id = PeerId::from_multihash(Multihash::wrap(Code::Identity.into(), [0u8].as_slice()).unwrap()) @@ -206,8 +205,8 @@ fn binary_heap_eviction_works() { let bucket_key2: KademliaBucketKey = KademliaBucketKey::new(key2.clone()); let evicted = evicted.unwrap(); - if bucket_key1.distance::>(&KademliaBucketKey::new(peer_id)) - > bucket_key2.distance::>(&KademliaBucketKey::new(peer_id)) + if bucket_key1.distance::>(&KademliaBucketKey::from(peer_id)) + > bucket_key2.distance::>(&KademliaBucketKey::from(peer_id)) { assert_eq!(evicted, key1); } else { diff --git a/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs b/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs index 394ccb2bba8..b8366390a8a 100644 --- a/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs +++ b/crates/subspace-networking/src/bin/subspace-bootstrap-node/main.rs @@ -1,7 +1,7 @@ //! Simple bootstrap node implementation use clap::Parser; -use libp2p::identity::sr25519::Keypair; +use libp2p::identity::ed25519::Keypair; use libp2p::Multiaddr; use std::sync::Arc; use subspace_networking::libp2p::multiaddr::Protocol; @@ -19,7 +19,7 @@ enum Command { /// Start bootstrap node Start { /// Multiaddresses of bootstrap nodes to connect to on startup, multiple are supported - #[clap(long, alias = "bootstrap-node")] + #[arg(long, alias = "bootstrap-node")] bootstrap_nodes: Vec, /// Keypair for node identity, can be obtained with `generate-keypair` command keypair: String, @@ -27,13 +27,13 @@ enum Command { #[clap(default_value = "/ip4/0.0.0.0/tcp/0")] listen_on: Vec, /// Multiaddresses of reserved peers to maintain connections to, multiple are supported - #[clap(long, alias = "reserved-peer")] + #[arg(long, alias = "reserved-peer")] reserved_peers: Vec, /// Defines max incoming connections limit for the peer. - #[clap(long)] + #[arg(long)] in_peers: Option, /// Defines max outgoing connections limit for the peer. - #[clap(long)] + #[arg(long)] out_peers: Option, }, /// Generate a new keypair diff --git a/crates/subspace-networking/src/create.rs b/crates/subspace-networking/src/create.rs index cbe8b1ea550..b1dacb54008 100644 --- a/crates/subspace-networking/src/create.rs +++ b/crates/subspace-networking/src/create.rs @@ -17,7 +17,7 @@ use libp2p::dns::TokioDnsConfig; use libp2p::gossipsub::{ GossipsubConfig, GossipsubConfigBuilder, GossipsubMessage, MessageId, ValidationMode, }; -use libp2p::identify::IdentifyConfig; +use libp2p::identify::Config as IdentifyConfig; use libp2p::identity::Keypair; use libp2p::kad::{KademliaBucketInserts, KademliaCaching, KademliaConfig, KademliaStoreInserts}; use libp2p::mplex::MplexConfig; @@ -129,13 +129,13 @@ impl fmt::Debug for Config { impl Config { pub fn with_generated_keypair() -> Self { - Self::with_keypair(identity::sr25519::Keypair::generate()) + Self::with_keypair(identity::ed25519::Keypair::generate()) } - pub fn with_keypair(keypair: identity::sr25519::Keypair) -> Self { + pub fn with_keypair(keypair: identity::ed25519::Keypair) -> Self { let mut kademlia = KademliaConfig::default(); kademlia - .set_protocol_name(KADEMLIA_PROTOCOL) + .set_protocol_names(vec![KADEMLIA_PROTOCOL.into()]) .set_max_packet_size(2 * PIECE_SIZE) .set_kbucket_inserts(KademliaBucketInserts::Manual) .set_replication_factor(KADEMLIA_RECORD_REPLICATION_FACTOR) @@ -173,7 +173,7 @@ impl Config { .build() .expect("Default config for gossipsub is always correct; qed"); - let keypair = identity::Keypair::Sr25519(keypair); + let keypair = identity::Keypair::Ed25519(keypair); let identify = IdentifyConfig::new("ipfs/0.1.0".to_string(), keypair.public()); Self { diff --git a/crates/subspace-networking/src/node_runner.rs b/crates/subspace-networking/src/node_runner.rs index 10988b9f9b6..35431c8ba29 100644 --- a/crates/subspace-networking/src/node_runner.rs +++ b/crates/subspace-networking/src/node_runner.rs @@ -10,7 +10,7 @@ use futures::future::Fuse; use futures::{FutureExt, StreamExt}; use libp2p::core::ConnectedPoint; use libp2p::gossipsub::{GossipsubEvent, TopicHash}; -use libp2p::identify::IdentifyEvent; +use libp2p::identify::Event as IdentifyEvent; use libp2p::kad::{ AddProviderError, AddProviderOk, GetClosestPeersError, GetClosestPeersOk, GetProvidersError, GetProvidersOk, GetRecordError, GetRecordOk, InboundRequest, KademliaEvent, PutRecordOk, @@ -375,10 +375,12 @@ where } let kademlia = &mut self.swarm.behaviour_mut().kademlia; - let kademlia_enabled = info - .protocols - .iter() - .any(|protocol| protocol.as_bytes() == kademlia.protocol_name()); + let kademlia_enabled = info.protocols.iter().any(|protocol_a| { + kademlia + .protocol_names() + .iter() + .any(|protocol_b| protocol_a.as_bytes() == protocol_b.as_ref()) + }); if kademlia_enabled { for address in info.listen_addrs { @@ -397,8 +399,12 @@ where %local_peer_id, %peer_id, %address, - "Adding self-reported address to Kademlia DHT ({}).", - String::from_utf8_lossy(kademlia.protocol_name()), + "Adding self-reported address to Kademlia DHT ({:?}).", + kademlia + .protocol_names() + .iter() + .map(|p| String::from_utf8_lossy(p.as_ref())) + .collect::>(), ); kademlia.add_address(&peer_id, address); } @@ -406,8 +412,12 @@ where trace!( %local_peer_id, %peer_id, - "Peer doesn't support our Kademlia DHT protocol ({}). Adding to the DTH skipped.", - String::from_utf8_lossy(kademlia.protocol_name()) + "Peer doesn't support our Kademlia DHT protocol ({:?}). Adding to the DTH skipped.", + kademlia + .protocol_names() + .iter() + .map(|p| String::from_utf8_lossy(p.as_ref())) + .collect::>(), ) } } diff --git a/crates/subspace-node/Cargo.toml b/crates/subspace-node/Cargo.toml index 6abb5044540..095732ece8a 100644 --- a/crates/subspace-node/Cargo.toml +++ b/crates/subspace-node/Cargo.toml @@ -20,30 +20,30 @@ include = [ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -clap = { version = "3.2.16", features = ["derive"] } +clap = { version = "4.0.22", features = ["derive"] } dirs = "4.0.0" domain-service = { version = "0.1.0", path = "../../domains/service" } -frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["runtime-benchmarks"] } -frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["runtime-benchmarks"] } +frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" log = "0.4.17" parity-scale-codec = "3.1.5" -sc-cli = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["wasmtime"] } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-cli = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["wasmtime"] } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sc-subspace-chain-specs = { version = "0.1.0", path = "../sc-subspace-chain-specs" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", features = ["wasmtime"] } -sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["wasmtime"] } -sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-tracing = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", features = ["wasmtime"] } +sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["wasmtime"] } +sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-tracing = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } serde = "1.0.143" serde_json = "1.0.83" -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-consensus-subspace = { version = "0.1.0", path = "../sp-consensus-subspace" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", path = "../sp-domains" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving" } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" } subspace-networking = { version = "0.1.0", path = "../subspace-networking" } @@ -55,7 +55,7 @@ thiserror = "1.0.32" tokio = { version = "1.20.1" } [build-dependencies] -substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["do-not-enforce-cost-of-storage"] diff --git a/crates/subspace-node/src/import_blocks_from_dsn.rs b/crates/subspace-node/src/import_blocks_from_dsn.rs index 6c90e89fcea..cf45104e74d 100644 --- a/crates/subspace-node/src/import_blocks_from_dsn.rs +++ b/crates/subspace-node/src/import_blocks_from_dsn.rs @@ -40,13 +40,13 @@ type PieceIndex = u64; #[derive(Debug, Parser)] pub struct ImportBlocksFromDsnCmd { /// Multiaddrs of bootstrap nodes to connect to on startup, multiple are supported - #[clap(long)] + #[arg(long)] pub bootstrap_node: Vec, /// The default number of 64KB pages to ever allocate for Wasm execution. /// /// Don't alter this unless you know what you're doing. - #[clap(long, value_name = "COUNT")] + #[arg(long, value_name = "COUNT")] pub default_heap_pages: Option, #[allow(missing_docs)] diff --git a/crates/subspace-node/src/lib.rs b/crates/subspace-node/src/lib.rs index 57e0dafc110..aece8bb8996 100644 --- a/crates/subspace-node/src/lib.rs +++ b/crates/subspace-node/src/lib.rs @@ -118,6 +118,7 @@ impl PurgeChainCmd { /// Utilities for working with a node. #[derive(Debug, clap::Subcommand)] +#[allow(clippy::large_enum_variant)] pub enum Subcommand { /// Key management cli utilities #[clap(subcommand)] @@ -177,11 +178,11 @@ pub struct Cli { /// DSN configuration arguments: DSN 'listen-on' multi-address // TODO: Add more DSN-related parameters - #[clap(long)] + #[arg(long)] pub dsn_listen_on: Vec, /// DSN configuration arguments: DSN 'bootstrap-node' multi-address - #[clap(long)] + #[arg(long)] pub dsn_bootstrap_node: Vec, /// Secondary chain arguments @@ -190,7 +191,7 @@ pub struct Cli { /// while the arguments provided after -- will be passed to the executor node. /// /// subspace-node [primarychain-args] -- [secondarychain-args] - #[clap(raw = true)] + #[arg(raw = true)] pub secondary_chain_args: Vec, } diff --git a/crates/subspace-node/src/secondary_chain/cli.rs b/crates/subspace-node/src/secondary_chain/cli.rs index a3c816db4bc..07d8f3f7124 100644 --- a/crates/subspace-node/src/secondary_chain/cli.rs +++ b/crates/subspace-node/src/secondary_chain/cli.rs @@ -166,7 +166,7 @@ impl CliConfiguration for SecondaryChainCli { fn base_path(&self) -> Result> { Ok(self .shared_params() - .base_path() + .base_path()? .or_else(|| self.base_path.clone().map(Into::into))) } @@ -202,8 +202,8 @@ impl CliConfiguration for SecondaryChainCli { self.run.transaction_pool(is_dev) } - fn state_cache_child_ratio(&self) -> Result> { - self.run.state_cache_child_ratio() + fn trie_cache_maximum_size(&self) -> Result> { + self.run.trie_cache_maximum_size() } fn rpc_methods(&self) -> Result { diff --git a/crates/subspace-runtime-primitives/Cargo.toml b/crates/subspace-runtime-primitives/Cargo.toml index b56a746f214..4db7152fe77 100644 --- a/crates/subspace-runtime-primitives/Cargo.toml +++ b/crates/subspace-runtime-primitives/Cargo.toml @@ -17,11 +17,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive"] } -parity-util-mem = { version = "0.11.0", optional = true, default-features = false, features = ["primitive-types"] } +parity-util-mem = { version = "0.12.0", optional = true, default-features = false, features = ["primitive-types"] } serde = { version = "1.0.143", optional = true, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" } [features] diff --git a/crates/subspace-runtime/Cargo.toml b/crates/subspace-runtime/Cargo.toml index e093970e23e..8f26f4d83b3 100644 --- a/crates/subspace-runtime/Cargo.toml +++ b/crates/subspace-runtime/Cargo.toml @@ -17,12 +17,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } hex-literal = { version = "0.3.3", optional = true } orml-vesting = { version = "0.4.1-dev", default-features = false, path = "../../orml/vesting" } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-domains = { version = "0.1.0", default-features = false, path = "../pallet-domains" } pallet-feeds = { version = "0.1.0", default-features = false, path = "../pallet-feeds" } pallet-grandpa-finality-verifier = { version = "0.1.0", default-features = false, path = "../pallet-grandpa-finality-verifier" } @@ -31,26 +31,26 @@ pallet-offences-subspace = { version = "0.1.0", default-features = false, path = pallet-rewards = { version = "0.1.0", default-features = false, path = "../pallet-rewards" } pallet-runtime-configs = { version = "0.1.0", default-features = false, path = "../pallet-runtime-configs" } pallet-subspace = { version = "0.1.0", default-features = false, path = "../pallet-subspace" } -pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-transaction-fees = { version = "0.1.0", default-features = false, path = "../pallet-transaction-fees" } -pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, version = "4.0.0-dev"} +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, version = "4.0.0-dev"} sp-consensus-subspace = { version = "0.1.0", default-features = false, path = "../sp-consensus-subspace" } -sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-consensus-slots = { version = "0.10.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", default-features = false, path = "../sp-domains" } -sp-inherents = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, version = "4.0.0-dev"} +sp-inherents = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, version = "4.0.0-dev"} sp-objects = { version = "0.1.0", default-features = false, path = "../sp-objects" } -sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../subspace-core-primitives" } subspace-runtime-primitives = { version = "0.1.0", default-features = false, path = "../subspace-runtime-primitives" } subspace-verification = { version = "0.1.0", default-features = false, path = "../subspace-verification" } @@ -58,16 +58,16 @@ system-domain-runtime = { version = "0.1.0", default-features = false, path = ". system-runtime-primitives = { version = "0.1.0", default-features = false, path = "../../domains/primitives/system-runtime" } # Used for the node template's RPCs -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } # Used for runtime benchmarking -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", optional = true } -frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", optional = true } +frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", optional = true } [build-dependencies] subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../subspace-wasm-tools" } -substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [dev-dependencies] hex-literal = { version = "0.3.3" } diff --git a/crates/subspace-runtime/src/fees.rs b/crates/subspace-runtime/src/fees.rs index 738f2034a25..68c04e3a8b8 100644 --- a/crates/subspace-runtime/src/fees.rs +++ b/crates/subspace-runtime/src/fees.rs @@ -1,4 +1,4 @@ -use crate::{Balances, Call, Runtime, TransactionFees}; +use crate::{Balances, Runtime, RuntimeCall, TransactionFees}; use codec::Encode; use frame_support::traits::{Currency, ExistenceRequirement, Get, Imbalance, WithdrawReasons}; use pallet_balances::NegativeImbalance; @@ -33,8 +33,8 @@ impl pallet_transaction_payment::OnChargeTransaction for OnChargeTransa fn withdraw_fee( who: &AccountId, - call: &Call, - _info: &DispatchInfoOf, + call: &RuntimeCall, + _info: &DispatchInfoOf, fee: Self::Balance, tip: Self::Balance, ) -> Result { @@ -69,8 +69,8 @@ impl pallet_transaction_payment::OnChargeTransaction for OnChargeTransa fn correct_and_deposit_fee( who: &AccountId, - _dispatch_info: &DispatchInfoOf, - _post_info: &PostDispatchInfoOf, + _dispatch_info: &DispatchInfoOf, + _post_info: &PostDispatchInfoOf, corrected_fee: Self::Balance, tip: Self::Balance, liquidity_info: Self::LiquidityInfo, diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index f463971b614..f42722e3151 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -159,7 +159,7 @@ parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const BlockHashCount: BlockNumber = 2400; /// We allow for 2 seconds of compute with a 6 second average block time. - pub SubspaceBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO); + pub SubspaceBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(WEIGHT_PER_SECOND.saturating_mul(2).set_proof_size(u64::MAX), NORMAL_DISPATCH_RATIO); /// We allow for 3.75 MiB for `Normal` extrinsic with 5 MiB maximum block length. pub SubspaceBlockLength: BlockLength = BlockLength::max_with_normal_ratio(MAX_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO); } @@ -170,12 +170,12 @@ pub type SS58Prefix = ConstU16<2254>; pub struct CallFilter; -impl Contains for CallFilter { - fn contains(c: &Call) -> bool { +impl Contains for CallFilter { + fn contains(c: &RuntimeCall) -> bool { // Disable executor and all balance transfers !matches!( c, - Call::Balances( + RuntimeCall::Balances( pallet_balances::Call::transfer { .. } | pallet_balances::Call::transfer_keep_alive { .. } | pallet_balances::Call::transfer_all { .. } @@ -194,7 +194,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The aggregated dispatch type that is available for extrinsics. - type Call = Call; + type RuntimeCall = RuntimeCall; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. @@ -208,9 +208,9 @@ impl frame_system::Config for Runtime { /// The header type. type Header = Header; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = ConstU32<250>; /// The weight of database operations that the runtime can invoke. @@ -247,7 +247,7 @@ parameter_types! { } impl pallet_subspace::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type GlobalRandomnessUpdateInterval = ConstU32; type EraDuration = ConstU32; type InitialSolutionRange = ConstU64; @@ -287,7 +287,7 @@ impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; @@ -332,7 +332,7 @@ impl Get for BlockchainHistorySize { } impl pallet_transaction_fees::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type MinReplicationFactor = ConstU16; type StorageFeesEscrowBlockReward = StorageFeesEscrowBlockReward; type StorageFeesEscrowBlockTax = StorageFeesEscrowBlockTax; @@ -345,7 +345,7 @@ impl pallet_transaction_fees::Config for Runtime { } impl pallet_transaction_payment::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnChargeTransaction = OnChargeTransaction; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = IdentityFee; @@ -354,27 +354,27 @@ impl pallet_transaction_payment::Config for Runtime { } impl pallet_utility::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; type PalletsOrigin = OriginCaller; type WeightInfo = pallet_utility::weights::SubstrateWeight; } impl pallet_sudo::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; } impl frame_system::offchain::SendTransactionTypes for Runtime where - Call: From, + RuntimeCall: From, { type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = Call; + type OverarchingCall = RuntimeCall; } impl pallet_offences_subspace::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnOffenceHandler = Subspace; } @@ -384,7 +384,7 @@ parameter_types! { } impl pallet_domains::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SecondaryHash = system_runtime_primitives::Hash; type ReceiptsPruningDepth = ReceiptsPruningDepth; type MaximumReceiptDrift = MaximumReceiptDrift; @@ -397,7 +397,7 @@ parameter_types! { } impl pallet_rewards::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type BlockReward = BlockReward; type VoteReward = VoteReward; @@ -414,7 +414,7 @@ parameter_types! { } impl pallet_feeds::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type FeedId = FeedId; type FeedProcessorKind = FeedProcessorKind; type MaxFeeds = MaxFeeds; @@ -431,7 +431,7 @@ impl pallet_grandpa_finality_verifier::Config for Runtime { } impl pallet_object_store::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; } impl pallet_runtime_configs::Config for Runtime {} @@ -442,7 +442,7 @@ parameter_types! { } impl orml_vesting::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type MinVestedTransfer = MinVestedTransfer; type VestedTransferOrigin = EnsureNever; @@ -503,7 +503,8 @@ pub type SignedExtra = ( DisablePallets, ); /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -515,7 +516,7 @@ pub type Executive = frame_executive::Executive< fn extract_root_blocks(ext: &UncheckedExtrinsic) -> Option> { match &ext.function { - Call::Subspace(pallet_subspace::Call::store_root_blocks { root_blocks }) => { + RuntimeCall::Subspace(pallet_subspace::Call::store_root_blocks { root_blocks }) => { Some(root_blocks.clone()) } _ => None, @@ -531,7 +532,7 @@ fn extract_system_bundles( let (system_bundles, core_bundles): (Vec<_>, Vec<_>) = extrinsics .into_iter() .filter_map(|uxt| { - if let Call::Domains(pallet_domains::Call::submit_bundle { + if let RuntimeCall::Domains(pallet_domains::Call::submit_bundle { signed_opaque_bundle, }) = uxt.function { @@ -558,7 +559,7 @@ fn extract_core_bundles( extrinsics .into_iter() .filter_map(|uxt| match uxt.function { - Call::Domains(pallet_domains::Call::submit_bundle { + RuntimeCall::Domains(pallet_domains::Call::submit_bundle { signed_opaque_bundle, }) if signed_opaque_bundle.domain_id() == domain_id => { Some(signed_opaque_bundle.bundle) @@ -574,7 +575,7 @@ fn extract_receipts( extrinsics .into_iter() .filter_map(|uxt| { - if let Call::Domains(pallet_domains::Call::submit_bundle { + if let RuntimeCall::Domains(pallet_domains::Call::submit_bundle { signed_opaque_bundle, }) = uxt.function { @@ -591,7 +592,7 @@ fn extract_fraud_proofs(extrinsics: Vec) -> Vec extrinsics .into_iter() .filter_map(|uxt| { - if let Call::Domains(pallet_domains::Call::submit_fraud_proof { fraud_proof }) = + if let RuntimeCall::Domains(pallet_domains::Call::submit_fraud_proof { fraud_proof }) = uxt.function { Some(fraud_proof) diff --git a/crates/subspace-runtime/src/object_mapping.rs b/crates/subspace-runtime/src/object_mapping.rs index ab1de05c739..242644b7ae0 100644 --- a/crates/subspace-runtime/src/object_mapping.rs +++ b/crates/subspace-runtime/src/object_mapping.rs @@ -1,4 +1,4 @@ -use crate::{Block, Call, Runtime}; +use crate::{Block, Runtime, RuntimeCall}; use codec::{Compact, CompactLen, Encode}; use sp_api::HashT; use sp_runtime::traits::BlakeTwo256; @@ -116,7 +116,7 @@ pub(crate) fn extract_utility_block_object_mapping>( pub(crate) fn extract_call_block_object_mapping>( mut base_offset: u32, objects: &mut Vec, - call: &Call, + call: &RuntimeCall, recursion_depth_left: u16, successful_calls: &mut Peekable, ) { @@ -124,13 +124,13 @@ pub(crate) fn extract_call_block_object_mapping>( base_offset += 1; match call { - Call::Feeds(call) => { + RuntimeCall::Feeds(call) => { extract_feeds_block_object_mapping(base_offset, objects, call, successful_calls); } - Call::ObjectStore(call) => { + RuntimeCall::ObjectStore(call) => { extract_object_store_block_object_mapping(base_offset, objects, call); } - Call::Utility(call) => { + RuntimeCall::Utility(call) => { extract_utility_block_object_mapping( base_offset, objects, diff --git a/crates/subspace-runtime/src/signed_extensions.rs b/crates/subspace-runtime/src/signed_extensions.rs index dee0644fcd6..1f7fbcb0649 100644 --- a/crates/subspace-runtime/src/signed_extensions.rs +++ b/crates/subspace-runtime/src/signed_extensions.rs @@ -1,4 +1,4 @@ -use crate::{Call, Runtime, RuntimeConfigs, Subspace, Sudo}; +use crate::{Runtime, RuntimeCall, RuntimeConfigs, Subspace, Sudo}; use codec::{Decode, Encode}; use scale_info::TypeInfo; use sp_runtime::traits::{DispatchInfoOf, SignedExtension}; @@ -13,7 +13,7 @@ pub struct CheckStorageAccess; impl SignedExtension for CheckStorageAccess { const IDENTIFIER: &'static str = "CheckStorageAccess"; type AccountId = ::AccountId; - type Call = ::Call; + type Call = ::RuntimeCall; type AdditionalSigned = (); type Pre = (); @@ -53,7 +53,7 @@ pub struct DisablePallets; impl SignedExtension for DisablePallets { const IDENTIFIER: &'static str = "DisablePallets"; type AccountId = ::AccountId; - type Call = ::Call; + type Call = ::RuntimeCall; type AdditionalSigned = (); type Pre = (); @@ -76,7 +76,7 @@ impl SignedExtension for DisablePallets { _info: &DispatchInfoOf, _len: usize, ) -> TransactionValidity { - if matches!(call, Call::Domains(_)) && !RuntimeConfigs::enable_executor() { + if matches!(call, RuntimeCall::Domains(_)) && !RuntimeConfigs::enable_executor() { InvalidTransaction::Call.into() } else { Ok(ValidTransaction::default()) diff --git a/crates/subspace-runtime/tests/integration/object_mapping.rs b/crates/subspace-runtime/tests/integration/object_mapping.rs index 3f8937895d0..bbc5a2b3de4 100644 --- a/crates/subspace-runtime/tests/integration/object_mapping.rs +++ b/crates/subspace-runtime/tests/integration/object_mapping.rs @@ -6,7 +6,8 @@ use sp_runtime::traits::{BlakeTwo256, Hash as HashT}; use subspace_core_primitives::objects::BlockObjectMapping; use subspace_core_primitives::{crypto, Blake2b256Hash}; use subspace_runtime::{ - Block, Call, FeedProcessorKind, Feeds, Header, Origin, Runtime, System, UncheckedExtrinsic, + Block, FeedProcessorKind, Feeds, Header, Runtime, RuntimeCall, RuntimeOrigin, System, + UncheckedExtrinsic, }; use subspace_runtime_primitives::Hash; @@ -28,14 +29,14 @@ fn object_mapping() { extrinsics: vec![ UncheckedExtrinsic { signature: None, - function: Call::Feeds(pallet_feeds::Call::put { + function: RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data0.clone(), }), }, UncheckedExtrinsic { signature: None, - function: Call::Feeds(pallet_feeds::Call::put { + function: RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data1.clone(), }), @@ -43,20 +44,20 @@ fn object_mapping() { // assuming this call fails, we will remove the 3rd hash from calls UncheckedExtrinsic { signature: None, - function: Call::Feeds(pallet_feeds::Call::put { + function: RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data0.clone(), }), }, UncheckedExtrinsic { signature: None, - function: Call::Utility(pallet_utility::Call::batch { + function: RuntimeCall::Utility(pallet_utility::Call::batch { calls: vec![ - Call::Feeds(pallet_feeds::Call::put { + RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data2.clone(), }), - Call::Feeds(pallet_feeds::Call::put { + RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data3.clone(), }), @@ -65,9 +66,9 @@ fn object_mapping() { }, UncheckedExtrinsic { signature: None, - function: Call::Utility(pallet_utility::Call::as_derivative { + function: RuntimeCall::Utility(pallet_utility::Call::as_derivative { index: 0, - call: Box::new(Call::Feeds(pallet_feeds::Call::put { + call: Box::new(RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data0.clone(), })), @@ -75,13 +76,13 @@ fn object_mapping() { }, UncheckedExtrinsic { signature: None, - function: Call::Utility(pallet_utility::Call::batch_all { + function: RuntimeCall::Utility(pallet_utility::Call::batch_all { calls: vec![ - Call::Feeds(pallet_feeds::Call::put { + RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data2.clone(), }), - Call::Feeds(pallet_feeds::Call::put { + RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: data3.clone(), }), @@ -100,7 +101,7 @@ fn object_mapping() { let BlockObjectMapping { objects } = new_test_ext().execute_with(|| { // init feed Feeds::create( - Origin::signed([0u8; 32].into()), + RuntimeOrigin::signed([0u8; 32].into()), FeedProcessorKind::default(), None, ) @@ -157,20 +158,20 @@ fn get_successful_calls(block: Block) -> Vec { .extrinsics .iter() .filter_map(|ext| match &ext.function { - Call::Feeds(call) => Some(vec![call.encode()]), - Call::Utility(call) => match call { + RuntimeCall::Feeds(call) => Some(vec![call.encode()]), + RuntimeCall::Utility(call) => match call { pallet_utility::Call::batch { calls } | pallet_utility::Call::batch_all { calls } => Some( calls .iter() .filter_map(|call| match &call { - Call::Feeds(call) => Some(call.encode()), + RuntimeCall::Feeds(call) => Some(call.encode()), _ => None, }) .collect(), ), pallet_utility::Call::as_derivative { call, .. } => match call.as_ref() { - Call::Feeds(call) => Some(vec![call.encode()]), + RuntimeCall::Feeds(call) => Some(vec![call.encode()]), _ => None, }, _ => None, @@ -199,7 +200,7 @@ fn grandpa_object_mapping() { }, extrinsics: vec![UncheckedExtrinsic { signature: None, - function: Call::Feeds(pallet_feeds::Call::put { + function: RuntimeCall::Feeds(pallet_feeds::Call::put { feed_id: 0, object: object.clone(), }), @@ -210,7 +211,7 @@ fn grandpa_object_mapping() { let BlockObjectMapping { objects } = new_test_ext().execute_with(|| { // init feed Feeds::create( - Origin::signed([0u8; 32].into()), + RuntimeOrigin::signed([0u8; 32].into()), FeedProcessorKind::PolkadotLike, Some(init_data), ) diff --git a/crates/subspace-service/Cargo.toml b/crates/subspace-service/Cargo.toml index 5a529d61d65..ee49a10d83c 100644 --- a/crates/subspace-service/Cargo.toml +++ b/crates/subspace-service/Cargo.toml @@ -17,57 +17,59 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] derive_more = "0.99.17" -frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" jsonrpsee = { version = "0.15.1", features = ["server"] } -pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } parity-scale-codec = "3.1.5" -parity-util-mem = { version = "0.11.0", default-features = false, features = ["primitive-types"] } -sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +parity-util-mem = { version = "0.12.0", default-features = false, features = ["primitive-types"] } +sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sc-consensus-fraud-proof = { version = "0.1.0", path = "../sc-consensus-fraud-proof" } sc-consensus-subspace = { version = "0.1.0", path = "../sc-consensus-subspace" } sc-consensus-subspace-rpc = { version = "0.1.0", path = "../sc-consensus-subspace-rpc" } -sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", features = ["wasmtime"] } -sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", features = ["wasmtime"] } +sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sc-piece-cache = { version = "0.1.0", path = "../sc-piece-cache" } -sc-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["wasmtime"] } -sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-tracing = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-authorship = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-rpc = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-rpc-spec-v2 = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["wasmtime"] } +sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-tracing = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-authorship = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-consensus-subspace = { version = "0.1.0", path = "../sp-consensus-subspace" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", path = "../sp-domains" } sp-objects = { version = "0.1.0", path = "../sp-objects" } -sp-offchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-offchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives" } subspace-fraud-proof = { version = "0.1.0", path = "../subspace-fraud-proof" } subspace-networking = { version = "0.1.0", path = "../subspace-networking" } subspace-runtime-primitives = { version = "0.1.0", path = "../subspace-runtime-primitives" } -substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -substrate-prometheus-endpoint = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +substrate-prometheus-endpoint = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } system-runtime-primitives = { version = "0.1.0", path = "../../domains/primitives/system-runtime" } thiserror = "1.0.32" tracing = "0.1.36" -sp-session = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system-rpc-runtime-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-session = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = [] diff --git a/crates/subspace-service/src/lib.rs b/crates/subspace-service/src/lib.rs index 5aa2f242333..f9a7560ca28 100644 --- a/crates/subspace-service/src/lib.rs +++ b/crates/subspace-service/src/lib.rs @@ -30,7 +30,7 @@ use futures::StreamExt; use jsonrpsee::RpcModule; use pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi; use sc_basic_authorship::ProposerFactory; -use sc_client_api::{BlockBackend, ExecutorProvider, HeaderBackend, StateBackendFor}; +use sc_client_api::{BlockBackend, HeaderBackend, StateBackendFor}; use sc_consensus::{BlockImport, DefaultImportQueue}; use sc_consensus_slots::SlotProportion; use sc_consensus_subspace::notification::SubspaceNotificationStream; @@ -48,7 +48,8 @@ use sc_service::{ use sc_telemetry::{Telemetry, TelemetryWorker}; use sp_api::{ApiExt, ConstructRuntimeApi, Metadata, ProvideRuntimeApi, TransactionFor}; use sp_block_builder::BlockBuilder; -use sp_consensus::{CanAuthorWithNativeVersion, Error as ConsensusError}; +use sp_blockchain::HeaderMetadata; +use sp_consensus::Error as ConsensusError; use sp_consensus_slots::Slot; use sp_consensus_subspace::{FarmerPublicKey, SubspaceApi}; use sp_domains::ExecutorApi; @@ -236,10 +237,9 @@ where sc_consensus_fraud_proof::block_import(client.clone(), client.clone(), proof_verifier); let (block_import, subspace_link) = sc_consensus_subspace::block_import( - sc_consensus_subspace::Config::get(&*client)?, + sc_consensus_subspace::slot_duration(&*client)?, fraud_proof_block_import, client.clone(), - CanAuthorWithNativeVersion::new(client.executor().clone()), { let client = client.clone(); @@ -259,7 +259,7 @@ where let subspace_inherents = sp_consensus_subspace::inherents::InherentDataProvider::from_timestamp_and_slot_duration( *timestamp, - subspace_link.config().slot_duration(), + subspace_link.slot_duration(), subspace_link.root_blocks_for_block(parent_block_number + 1), ); @@ -302,7 +302,7 @@ where } }); - let slot_duration = subspace_link.config().slot_duration(); + let slot_duration = subspace_link.slot_duration(); let import_queue = sc_consensus_subspace::import_queue( block_import.clone(), None, @@ -338,6 +338,7 @@ where + BlockBackend + BlockIdTo + HeaderBackend + + HeaderMetadata + 'static, Client::Api: TaggedTransactionQueue + ExecutorApi, @@ -445,7 +446,7 @@ where config.role.is_authority(), ); - let (network, system_rpc_tx, network_starter) = + let (network, system_rpc_tx, tx_handler_controller, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), @@ -510,18 +511,17 @@ where let subspace_inherents = sp_consensus_subspace::inherents::InherentDataProvider::from_timestamp_and_slot_duration( *timestamp, - subspace_link.config().slot_duration(), + subspace_link.slot_duration(), subspace_link.root_blocks_for_block(parent_block_number + 1), ); - Ok((timestamp, subspace_inherents)) + Ok((subspace_inherents, timestamp)) } } }, force_authoring: config.force_authoring, backoff_authoring_blocks, subspace_link, - can_author_with: CanAuthorWithNativeVersion::new(client.executor().clone()), block_proposal_slot_portion, max_block_proposal_slot_portion: None, telemetry: None, @@ -550,11 +550,13 @@ where let reward_signing_notification_stream = reward_signing_notification_stream.clone(); let archived_segment_notification_stream = archived_segment_notification_stream.clone(); let transaction_pool = transaction_pool.clone(); + let chain_spec = config.chain_spec.cloned_box(); Box::new(move |deny_unsafe, subscription_executor| { let deps = rpc::FullDeps { client: client.clone(), pool: transaction_pool.clone(), + chain_spec: chain_spec.cloned_box(), deny_unsafe, subscription_executor, new_slot_notification_stream: new_slot_notification_stream.clone(), @@ -573,6 +575,7 @@ where system_rpc_tx, config: config.into(), telemetry: telemetry.as_mut(), + tx_handler_controller, })?; Ok(NewFull { diff --git a/crates/subspace-service/src/pool.rs b/crates/subspace-service/src/pool.rs index 48958f2b7dd..9affe510a23 100644 --- a/crates/subspace-service/src/pool.rs +++ b/crates/subspace-service/src/pool.rs @@ -1,5 +1,6 @@ use futures::channel::oneshot; use futures::future::{Future, FutureExt, Ready}; +use jsonrpsee::core::async_trait; use sc_client_api::blockchain::HeaderBackend; use sc_client_api::{BlockBackend, ExecutorProvider, UsageProvider}; use sc_service::{Configuration, TaskManager}; @@ -14,6 +15,7 @@ use sc_transaction_pool_api::{ TransactionStatusStreamFor, TxHash, }; use sp_api::ProvideRuntimeApi; +use sp_blockchain::{HeaderMetadata, TreeRoute}; use sp_core::traits::{SpawnEssentialNamed, SpawnNamed}; use sp_domains::ExecutorApi; use sp_runtime::generic::BlockId; @@ -62,6 +64,7 @@ where + BlockBackend + BlockIdTo + HeaderBackend + + HeaderMetadata + Send + Sync + 'static, @@ -104,6 +107,7 @@ where + BlockBackend + BlockIdTo + HeaderBackend + + HeaderMetadata + Send + Sync + 'static, @@ -116,7 +120,7 @@ where type ValidationFuture = Pin> + Send>>; type BodyFuture = Ready::Extrinsic>>>>; - fn block_body(&self, id: &BlockId) -> Self::BodyFuture { + fn block_body(&self, id: ::Hash) -> Self::BodyFuture { self.inner.block_body(id) } @@ -209,6 +213,14 @@ where ) -> Result::Header>, Self::Error> { self.inner.block_header(at) } + + fn tree_route( + &self, + from: ::Hash, + to: ::Hash, + ) -> Result, Self::Error> { + sp_blockchain::tree_route::(&*self.client, from, to).map_err(Into::into) + } } pub struct BasicPoolWrapper @@ -243,6 +255,8 @@ where RevalidationType::Full, spawner, client.usage_info().chain.best_number, + client.usage_info().chain.best_hash, + client.usage_info().chain.finalized_hash, ); Self { inner: basic_pool } @@ -265,6 +279,7 @@ where Client: ProvideRuntimeApi + BlockBackend + HeaderBackend + + HeaderMetadata + BlockIdTo + Send + Sync @@ -380,13 +395,14 @@ where } } +#[async_trait] impl MaintainedTransactionPool for BasicPoolWrapper where Block: BlockT, PoolApi: ChainApi + 'static, { - fn maintain(&self, event: ChainEvent) -> Pin + Send>> { - self.inner.maintain(event) + async fn maintain(&self, event: ChainEvent) { + self.inner.maintain(event).await } } @@ -411,6 +427,7 @@ where Client: ProvideRuntimeApi + BlockBackend + HeaderBackend + + HeaderMetadata + ExecutorProvider + UsageProvider + BlockIdTo diff --git a/crates/subspace-service/src/rpc.rs b/crates/subspace-service/src/rpc.rs index f6f9c573414..d97744496cf 100644 --- a/crates/subspace-service/src/rpc.rs +++ b/crates/subspace-service/src/rpc.rs @@ -32,6 +32,7 @@ use sc_consensus_subspace_rpc::{SubspaceRpc, SubspaceRpcApiServer}; use sc_piece_cache::PieceCache; use sc_rpc::SubscriptionTaskExecutor; use sc_rpc_api::DenyUnsafe; +use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer}; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; @@ -48,6 +49,8 @@ pub struct FullDeps { pub client: Arc, /// Transaction pool instance. pub pool: Arc

, + /// A copy of the chain spec. + pub chain_spec: Box, /// Whether to deny unsafe calls. pub deny_unsafe: DenyUnsafe, /// Executor to drive the subscription manager in the Grandpa RPC handler. @@ -88,6 +91,7 @@ where let FullDeps { client, pool, + chain_spec, deny_unsafe, subscription_executor, new_slot_notification_stream, @@ -96,6 +100,15 @@ where piece_cache, } = deps; + let chain_name = chain_spec.name().to_string(); + let genesis_hash = client + .block_hash(0) + .ok() + .flatten() + .expect("Genesis block exists; qed"); + let properties = chain_spec.properties(); + module.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?; + module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; diff --git a/crates/subspace-verification/Cargo.toml b/crates/subspace-verification/Cargo.toml index e8f45a5109f..03bed9f7e02 100644 --- a/crates/subspace-verification/Cargo.toml +++ b/crates/subspace-verification/Cargo.toml @@ -20,8 +20,8 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features = merlin = { version = "2.0.1", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } schnorrkel = { version = "0.9.1", default-features = false, features = ["u64_backend"] } -sp-arithmetic = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-arithmetic = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-archiving = { version = "0.1.0", path = "../subspace-archiving", default-features = false } subspace-solving = { version = "0.1.0", path = "../subspace-solving", default-features = false } subspace-core-primitives = { version = "0.1.0", path = "../subspace-core-primitives", default-features = false } diff --git a/domains/client/block-builder/Cargo.toml b/domains/client/block-builder/Cargo.toml index 441c21b46f3..2927916ee7c 100644 --- a/domains/client/block-builder/Cargo.toml +++ b/domains/client/block-builder/Cargo.toml @@ -14,14 +14,14 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", features = ["derive"] } -sc-client-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-state-machine = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-client-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-state-machine = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [dev-dependencies] substrate-test-runtime-client = { path = "../../../substrate/substrate-test-runtime-client" } diff --git a/domains/client/block-builder/src/lib.rs b/domains/client/block-builder/src/lib.rs index 4a73bc64776..af1fba9a8c1 100644 --- a/domains/client/block-builder/src/lib.rs +++ b/domains/client/block-builder/src/lib.rs @@ -225,7 +225,7 @@ where fn collect_storage_changes( &self, ) -> Result, Block>, Error> { - let state = self.backend.state_at(self.block_id)?; + let state = self.backend.state_at(self.parent_hash)?; let parent_hash = self.parent_hash; self.api .into_storage_changes(&state, parent_hash) diff --git a/domains/client/consensus-relay-chain/Cargo.toml b/domains/client/consensus-relay-chain/Cargo.toml index 2ce0d310b3a..b8ca55d3507 100644 --- a/domains/client/consensus-relay-chain/Cargo.toml +++ b/domains/client/consensus-relay-chain/Cargo.toml @@ -7,9 +7,9 @@ edition = "2021" [dependencies] async-trait = "0.1.57" -sc-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -substrate-prometheus-endpoint = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +substrate-prometheus-endpoint = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } diff --git a/domains/client/domain-executor/Cargo.toml b/domains/client/domain-executor/Cargo.toml index 03c93536af8..1beec4c5de8 100644 --- a/domains/client/domain-executor/Cargo.toml +++ b/domains/client/domain-executor/Cargo.toml @@ -6,20 +6,20 @@ edition = "2021" [dependencies] # Substrate dependencies -sc-client-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-utils = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-keystore = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-client-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-utils = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-keystore = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } # Other dependencies # Not using `blake2` crate due to https://github.com/RustCrypto/hashes/issues/360 @@ -47,14 +47,15 @@ system-runtime-primitives = { path = "../../primitives/system-runtime" } [dev-dependencies] domain-test-service = { path = "../../test/service" } -pallet-balances = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-domains = { path = "../../../crates/pallet-domains" } -sc-cli = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sc-service = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sc-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-keyring = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-state-machine = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-cli = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sc-service = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sc-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-keyring = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-state-machine = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-test-runtime = { path = "../../../test/subspace-test-runtime" } subspace-test-service = { path = "../../../test/subspace-test-service" } substrate-test-runtime-client = { path = "../../../substrate/substrate-test-runtime-client" } -substrate-test-utils = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-test-utils = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +tempfile = "3.3.0" diff --git a/domains/client/domain-executor/src/bundle_election_solver.rs b/domains/client/domain-executor/src/bundle_election_solver.rs index 5172fbf20e9..154f5c87a5e 100644 --- a/domains/client/domain-executor/src/bundle_election_solver.rs +++ b/domains/client/domain-executor/src/bundle_election_solver.rs @@ -109,10 +109,9 @@ where let storage_keys = well_known_keys::bundle_election_storage_keys(domain_id); // TODO: bench how large the storage proof we can afford and try proving a single // electioned executor storage instead of the whole authority set. - let storage_proof = self.client.read_proof( - &best_block_id, - &mut storage_keys.iter().map(|s| s.as_slice()), - )?; + let storage_proof = self + .client + .read_proof(best_hash, &mut storage_keys.iter().map(|s| s.as_slice()))?; let state_root = *self .client diff --git a/domains/client/domain-executor/src/core_bundle_processor.rs b/domains/client/domain-executor/src/core_bundle_processor.rs index 1a21c19e4b9..4bc56bcab8f 100644 --- a/domains/client/domain-executor/src/core_bundle_processor.rs +++ b/domains/client/domain-executor/src/core_bundle_processor.rs @@ -461,7 +461,7 @@ where ) -> Result<(), sp_blockchain::Error> { let extrinsics = self .primary_chain_client - .block_body(&BlockId::Hash(primary_hash))? + .block_body(primary_hash)? .ok_or_else(|| { sp_blockchain::Error::Backend(format!( "Primary block body for {:?} not found", diff --git a/domains/client/domain-executor/src/core_domain_worker.rs b/domains/client/domain-executor/src/core_domain_worker.rs index f0722ff8c61..a8000ccd64a 100644 --- a/domains/client/domain-executor/src/core_domain_worker.rs +++ b/domains/client/domain-executor/src/core_domain_worker.rs @@ -432,7 +432,7 @@ where + Sync, { let block_id = BlockId::Hash(block_hash); - let extrinsics = match primary_chain_client.block_body(&block_id) { + let extrinsics = match primary_chain_client.block_body(block_hash) { Err(err) => { tracing::error!( target: LOG_TARGET, diff --git a/domains/client/domain-executor/src/fraud_proof.rs b/domains/client/domain-executor/src/fraud_proof.rs index c7bbf6e488d..d6aa88467b7 100644 --- a/domains/client/domain-executor/src/fraud_proof.rs +++ b/domains/client/domain-executor/src/fraud_proof.rs @@ -138,7 +138,7 @@ where }; let proof = prover.prove_execution::>( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, None, )?; @@ -173,7 +173,7 @@ where let post_delta_root = storage_changes.transaction_storage_root; let proof = prover.prove_execution( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, Some((delta, post_delta_root)), )?; @@ -221,7 +221,7 @@ where } fn block_body(&self, at: Block::Hash) -> Result, sp_blockchain::Error> { - self.client.block_body(&BlockId::Hash(at))?.ok_or_else(|| { + self.client.block_body(at)?.ok_or_else(|| { sp_blockchain::Error::Backend(format!("Block body not found for {:?}", at)) }) } @@ -261,7 +261,7 @@ where let delta = storage_changes.transaction; let post_delta_root = storage_changes.transaction_storage_root; let execution_proof = prover.prove_execution( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, Some((delta, post_delta_root)), )?; diff --git a/domains/client/domain-executor/src/system_bundle_processor.rs b/domains/client/domain-executor/src/system_bundle_processor.rs index 0182841687e..a1bf16863e3 100644 --- a/domains/client/domain-executor/src/system_bundle_processor.rs +++ b/domains/client/domain-executor/src/system_bundle_processor.rs @@ -467,7 +467,7 @@ where ) -> Result<(), sp_blockchain::Error> { let extrinsics = self .primary_chain_client - .block_body(&BlockId::Hash(primary_hash))? + .block_body(primary_hash)? .ok_or_else(|| { sp_blockchain::Error::Backend(format!( "Primary block body for {:?} not found", diff --git a/domains/client/domain-executor/src/system_domain_worker.rs b/domains/client/domain-executor/src/system_domain_worker.rs index 65bc6e6e349..b2164d9abcd 100644 --- a/domains/client/domain-executor/src/system_domain_worker.rs +++ b/domains/client/domain-executor/src/system_domain_worker.rs @@ -418,8 +418,7 @@ where + Send + Sync, { - let block_id = BlockId::Hash(block_hash); - let extrinsics = match primary_chain_client.block_body(&block_id) { + let extrinsics = match primary_chain_client.block_body(block_hash) { Err(err) => { tracing::error!( target: LOG_TARGET, @@ -435,6 +434,7 @@ where Ok(Some(body)) => body, }; + let block_id = BlockId::Hash(block_hash); let header = match primary_chain_client.header(block_id) { Err(err) => { tracing::error!( diff --git a/domains/client/domain-executor/src/tests.rs b/domains/client/domain-executor/src/tests.rs index 98397e0e074..0a8fcd06288 100644 --- a/domains/client/domain-executor/src/tests.rs +++ b/domains/client/domain-executor/src/tests.rs @@ -2,11 +2,11 @@ use codec::{Decode, Encode}; use domain_test_service::run_primary_chain_validator_node; use domain_test_service::runtime::{Header, UncheckedExtrinsic}; use domain_test_service::Keyring::{Alice, Bob, Ferdie}; -use sc_client_api::{Backend, BlockBackend, HeaderBackend, StateBackend}; +use sc_client_api::{Backend, BlockBackend, HeaderBackend}; use sc_consensus::ForkChoiceStrategy; -use sc_service::Role; +use sc_service::{BasePath, Role}; use sc_transaction_pool_api::TransactionSource; -use sp_api::ProvideRuntimeApi; +use sp_api::{AsTrieBackend, ProvideRuntimeApi}; use sp_core::traits::FetchRuntimeCode; use sp_core::Pair; use sp_domains::{ @@ -17,10 +17,13 @@ use sp_runtime::traits::{BlakeTwo256, Hash as HashT, Header as HeaderT}; use std::collections::HashSet; use subspace_core_primitives::BlockNumber; use system_runtime_primitives::{Hash, SystemDomainApi}; +use tempfile::TempDir; #[substrate_test_utils::test(flavor = "multi_thread")] #[ignore] async fn test_executor_full_node_catching_up() { + let directory = TempDir::new().expect("Must be able to create temporary directory"); + let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_colors(false); let _ = builder.init(); @@ -28,21 +31,34 @@ async fn test_executor_full_node_catching_up() { let tokio_handle = tokio::runtime::Handle::current(); // Start Ferdie - let (ferdie, ferdie_network_starter) = - run_primary_chain_validator_node(tokio_handle.clone(), Ferdie, vec![]).await; + let (ferdie, ferdie_network_starter) = run_primary_chain_validator_node( + tokio_handle.clone(), + Ferdie, + vec![], + BasePath::new(directory.path().join("ferdie")), + ) + .await; ferdie_network_starter.start_network(); // Run Alice (a secondary chain authority node) - let alice = domain_test_service::TestNodeBuilder::new(tokio_handle.clone(), Alice) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Authority, false, false) - .await; + let alice = domain_test_service::TestNodeBuilder::new( + tokio_handle.clone(), + Alice, + BasePath::new(directory.path().join("alice")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Authority, false, false) + .await; // Run Bob (a secondary chain full node) - let bob = domain_test_service::TestNodeBuilder::new(tokio_handle, Bob) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Full, false, false) - .await; + let bob = domain_test_service::TestNodeBuilder::new( + tokio_handle, + Bob, + BasePath::new(directory.path().join("bob")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Full, false, false) + .await; // Bob is able to sync blocks. futures::future::join(alice.wait_for_blocks(3), bob.wait_for_blocks(3)).await; @@ -73,6 +89,8 @@ async fn test_executor_full_node_catching_up() { #[substrate_test_utils::test(flavor = "multi_thread")] #[ignore] async fn fraud_proof_verification_in_tx_pool_should_work() { + let directory = TempDir::new().expect("Must be able to create temporary directory"); + let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_colors(false); let _ = builder.init(); @@ -80,15 +98,24 @@ async fn fraud_proof_verification_in_tx_pool_should_work() { let tokio_handle = tokio::runtime::Handle::current(); // Start Ferdie - let (ferdie, ferdie_network_starter) = - run_primary_chain_validator_node(tokio_handle.clone(), Ferdie, vec![]).await; + let (ferdie, ferdie_network_starter) = run_primary_chain_validator_node( + tokio_handle.clone(), + Ferdie, + vec![], + BasePath::new(directory.path().join("ferdie")), + ) + .await; ferdie_network_starter.start_network(); // Run Alice (a secondary chain authority node) - let alice = domain_test_service::TestNodeBuilder::new(tokio_handle.clone(), Alice) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Authority, false, true) - .await; + let alice = domain_test_service::TestNodeBuilder::new( + tokio_handle.clone(), + Alice, + BasePath::new(directory.path().join("alice")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Authority, false, true) + .await; alice.wait_for_blocks(3).await; @@ -124,7 +151,7 @@ async fn fraud_proof_verification_in_tx_pool_should_work() { let storage_proof = prover .prove_execution::>( - BlockId::Hash(parent_header.hash()), + parent_header.hash(), &execution_phase, None, ) @@ -203,6 +230,8 @@ async fn fraud_proof_verification_in_tx_pool_should_work() { #[substrate_test_utils::test(flavor = "multi_thread")] #[ignore] async fn set_new_code_should_work() { + let directory = TempDir::new().expect("Must be able to create temporary directory"); + let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_colors(false); let _ = builder.init(); @@ -210,15 +239,24 @@ async fn set_new_code_should_work() { let tokio_handle = tokio::runtime::Handle::current(); // Start Ferdie - let (ferdie, ferdie_network_starter) = - run_primary_chain_validator_node(tokio_handle.clone(), Ferdie, vec![]).await; + let (ferdie, ferdie_network_starter) = run_primary_chain_validator_node( + tokio_handle.clone(), + Ferdie, + vec![], + BasePath::new(directory.path().join("ferdie")), + ) + .await; ferdie_network_starter.start_network(); // Run Alice (a secondary chain authority node) - let alice = domain_test_service::TestNodeBuilder::new(tokio_handle.clone(), Alice) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Authority, false, false) - .await; + let alice = domain_test_service::TestNodeBuilder::new( + tokio_handle.clone(), + Alice, + BasePath::new(directory.path().join("alice")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Authority, false, false) + .await; ferdie.wait_for_blocks(1).await; @@ -253,11 +291,8 @@ async fn set_new_code_should_work() { .await; let best_hash = alice.client.info().best_hash; - let state = alice - .backend - .state_at(BlockId::Hash(best_hash)) - .expect("Get state"); - let trie_backend = state.as_trie_backend().unwrap(); + let state = alice.backend.state_at(best_hash).expect("Get state"); + let trie_backend = state.as_trie_backend(); let state_runtime_code = sp_state_machine::backend::BackendRuntimeCode::new(trie_backend); let runtime_code = state_runtime_code.fetch_runtime_code().unwrap(); let logs = alice @@ -270,7 +305,7 @@ async fn set_new_code_should_work() { if logs != vec![DigestItem::RuntimeEnvironmentUpdated] { let extrinsics = alice .client - .block_body(&BlockId::Hash(best_hash)) + .block_body(best_hash) .unwrap() .unwrap() .into_iter() @@ -286,6 +321,8 @@ async fn set_new_code_should_work() { #[substrate_test_utils::test(flavor = "multi_thread")] #[ignore] async fn pallet_domains_unsigned_extrinsics_should_work() { + let directory = TempDir::new().expect("Must be able to create temporary directory"); + let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_colors(false); let _ = builder.init(); @@ -293,17 +330,26 @@ async fn pallet_domains_unsigned_extrinsics_should_work() { let tokio_handle = tokio::runtime::Handle::current(); // Start Ferdie - let (ferdie, ferdie_network_starter) = - run_primary_chain_validator_node(tokio_handle.clone(), Ferdie, vec![]).await; + let (ferdie, ferdie_network_starter) = run_primary_chain_validator_node( + tokio_handle.clone(), + Ferdie, + vec![], + BasePath::new(directory.path().join("ferdie")), + ) + .await; ferdie_network_starter.start_network(); // Run Alice (a secondary chain full node) // Run a full node deliberately in order to control the execution chain by // submitting the receipts manually later. - let alice = domain_test_service::TestNodeBuilder::new(tokio_handle.clone(), Alice) - .connect_to_primary_chain_node(&ferdie) - .build(Role::Full, false, false) - .await; + let alice = domain_test_service::TestNodeBuilder::new( + tokio_handle.clone(), + Alice, + BasePath::new(directory.path().join("alice")), + ) + .connect_to_primary_chain_node(&ferdie) + .build(Role::Full, false, false) + .await; alice.wait_for_blocks(2).await; diff --git a/domains/client/executor-gossip/Cargo.toml b/domains/client/executor-gossip/Cargo.toml index 8f3dc6474de..e9effc80931 100644 --- a/domains/client/executor-gossip/Cargo.toml +++ b/domains/client/executor-gossip/Cargo.toml @@ -6,11 +6,12 @@ edition = "2021" [dependencies] # Substrate dependencies -sc-network = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network-gossip = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-utils = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-network = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-common = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-gossip = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-utils = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" parity-scale-codec = { version = "3.1.5", features = ["derive"] } diff --git a/domains/client/executor-gossip/src/lib.rs b/domains/client/executor-gossip/src/lib.rs index e238f0073f7..0cc14b003ab 100644 --- a/domains/client/executor-gossip/src/lib.rs +++ b/domains/client/executor-gossip/src/lib.rs @@ -3,7 +3,9 @@ mod worker; use self::worker::GossipWorker; use parity_scale_codec::{Decode, Encode}; use parking_lot::{Mutex, RwLock}; -use sc_network::{ObservedRole, PeerId}; +use sc_network::PeerId; +use sc_network_common::config::NonDefaultSetConfig; +use sc_network_common::protocol::role::ObservedRole; use sc_network_gossip::{ GossipEngine, MessageIntent, Network as GossipNetwork, ValidationResult, Validator, ValidatorContext, @@ -30,9 +32,8 @@ const REBROADCAST_AFTER: Duration = Duration::from_secs(6); type MessageHash = [u8; 8]; /// Returns the configuration value to put in [`sc_network::config::NetworkConfiguration::extra_sets`]. -pub fn executor_gossip_peers_set_config() -> sc_network::config::NonDefaultSetConfig { - let mut cfg = - sc_network::config::NonDefaultSetConfig::new(EXECUTOR_PROTOCOL_NAME.into(), 1024 * 1024); +pub fn executor_gossip_peers_set_config() -> NonDefaultSetConfig { + let mut cfg = NonDefaultSetConfig::new(EXECUTOR_PROTOCOL_NAME.into(), 1024 * 1024); cfg.allow_non_reserved(25, 25); cfg } diff --git a/domains/client/relayer/Cargo.toml b/domains/client/relayer/Cargo.toml index 453a20c84cf..fd07e6a4b05 100644 --- a/domains/client/relayer/Cargo.toml +++ b/domains/client/relayer/Cargo.toml @@ -13,16 +13,16 @@ include = [ [dependencies] # Substrate dependencies -sc-client-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network-gossip = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-utils = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-client-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-gossip = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-utils = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" parity-scale-codec = { version = "3.1.5", features = ["derive"] } diff --git a/domains/client/relayer/src/lib.rs b/domains/client/relayer/src/lib.rs index afe340ec5b8..0e3606d4d98 100644 --- a/domains/client/relayer/src/lib.rs +++ b/domains/client/relayer/src/lib.rs @@ -101,13 +101,12 @@ where block_hash: Block::Hash, key: &StorageKey, ) -> Result, Block::Hash>, Error> { - let block_id = BlockId::Hash(block_hash); system_domain_client - .header(block_id)? + .header(BlockId::Hash(block_hash))? .map(|header| *header.state_root()) .and_then(|state_root| { let proof = system_domain_client - .read_proof(&block_id, &mut [key.as_ref()].into_iter()) + .read_proof(block_hash, &mut [key.as_ref()].into_iter()) .ok()?; Some(Proof { state_root, @@ -125,13 +124,12 @@ where key: &StorageKey, core_domain_proof: StorageProof, ) -> Result, Block::Hash>, Error> { - let block_id = BlockId::Hash(block_hash); core_domain_client - .header(block_id)? + .header(BlockId::Hash(block_hash))? .map(|header| (*header.number(), *header.state_root())) .and_then(|(number, state_root)| { let proof = core_domain_client - .read_proof(&block_id, &mut [key.as_ref()].into_iter()) + .read_proof(block_hash, &mut [key.as_ref()].into_iter()) .ok()?; Some(Proof { state_root, @@ -296,8 +294,8 @@ where // and generate proof let core_domain_state_root_proof = { let system_domain_api = system_domain_client.runtime_api(); - let latest_system_domain_block_id = - BlockId::Hash(system_domain_client.info().best_hash); + let latest_system_domain_block_hash = system_domain_client.info().best_hash; + let latest_system_domain_block_id = BlockId::Hash(latest_system_domain_block_hash); let core_domain_id = Self::domain_id(core_domain_client)?; let confirmed_block_number = *core_domain_client .header(BlockId::Hash(confirmed_block_hash))? @@ -311,7 +309,7 @@ where Some(storage_key) => { // construct storage proof for the core domain state root using system domain backend. system_domain_client.read_proof( - &latest_system_domain_block_id, + latest_system_domain_block_hash, &mut [storage_key.as_ref()].into_iter(), )? } diff --git a/domains/pallets/domain-registry/Cargo.toml b/domains/pallets/domain-registry/Cargo.toml index cccb4154a21..0ab523fa02a 100644 --- a/domains/pallets/domain-registry/Cargo.toml +++ b/domains/pallets/domain-registry/Cargo.toml @@ -13,22 +13,22 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -frame-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +frame-support = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +frame-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } serde = { version = "1.0.143", optional = true } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } sp-domains = { version = "0.1.0", path = "../../../crates/sp-domains", default-features = false } sp-executor-registry = { version = "0.1.0", path = "../../primitives/executor-registry", default-features = false } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-std = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-std = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } [dev-dependencies] -pallet-balances = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-executor-registry = { path = "../executor-registry" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/pallets/domain-registry/src/lib.rs b/domains/pallets/domain-registry/src/lib.rs index eb5ff6474d4..6f91d5ea053 100644 --- a/domains/pallets/domain-registry/src/lib.rs +++ b/domains/pallets/domain-registry/src/lib.rs @@ -58,7 +58,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; type Currency: LockableCurrency; @@ -423,6 +423,7 @@ mod pallet { } } + #[cfg(feature = "std")] type GenesisDomainInfo = ( ::AccountId, BalanceOf, diff --git a/domains/pallets/domain-registry/src/tests.rs b/domains/pallets/domain-registry/src/tests.rs index 90ba7c9b0bd..d1595e0f508 100644 --- a/domains/pallets/domain-registry/src/tests.rs +++ b/domains/pallets/domain-registry/src/tests.rs @@ -2,6 +2,7 @@ use crate::{ self as pallet_domain_registry, DomainAuthorities, DomainCreators, DomainOperators, DomainTotalStakeWeight, Domains, Error, NextDomainId, }; +use frame_support::dispatch::Weight; use frame_support::traits::{ConstU16, ConstU32, ConstU64, GenesisBuild, Hooks}; use frame_support::{assert_noop, assert_ok, parameter_types}; use pallet_balances::AccountData; @@ -41,8 +42,8 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = BlockNumber; type Hash = Hash; @@ -50,7 +51,7 @@ impl frame_system::Config for Test { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<2>; type Version = (); type PalletInfo = PalletInfo; @@ -73,7 +74,7 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = [u8; 8]; type Balance = Balance; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = (); @@ -90,7 +91,7 @@ parameter_types! { } impl pallet_executor_registry::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type StakeWeight = StakeWeight; type MinExecutorStake = MinExecutorStake; @@ -112,7 +113,7 @@ parameter_types! { } impl pallet_domain_registry::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type StakeWeight = StakeWeight; type ExecutorRegistry = ExecutorRegistry; @@ -168,7 +169,7 @@ fn new_test_ext() -> sp_io::TestExternalities { wasm_runtime_hash: Hash::repeat_byte(1), bundle_frequency: 100, max_bundle_size: 1024 * 1024, - max_bundle_weight: 100_000_000_000, + max_bundle_weight: Weight::from_ref_time(100_000_000_000), min_operator_stake: 20, }, 1, @@ -189,7 +190,7 @@ fn create_domain_should_work() { wasm_runtime_hash: Hash::repeat_byte(1), bundle_frequency: 100, max_bundle_size: 1024 * 1024, - max_bundle_weight: 100_000_000_000, + max_bundle_weight: Weight::from_ref_time(100_000_000_000), min_operator_stake: 20, }; assert_eq!( @@ -203,25 +204,25 @@ fn create_domain_should_work() { wasm_runtime_hash: Hash::random(), bundle_frequency: 100, max_bundle_size: 1024 * 1024, - max_bundle_weight: 100_000_000_000, + max_bundle_weight: Weight::from_ref_time(100_000_000_000), min_operator_stake: 20, }; assert_noop!( - DomainRegistry::create_domain(Origin::signed(1), 1, domain_config.clone()), + DomainRegistry::create_domain(RuntimeOrigin::signed(1), 1, domain_config.clone()), Error::::DepositTooSmall ); assert_noop!( - DomainRegistry::create_domain(Origin::signed(1), 10_000, domain_config.clone()), + DomainRegistry::create_domain(RuntimeOrigin::signed(1), 10_000, domain_config.clone()), Error::::DepositTooLarge ); assert_noop!( - DomainRegistry::create_domain(Origin::signed(8), 100, domain_config.clone()), + DomainRegistry::create_domain(RuntimeOrigin::signed(8), 100, domain_config.clone()), Error::::InsufficientBalance ); assert_noop!( DomainRegistry::create_domain( - Origin::signed(1), + RuntimeOrigin::signed(1), 100, DomainConfig { min_operator_stake: 1, @@ -234,7 +235,7 @@ fn create_domain_should_work() { let (creator, deposit) = (2, 200); let next_domain_id = NextDomainId::::get(); assert_ok!(DomainRegistry::create_domain( - Origin::signed(creator), + RuntimeOrigin::signed(creator), deposit, domain_config.clone(), )); @@ -267,7 +268,7 @@ fn register_domain_operator_and_update_domain_stake_should_work() { assert_noop!( DomainRegistry::update_domain_stake( - Origin::signed(1), + RuntimeOrigin::signed(1), DomainId::from(0), Percent::from_percent(10), ), @@ -275,7 +276,7 @@ fn register_domain_operator_and_update_domain_stake_should_work() { ); assert_ok!(DomainRegistry::update_domain_stake( - Origin::signed(1), + RuntimeOrigin::signed(1), DomainId::from(0), Percent::from_percent(20), )); @@ -286,13 +287,13 @@ fn register_domain_operator_and_update_domain_stake_should_work() { ); assert_ok!(DomainRegistry::create_domain( - Origin::signed(2), + RuntimeOrigin::signed(2), 200, DomainConfig { wasm_runtime_hash: Hash::random(), bundle_frequency: 100, max_bundle_size: 1024 * 1024, - max_bundle_weight: 100_000_000_000, + max_bundle_weight: Weight::from_ref_time(100_000_000_000), min_operator_stake: 20, } )); @@ -300,7 +301,7 @@ fn register_domain_operator_and_update_domain_stake_should_work() { // only 80% is available. assert_noop!( DomainRegistry::register_domain_operator( - Origin::signed(1), + RuntimeOrigin::signed(1), DomainId::from(1), Percent::from_percent(90), ), @@ -308,13 +309,13 @@ fn register_domain_operator_and_update_domain_stake_should_work() { ); assert_ok!(DomainRegistry::register_domain_operator( - Origin::signed(1), + RuntimeOrigin::signed(1), DomainId::from(1), Percent::from_percent(80), )); assert_ok!(DomainRegistry::register_domain_operator( - Origin::signed(2), + RuntimeOrigin::signed(2), DomainId::from(0), Percent::from_percent(50), )); @@ -326,7 +327,7 @@ fn register_domain_operator_and_update_domain_stake_should_work() { assert_noop!( DomainRegistry::register_domain_operator( - Origin::signed(8), + RuntimeOrigin::signed(8), DomainId::from(1), Percent::from_percent(30), ), @@ -339,18 +340,18 @@ fn register_domain_operator_and_update_domain_stake_should_work() { fn deregister_domain_operator_should_work() { new_test_ext().execute_with(|| { assert_noop!( - DomainRegistry::deregister_domain_operator(Origin::signed(3), DomainId::from(0)), + DomainRegistry::deregister_domain_operator(RuntimeOrigin::signed(3), DomainId::from(0)), Error::::NotOperator ); assert_ok!(DomainRegistry::register_domain_operator( - Origin::signed(2), + RuntimeOrigin::signed(2), DomainId::from(0), Percent::from_percent(50), )); assert_ok!(DomainRegistry::deregister_domain_operator( - Origin::signed(1), + RuntimeOrigin::signed(1), DomainId::from(0) )); @@ -372,13 +373,13 @@ fn rotate_domain_authorities_should_work() { ); assert_ok!(DomainRegistry::register_domain_operator( - Origin::signed(2), + RuntimeOrigin::signed(2), DomainId::from(0), Percent::from_percent(20), )); assert_ok!(DomainRegistry::register_domain_operator( - Origin::signed(3), + RuntimeOrigin::signed(3), DomainId::from(0), Percent::from_percent(30), )); diff --git a/domains/pallets/domain-tracker/Cargo.toml b/domains/pallets/domain-tracker/Cargo.toml index a60b20267e3..934e1cebc27 100644 --- a/domains/pallets/domain-tracker/Cargo.toml +++ b/domains/pallets/domain-tracker/Cargo.toml @@ -15,20 +15,20 @@ include = [ [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", default-features = false, path = "../../../crates/sp-domains" } sp-domain-tracker = { version = "0.1.0", default-features = false, path = "../../primitives/domain-tracker" } sp-messenger = { version = "0.1.0", default-features = false, path = "../../primitives/messenger" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } system-runtime-primitives = { version = "0.1.0", default-features = false, path = "../../primitives/system-runtime" } [dev-dependencies] -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/pallets/domain-tracker/src/lib.rs b/domains/pallets/domain-tracker/src/lib.rs index d9576154bf5..5c27ab34c91 100644 --- a/domains/pallets/domain-tracker/src/lib.rs +++ b/domains/pallets/domain-tracker/src/lib.rs @@ -45,7 +45,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// Event type for this pallet. - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Total number of confirmed state roots to store at a time. type StateRootsBound: Get; diff --git a/domains/pallets/domain-tracker/src/mock.rs b/domains/pallets/domain-tracker/src/mock.rs index c36d0e9e884..a143afb5bfc 100644 --- a/domains/pallets/domain-tracker/src/mock.rs +++ b/domains/pallets/domain-tracker/src/mock.rs @@ -1,6 +1,6 @@ +use frame_support::parameter_types; use frame_support::traits::{ConstU16, ConstU32, ConstU64}; use sp_core::H256; -use sp_runtime::parameter_types; use sp_runtime::testing::Header; use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; @@ -24,8 +24,8 @@ impl frame_system::Config for MockRuntime { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -33,7 +33,7 @@ impl frame_system::Config for MockRuntime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); type PalletInfo = PalletInfo; @@ -51,7 +51,7 @@ parameter_types! { } impl crate::Config for MockRuntime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type StateRootsBound = StateRootsBound; } diff --git a/domains/pallets/domain-tracker/src/tests.rs b/domains/pallets/domain-tracker/src/tests.rs index 31f33b0fd46..64bda87e2cc 100644 --- a/domains/pallets/domain-tracker/src/tests.rs +++ b/domains/pallets/domain-tracker/src/tests.rs @@ -1,4 +1,4 @@ -use crate::mock::{new_test_ext, DomainTracker, MockRuntime, Origin, StateRootsBound}; +use crate::mock::{new_test_ext, DomainTracker, MockRuntime, RuntimeOrigin, StateRootsBound}; use crate::pallet::{CoreDomainsStateRoot, SystemDomainStateRoots}; use crate::Error; use frame_support::{assert_err, assert_ok}; @@ -17,7 +17,7 @@ fn test_update_state_root() { assert!(!DomainTracker::state_roots_updated()); let res = DomainTracker::update_system_domain_state_root( - Origin::none(), + RuntimeOrigin::none(), data.system_domain_state_root, ); assert_ok!(res); @@ -29,7 +29,7 @@ fn test_update_state_root() { // cannot update twice in same block let res = DomainTracker::update_system_domain_state_root( - Origin::none(), + RuntimeOrigin::none(), data.system_domain_state_root, ); assert_err!(res, Error::::StateRootsAlreadyUpdated) @@ -54,7 +54,7 @@ fn test_state_roots_bounded() { assert!(!DomainTracker::state_roots_updated()); let res = DomainTracker::update_system_domain_state_root( - Origin::none(), + RuntimeOrigin::none(), data.system_domain_state_root, ); assert_ok!(res); diff --git a/domains/pallets/executive/Cargo.toml b/domains/pallets/executive/Cargo.toml index 07a0752ce2a..deaf2f74cee 100644 --- a/domains/pallets/executive/Cargo.toml +++ b/domains/pallets/executive/Cargo.toml @@ -13,24 +13,24 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-executive = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -frame-support = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -frame-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +frame-executive = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +frame-support = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +frame-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-io = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-std = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-tracing = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-io = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-std = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-tracing = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } [dev-dependencies] hex-literal = "0.3.4" -pallet-balances = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-version = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-version = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/pallets/executive/src/lib.rs b/domains/pallets/executive/src/lib.rs index d1007a079e9..a850d12945c 100644 --- a/domains/pallets/executive/src/lib.rs +++ b/domains/pallets/executive/src/lib.rs @@ -24,12 +24,12 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::Codec; -use frame_support::dispatch::PostDispatchInfo; +use frame_support::dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, PostDispatchInfo}; use frame_support::traits::{ EnsureInherentsAreFirst, ExecuteBlock, Get, OffchainWorker, OnFinalize, OnIdle, OnInitialize, OnRuntimeUpgrade, }; -use frame_support::weights::{DispatchClass, DispatchInfo, GetDispatchInfo}; +use frame_support::weights::Weight; pub use pallet::*; use sp_runtime::traits::{ self, Applyable, CheckEqual, Checkable, Dispatchable, Header, NumberFor, One, ValidateUnsigned, @@ -42,23 +42,25 @@ use sp_std::prelude::*; pub type CheckedOf = >::Checked; pub type CallOf = as Applyable>::Call; -pub type OriginOf = as Dispatchable>::Origin; +pub type OriginOf = as Dispatchable>::RuntimeOrigin; // TODO: not store the intermediate storage root in the state but // calculate the storage root outside the runtime after executing the extrinsic directly. #[frame_support::pallet] mod pallet { + use frame_support::dispatch::GetDispatchInfo; use frame_support::pallet_prelude::*; use frame_support::traits::UnfilteredDispatchable; - use frame_support::weights::GetDispatchInfo; use frame_system::pallet_prelude::*; use sp_std::boxed::Box; use sp_std::vec::Vec; #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; - type Call: Parameter + UnfilteredDispatchable + GetDispatchInfo; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + type Call: Parameter + + UnfilteredDispatchable + + GetDispatchInfo; } #[pallet::pallet] @@ -98,7 +100,8 @@ mod pallet { fn on_initialize(_block_number: T::BlockNumber) -> Weight { // Reset the intermediate storage roots from last block. IntermediateRoots::::kill(); - 1 + // TODO: Probably needs a different value + Weight::from_ref_time(1) } } @@ -221,7 +224,7 @@ where } /// Wrapped `frame_executive::Executive::execute_on_runtime_upgrade`. - pub fn execute_on_runtime_upgrade() -> frame_support::weights::Weight { + pub fn execute_on_runtime_upgrade() -> Weight { frame_executive::Executive::< System, Block, @@ -234,7 +237,7 @@ where /// Wrapped `frame_executive::Executive::execute_block_no_check`. #[cfg(feature = "try-runtime")] - pub fn execute_block_no_check(block: Block) -> frame_support::weights::Weight { + pub fn execute_block_no_check(block: Block) -> Weight { frame_executive::Executive::< System, Block, @@ -247,7 +250,7 @@ where /// Wrapped `frame_executive::Executive::try_runtime_upgrade`. #[cfg(feature = "try-runtime")] - pub fn try_runtime_upgrade() -> Result { + pub fn try_runtime_upgrade() -> Result { frame_executive::Executive::< System, Block, @@ -360,7 +363,7 @@ where let max_weight = >::get().max_block; let remaining_weight = max_weight.saturating_sub(weight.total()); - if remaining_weight > 0 { + if remaining_weight.all_gt(Weight::zero()) { let used_weight = >::on_idle( block_number, remaining_weight, diff --git a/domains/pallets/executor-registry/Cargo.toml b/domains/pallets/executor-registry/Cargo.toml index 95b54f094cb..17e069886c6 100644 --- a/domains/pallets/executor-registry/Cargo.toml +++ b/domains/pallets/executor-registry/Cargo.toml @@ -13,19 +13,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -frame-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +frame-support = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +frame-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-arithmetic = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +sp-arithmetic = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } sp-domains = { version = "0.1.0", path = "../../../crates/sp-domains", default-features = false } sp-executor-registry = { version = "0.1.0", path = "../../primitives/executor-registry", default-features = false } -sp-io = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-std = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +sp-io = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-std = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } [dev-dependencies] -pallet-balances = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/pallets/executor-registry/src/lib.rs b/domains/pallets/executor-registry/src/lib.rs index c5af49627d9..cc022778ad5 100644 --- a/domains/pallets/executor-registry/src/lib.rs +++ b/domains/pallets/executor-registry/src/lib.rs @@ -54,7 +54,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; type Currency: LockableCurrency; @@ -483,6 +483,7 @@ mod pallet { } } + #[cfg(feature = "std")] type GenesisExecutorInfo = ( ::AccountId, BalanceOf, diff --git a/domains/pallets/executor-registry/src/tests.rs b/domains/pallets/executor-registry/src/tests.rs index c869fbde581..efce7fb4651 100644 --- a/domains/pallets/executor-registry/src/tests.rs +++ b/domains/pallets/executor-registry/src/tests.rs @@ -37,8 +37,8 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = BlockNumber; type Hash = Hash; @@ -46,7 +46,7 @@ impl frame_system::Config for Test { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<2>; type Version = (); type PalletInfo = PalletInfo; @@ -69,7 +69,7 @@ impl pallet_balances::Config for Test { type ReserveIdentifier = [u8; 8]; type Balance = Balance; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type WeightInfo = (); @@ -86,7 +86,7 @@ parameter_types! { } impl pallet_executor_registry::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type StakeWeight = StakeWeight; type MinExecutorStake = MinExecutorStake; @@ -145,7 +145,7 @@ fn register_should_work() { assert_noop!( ExecutorRegistry::register( - Origin::signed(1), + RuntimeOrigin::signed(1), public_key.clone(), reward_address, is_active, @@ -155,7 +155,7 @@ fn register_should_work() { ); assert_noop!( ExecutorRegistry::register( - Origin::signed(1), + RuntimeOrigin::signed(1), public_key.clone(), reward_address, true, @@ -165,7 +165,7 @@ fn register_should_work() { ); assert_noop!( ExecutorRegistry::register( - Origin::signed(8), + RuntimeOrigin::signed(8), public_key.clone(), reward_address, true, @@ -175,7 +175,7 @@ fn register_should_work() { ); assert_noop!( ExecutorRegistry::register( - Origin::signed(1), + RuntimeOrigin::signed(1), public_key.clone(), reward_address, true, @@ -185,7 +185,7 @@ fn register_should_work() { ); assert_ok!(ExecutorRegistry::register( - Origin::signed(2), + RuntimeOrigin::signed(2), public_key.clone(), reward_address, is_active, @@ -230,7 +230,10 @@ fn stake_extra_should_work() { } ); let extra = 200; - assert_ok!(ExecutorRegistry::increase_stake(Origin::signed(1), extra)); + assert_ok!(ExecutorRegistry::increase_stake( + RuntimeOrigin::signed(1), + extra + )); assert_eq!( Executors::::get(1).unwrap(), ExecutorConfig { @@ -265,18 +268,18 @@ fn decrease_and_withdraw_stake_should_work() { } ); assert_noop!( - ExecutorRegistry::decrease_stake(Origin::signed(1), 1000), + ExecutorRegistry::decrease_stake(RuntimeOrigin::signed(1), 1000), Error::::InsufficientStake ); assert_noop!( - ExecutorRegistry::decrease_stake(Origin::signed(1), Balance::MAX), + ExecutorRegistry::decrease_stake(RuntimeOrigin::signed(1), Balance::MAX), Error::::InsufficientStake ); let executor_config = Executors::::get(1).unwrap(); let to_decrease = 10; assert_ok!(ExecutorRegistry::decrease_stake( - Origin::signed(1), + RuntimeOrigin::signed(1), to_decrease )); @@ -304,14 +307,14 @@ fn decrease_and_withdraw_stake_should_work() { System::set_block_number(11); assert_noop!( - ExecutorRegistry::withdraw_decreased_stake(Origin::signed(1), 0), + ExecutorRegistry::withdraw_decreased_stake(RuntimeOrigin::signed(1), 0), Error::::PrematureWithdrawal ); System::set_block_number(12); let executor_config = Executors::::get(1).unwrap(); assert_ok!(ExecutorRegistry::withdraw_decreased_stake( - Origin::signed(1), + RuntimeOrigin::signed(1), 0 )); assert_eq!( @@ -337,7 +340,7 @@ fn decrease_and_withdraw_stake_should_work() { fn pause_and_resume_execution_should_work() { new_test_ext().execute_with(|| { assert_noop!( - ExecutorRegistry::pause_execution(Origin::signed(1)), + ExecutorRegistry::pause_execution(RuntimeOrigin::signed(1)), Error::::TooFewActiveExecutors ); @@ -347,7 +350,7 @@ fn pause_and_resume_execution_should_work() { let stake = 200; assert_ok!(ExecutorRegistry::register( - Origin::signed(2), + RuntimeOrigin::signed(2), public_key, reward_address, is_active, @@ -357,12 +360,12 @@ fn pause_and_resume_execution_should_work() { assert_eq!(TotalActiveStake::::get(), 100); assert_eq!(TotalActiveExecutors::::get(), 1); - assert_ok!(ExecutorRegistry::resume_execution(Origin::signed(2))); + assert_ok!(ExecutorRegistry::resume_execution(RuntimeOrigin::signed(2))); assert_eq!(TotalActiveStake::::get(), 100 + 200); assert_eq!(TotalActiveExecutors::::get(), 2); - assert_ok!(ExecutorRegistry::pause_execution(Origin::signed(2))); + assert_ok!(ExecutorRegistry::pause_execution(RuntimeOrigin::signed(2))); assert_eq!(TotalActiveStake::::get(), 100); assert_eq!(TotalActiveExecutors::::get(), 1); @@ -374,7 +377,7 @@ fn update_reward_address_should_work() { new_test_ext().execute_with(|| { let executor_config = Executors::::get(1).unwrap(); assert_ok!(ExecutorRegistry::update_reward_address( - Origin::signed(1), + RuntimeOrigin::signed(1), 888 )); assert_eq!( diff --git a/domains/pallets/messenger/Cargo.toml b/domains/pallets/messenger/Cargo.toml index b574207b8f7..02ef59f6fc5 100644 --- a/domains/pallets/messenger/Cargo.toml +++ b/domains/pallets/messenger/Cargo.toml @@ -15,25 +15,25 @@ include = [ [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } hash-db = { version = "0.15.2", default-features = false } hex = { version = "0.4.3", default-features = false, features = ["alloc"] } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", default-features = false, path = "../../../crates/sp-domains" } sp-messenger = { version = "0.1.0", default-features = false, path = "../../primitives/messenger" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [dev-dependencies] -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-domain-tracker = { version = "0.1.0", path = "../domain-tracker" } pallet-transporter = { version = "0.1.0", path = "../transporter" } -sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-state-machine = { version = "0.12.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-state-machine = { version = "0.12.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/pallets/messenger/src/lib.rs b/domains/pallets/messenger/src/lib.rs index cbba975bf83..b1c9ffd43aa 100644 --- a/domains/pallets/messenger/src/lib.rs +++ b/domains/pallets/messenger/src/lib.rs @@ -110,7 +110,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Gets the domain_id that is treated as src_domain for outgoing messages. type SelfDomainId: Get; /// System domain tracker. @@ -413,7 +413,7 @@ mod pallet { let results = RelayerMessages::::clear(u32::MAX, None); let db_weight = T::DbWeight::get(); db_weight - .reads(results.loops as Weight) + .reads(results.loops as u64) .saturating_add(db_weight.writes(1)) } } diff --git a/domains/pallets/messenger/src/mock.rs b/domains/pallets/messenger/src/mock.rs index 3b7f97b7161..f35a74b15bc 100644 --- a/domains/pallets/messenger/src/mock.rs +++ b/domains/pallets/messenger/src/mock.rs @@ -52,8 +52,8 @@ macro_rules! impl_runtime { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -61,7 +61,7 @@ macro_rules! impl_runtime { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); type PalletInfo = PalletInfo; @@ -83,7 +83,7 @@ macro_rules! impl_runtime { } impl pallet_domain_tracker::Config for $runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type StateRootsBound = StateRootsBound; } @@ -94,7 +94,7 @@ macro_rules! impl_runtime { } impl crate::Config for $runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SelfDomainId = SelfDomainId; type DomainTracker = DomainTracker; type MaximumRelayers = MaximumRelayers; @@ -118,7 +118,7 @@ macro_rules! impl_runtime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type MaxLocks = (); type MaxReserves = (); @@ -131,7 +131,7 @@ macro_rules! impl_runtime { } impl pallet_transporter::Config for $runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SelfDomainId = SelfDomainId; type SelfEndpointId = TransporterEndpointId; type Currency = Balances; @@ -163,7 +163,7 @@ macro_rules! impl_runtime { // add a relayer to messenger t.execute_with(|| { - let res = Messenger::join_relayer_set(Origin::signed(RELAYER_OWNER_ACCOUNT), RELAYER_ID); + let res = Messenger::join_relayer_set(RuntimeOrigin::signed(RELAYER_OWNER_ACCOUNT), RELAYER_ID); assert_ok!(res); }); t @@ -213,7 +213,7 @@ fn storage_proof_for_key( ) -> (StateRootOf, StorageProof) { let state_version = sp_runtime::StateVersion::default(); let root = backend.storage_root(std::iter::empty(), state_version).0; - let proof = StorageProof::new(prove_read(backend, &[key]).unwrap().iter_nodes()); + let proof = StorageProof::new(prove_read(backend, &[key]).unwrap().iter_nodes().cloned()); (root, proof) } diff --git a/domains/pallets/messenger/src/tests.rs b/domains/pallets/messenger/src/tests.rs index 4947e2983ec..876a1204d33 100644 --- a/domains/pallets/messenger/src/tests.rs +++ b/domains/pallets/messenger/src/tests.rs @@ -1,6 +1,6 @@ use crate::mock::domain_a::{ - new_test_ext as new_domain_a_ext, Event, Messenger, Origin, RelayerDeposit, Runtime, System, - RELAYER_ID, + new_test_ext as new_domain_a_ext, Messenger, RelayerDeposit, Runtime, RuntimeEvent, + RuntimeOrigin, System, RELAYER_ID, }; use crate::mock::{ domain_a, domain_b, storage_proof_of_inbox_message_responses, storage_proof_of_outbox_messages, @@ -31,12 +31,12 @@ fn create_channel(domain_id: DomainId, channel_id: ChannelId, fee_model: FeeMode fee_model, }; assert_ok!(Messenger::initiate_channel( - Origin::root(), + RuntimeOrigin::root(), domain_id, params, )); - System::assert_has_event(Event::Messenger( + System::assert_has_event(RuntimeEvent::Messenger( crate::Event::::ChannelInitiated { domain_id, channel_id, @@ -63,12 +63,14 @@ fn create_channel(domain_id: DomainId, channel_id: ChannelId, fee_model: FeeMode ))) ); - System::assert_last_event(Event::Messenger(crate::Event::::OutboxMessage { - domain_id, - channel_id, - nonce: Nonce::zero(), - relayer_id: RELAYER_ID, - })); + System::assert_last_event(RuntimeEvent::Messenger( + crate::Event::::OutboxMessage { + domain_id, + channel_id, + nonce: Nonce::zero(), + relayer_id: RELAYER_ID, + }, + )); // check outbox relayer storage key generation let messages_with_keys = domain_a::Messenger::relayer_assigned_messages(domain_a::RELAYER_ID); @@ -84,17 +86,19 @@ fn create_channel(domain_id: DomainId, channel_id: ChannelId, fee_model: FeeMode fn close_channel(domain_id: DomainId, channel_id: ChannelId, last_delivered_nonce: Option) { assert_ok!(Messenger::close_channel( - Origin::root(), + RuntimeOrigin::root(), domain_id, channel_id, )); let channel = Messenger::channels(domain_id, channel_id).unwrap(); assert_eq!(channel.state, ChannelState::Closed); - System::assert_has_event(Event::Messenger(crate::Event::::ChannelClosed { - domain_id, - channel_id, - })); + System::assert_has_event(RuntimeEvent::Messenger( + crate::Event::::ChannelClosed { + domain_id, + channel_id, + }, + )); let msg = Outbox::::get((domain_id, channel_id, Nonce::one())).unwrap(); assert_eq!(msg.dst_domain_id, domain_id); @@ -110,12 +114,14 @@ fn close_channel(domain_id: DomainId, channel_id: ChannelId, last_delivered_nonc ))) ); - System::assert_last_event(Event::Messenger(crate::Event::::OutboxMessage { - domain_id, - channel_id, - nonce: Nonce::one(), - relayer_id: RELAYER_ID, - })); + System::assert_last_event(RuntimeEvent::Messenger( + crate::Event::::OutboxMessage { + domain_id, + channel_id, + nonce: Nonce::one(), + relayer_id: RELAYER_ID, + }, + )); } #[test] @@ -133,7 +139,7 @@ fn test_close_missing_channel() { let domain_id = 2.into(); let channel_id = U256::zero(); assert_err!( - Messenger::close_channel(Origin::root(), domain_id, channel_id,), + Messenger::close_channel(RuntimeOrigin::root(), domain_id, channel_id,), Error::::MissingChannel ); }); @@ -146,7 +152,7 @@ fn test_close_not_open_channel() { let channel_id = U256::zero(); create_channel(domain_id, channel_id, Default::default()); assert_err!( - Messenger::close_channel(Origin::root(), domain_id, channel_id,), + Messenger::close_channel(RuntimeOrigin::root(), domain_id, channel_id,), Error::::InvalidChannelState ); }); @@ -163,10 +169,12 @@ fn test_close_open_channel() { assert_ok!(Messenger::do_open_channel(domain_id, channel_id)); let channel = Messenger::channels(domain_id, channel_id).unwrap(); assert_eq!(channel.state, ChannelState::Open); - System::assert_has_event(Event::Messenger(crate::Event::::ChannelOpen { - domain_id, - channel_id, - })); + System::assert_has_event(RuntimeEvent::Messenger( + crate::Event::::ChannelOpen { + domain_id, + channel_id, + }, + )); // close channel close_channel(domain_id, channel_id, None) @@ -281,13 +289,13 @@ fn open_channel_between_domains( domain_b_test_ext.execute_with(|| { let channel = domain_b::Messenger::channels(domain_a_id, channel_id).unwrap(); assert_eq!(channel.state, ChannelState::Open); - domain_b::System::assert_has_event(domain_b::Event::Messenger(crate::Event::< + domain_b::System::assert_has_event(domain_b::RuntimeEvent::Messenger(crate::Event::< domain_b::Runtime, >::ChannelInitiated { domain_id: domain_a_id, channel_id, })); - domain_b::System::assert_has_event(domain_b::Event::Messenger(crate::Event::< + domain_b::System::assert_has_event(domain_b::RuntimeEvent::Messenger(crate::Event::< domain_b::Runtime, >::ChannelOpen { domain_id: domain_a_id, @@ -320,7 +328,7 @@ fn open_channel_between_domains( ); assert_eq!(channel.next_inbox_nonce, Nonce::zero()); assert_eq!(channel.next_outbox_nonce, Nonce::one()); - domain_a::System::assert_has_event(domain_a::Event::Messenger(crate::Event::< + domain_a::System::assert_has_event(domain_a::RuntimeEvent::Messenger(crate::Event::< domain_a::Runtime, >::ChannelOpen { domain_id: domain_b_id, @@ -352,7 +360,7 @@ fn send_message_between_domains( }, ); assert_ok!(resp); - domain_a::System::assert_last_event(Event::Messenger( + domain_a::System::assert_last_event(RuntimeEvent::Messenger( crate::Event::::OutboxMessage { domain_id: domain_b_id, channel_id, @@ -420,7 +428,7 @@ fn close_channel_between_domains( domain_b_test_ext.execute_with(|| { let channel = domain_b::Messenger::channels(domain_a_id, channel_id).unwrap(); assert_eq!(channel.state, ChannelState::Closed); - domain_b::System::assert_has_event(domain_b::Event::Messenger(crate::Event::< + domain_b::System::assert_has_event(domain_b::RuntimeEvent::Messenger(crate::Event::< domain_b::Runtime, >::ChannelClosed { domain_id: domain_a_id, @@ -456,7 +464,7 @@ fn close_channel_between_domains( channel.next_outbox_nonce, Nonce::one().checked_add(Nonce::one()).unwrap() ); - domain_a::System::assert_has_event(domain_a::Event::Messenger(crate::Event::< + domain_a::System::assert_has_event(domain_a::RuntimeEvent::Messenger(crate::Event::< domain_a::Runtime, >::ChannelClosed { domain_id: domain_b_id, @@ -511,10 +519,10 @@ fn channel_relay_request_and_response( assert_ok!(pre_check); // process inbox message - let result = domain_b::Messenger::relay_message(domain_b::Origin::none(), xdm); + let result = domain_b::Messenger::relay_message(domain_b::RuntimeOrigin::none(), xdm); assert_ok!(result); - domain_b::System::assert_has_event(domain_b::Event::Messenger(crate::Event::< + domain_b::System::assert_has_event(domain_b::RuntimeEvent::Messenger(crate::Event::< domain_b::Runtime, >::InboxMessage { domain_id: domain_a_id, @@ -522,14 +530,14 @@ fn channel_relay_request_and_response( nonce, })); - domain_b::System::assert_has_event(domain_b::Event::Messenger(crate::Event::< - domain_b::Runtime, - >::InboxMessageResponse { - domain_id: domain_a_id, - channel_id, - nonce, - relayer_id: domain_b::RELAYER_ID, - })); + domain_b::System::assert_has_event(domain_b::RuntimeEvent::Messenger( + crate::Event::::InboxMessageResponse { + domain_id: domain_a_id, + channel_id, + nonce, + relayer_id: domain_b::RELAYER_ID, + }, + )); let response = domain_b::Messenger::inbox_responses((domain_a_id, channel_id, nonce)).unwrap(); @@ -573,7 +581,8 @@ fn channel_relay_request_and_response( assert_ok!(pre_check); // process outbox message response - let result = domain_a::Messenger::relay_message_response(domain_a::Origin::none(), xdm); + let result = + domain_a::Messenger::relay_message_response(domain_a::RuntimeOrigin::none(), xdm); assert_ok!(result); // outbox message and message response should not exists @@ -586,14 +595,14 @@ fn channel_relay_request_and_response( None ); - domain_a::System::assert_has_event(domain_a::Event::Messenger(crate::Event::< - domain_a::Runtime, - >::OutboxMessageResult { - domain_id: domain_b_id, - channel_id, - nonce, - result: OutboxMessageResult::Ok, - })); + domain_a::System::assert_has_event(domain_a::RuntimeEvent::Messenger( + crate::Event::::OutboxMessageResult { + domain_id: domain_b_id, + channel_id, + nonce, + result: OutboxMessageResult::Ok, + }, + )); }) } @@ -653,7 +662,7 @@ fn initiate_transfer_on_domain(domain_a_ext: &mut TestExternalities) { let account_id = 1; domain_a_ext.execute_with(|| { let res = domain_a::Transporter::transfer( - domain_a::Origin::signed(account_id), + domain_a::RuntimeOrigin::signed(account_id), Location { domain_id: domain_b::SelfDomainId::get(), account_id, @@ -661,13 +670,13 @@ fn initiate_transfer_on_domain(domain_a_ext: &mut TestExternalities) { 500, ); assert_ok!(res); - domain_a::System::assert_has_event(domain_a::Event::Transporter( + domain_a::System::assert_has_event(domain_a::RuntimeEvent::Transporter( pallet_transporter::Event::::OutgoingTransferInitiated { domain_id: domain_b::SelfDomainId::get(), message_id: (U256::zero(), U256::one()), }, )); - domain_a::System::assert_has_event(domain_a::Event::Messenger(crate::Event::< + domain_a::System::assert_has_event(domain_a::RuntimeEvent::Messenger(crate::Event::< domain_a::Runtime, >::OutboxMessage { domain_id: domain_b::SelfDomainId::get(), @@ -708,19 +717,19 @@ fn verify_transfer_on_domain( // empty state let account_id = 1; domain_a_ext.execute_with(|| { - domain_a::System::assert_has_event(domain_a::Event::Transporter( + domain_a::System::assert_has_event(domain_a::RuntimeEvent::Transporter( pallet_transporter::Event::::OutgoingTransferSuccessful { domain_id: domain_b::SelfDomainId::get(), message_id: (U256::zero(), U256::one()), }, )); - domain_a::System::assert_has_event(domain_a::Event::Messenger(crate::Event::< - domain_a::Runtime, - >::OutboxMessageResponse { - domain_id: domain_b::SelfDomainId::get(), - channel_id: U256::zero(), - nonce: U256::one(), - })); + domain_a::System::assert_has_event(domain_a::RuntimeEvent::Messenger( + crate::Event::::OutboxMessageResponse { + domain_id: domain_b::SelfDomainId::get(), + channel_id: U256::zero(), + nonce: U256::one(), + }, + )); assert_eq!(domain_a::Balances::free_balance(&account_id), 496); assert_eq!( domain_a::Balances::free_balance(&domain_a::Messenger::messenger_account_id()), @@ -739,20 +748,20 @@ fn verify_transfer_on_domain( // a successful event incoming event // increased balance domain_b_ext.execute_with(|| { - domain_b::System::assert_has_event(domain_b::Event::Transporter( + domain_b::System::assert_has_event(domain_b::RuntimeEvent::Transporter( pallet_transporter::Event::::IncomingTransferSuccessful { domain_id: domain_a::SelfDomainId::get(), message_id: (U256::zero(), U256::one()), }, )); - domain_b::System::assert_has_event(domain_b::Event::Messenger(crate::Event::< - domain_b::Runtime, - >::InboxMessageResponse { - domain_id: domain_a::SelfDomainId::get(), - channel_id: U256::zero(), - nonce: U256::one(), - relayer_id: domain_b::RELAYER_ID, - })); + domain_b::System::assert_has_event(domain_b::RuntimeEvent::Messenger( + crate::Event::::InboxMessageResponse { + domain_id: domain_a::SelfDomainId::get(), + channel_id: U256::zero(), + nonce: U256::one(), + relayer_id: domain_b::RELAYER_ID, + }, + )); assert_eq!(domain_b::Balances::free_balance(&account_id), 1500); assert_eq!( domain_b::Balances::free_balance(&domain_b::Messenger::messenger_account_id()), @@ -823,7 +832,7 @@ fn test_transport_funds_between_domains_failed_low_balance() { let account_id = 100; domain_a_test_ext.execute_with(|| { let res = domain_a::Transporter::transfer( - domain_a::Origin::signed(account_id), + domain_a::RuntimeOrigin::signed(account_id), Location { domain_id: domain_b::SelfDomainId::get(), account_id, @@ -845,7 +854,7 @@ fn test_transport_funds_between_domains_failed_no_open_channel() { let account_id = 1; domain_a_test_ext.execute_with(|| { let res = domain_a::Transporter::transfer( - domain_a::Origin::signed(account_id), + domain_a::RuntimeOrigin::signed(account_id), Location { domain_id: domain_b::SelfDomainId::get(), account_id, @@ -864,8 +873,10 @@ fn test_join_relayer_low_balance() { let relayer_id = 100; domain_a_test_ext.execute_with(|| { - let res = - domain_a::Messenger::join_relayer_set(domain_a::Origin::signed(account_id), relayer_id); + let res = domain_a::Messenger::join_relayer_set( + domain_a::RuntimeOrigin::signed(account_id), + relayer_id, + ); assert_err!( res, pallet_balances::Error::::InsufficientBalance @@ -882,8 +893,10 @@ fn test_join_relayer_set() { domain_a_test_ext.execute_with(|| { assert_eq!(domain_a::Balances::free_balance(&account_id), 1000); - let res = - domain_a::Messenger::join_relayer_set(domain_a::Origin::signed(account_id), relayer_id); + let res = domain_a::Messenger::join_relayer_set( + domain_a::RuntimeOrigin::signed(account_id), + relayer_id, + ); assert_ok!(res); assert_eq!( domain_a::Messenger::relayers_info(relayer_id).unwrap(), @@ -895,8 +908,10 @@ fn test_join_relayer_set() { assert_eq!(domain_a::Balances::free_balance(&account_id), 500); // cannot rejoin again - let res = - domain_a::Messenger::join_relayer_set(domain_a::Origin::signed(account_id), relayer_id); + let res = domain_a::Messenger::join_relayer_set( + domain_a::RuntimeOrigin::signed(account_id), + relayer_id, + ); assert_err!(res, crate::Error::::AlreadyRelayer); // get relayer, idx should increment @@ -930,7 +945,7 @@ fn test_exit_relayer_set() { assert_eq!(domain_a::Balances::free_balance(&account_id), 2000); for relayer in [relayer_id_1, relayer_id_2, relayer_id_3] { let res = domain_a::Messenger::join_relayer_set( - domain_a::Origin::signed(account_id), + domain_a::RuntimeOrigin::signed(account_id), relayer, ); assert_ok!(res); @@ -954,7 +969,7 @@ fn test_exit_relayer_set() { // relayer_1 exits let res = domain_a::Messenger::exit_relayer_set( - domain_a::Origin::signed(account_id), + domain_a::RuntimeOrigin::signed(account_id), relayer_id_1, ); assert_ok!(res); @@ -962,7 +977,7 @@ fn test_exit_relayer_set() { // relayer_3 exits let res = domain_a::Messenger::exit_relayer_set( - domain_a::Origin::signed(account_id), + domain_a::RuntimeOrigin::signed(account_id), relayer_id_3, ); assert_ok!(res); diff --git a/domains/pallets/messenger/src/verification.rs b/domains/pallets/messenger/src/verification.rs index 1b757b589f6..5ca118ff851 100644 --- a/domains/pallets/messenger/src/verification.rs +++ b/domains/pallets/messenger/src/verification.rs @@ -28,7 +28,7 @@ impl StorageProofVerifier { key: StorageKey, ) -> Result { let db = proof.into_memory_db::(); - let val = read_trie_value::, _>(&db, state_root, key.as_ref()) + let val = read_trie_value::, _>(&db, state_root, key.as_ref(), None, None) .map_err(|_| VerificationError::InvalidProof)? .ok_or(VerificationError::MissingValue)?; diff --git a/domains/pallets/transporter/Cargo.toml b/domains/pallets/transporter/Cargo.toml index f176171b69c..b65d11844c1 100644 --- a/domains/pallets/transporter/Cargo.toml +++ b/domains/pallets/transporter/Cargo.toml @@ -15,18 +15,18 @@ include = [ [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", default-features = false, path = "../../../crates/sp-domains" } sp-messenger = { version = "0.1.0", default-features = false, path = "../../primitives/messenger" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [dev-dependencies] -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/pallets/transporter/src/lib.rs b/domains/pallets/transporter/src/lib.rs index 2d7b860cd56..907ad86973e 100644 --- a/domains/pallets/transporter/src/lib.rs +++ b/domains/pallets/transporter/src/lib.rs @@ -74,7 +74,7 @@ mod pallet { #[pallet::config] pub trait Config: frame_system::Config { /// Event type for this pallet. - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Gets the domain_id of the current execution environment. type SelfDomainId: Get; @@ -246,7 +246,7 @@ mod pallet { // mint the funds to dst_account T::Currency::deposit_creating(&req.receiver.account_id, req.amount); - frame_system::Pallet::::deposit_event(Into::<::Event>::into( + frame_system::Pallet::::deposit_event(Into::<::RuntimeEvent>::into( Event::::IncomingTransferSuccessful { domain_id: src_domain_id, message_id, @@ -274,24 +274,28 @@ mod pallet { match resp { Ok(_) => { // transfer is successful - frame_system::Pallet::::deposit_event(Into::<::Event>::into( - Event::::OutgoingTransferSuccessful { - domain_id: dst_domain_id, - message_id, - }, - )); + frame_system::Pallet::::deposit_event( + Into::<::RuntimeEvent>::into( + Event::::OutgoingTransferSuccessful { + domain_id: dst_domain_id, + message_id, + }, + ), + ); } Err(err) => { // transfer failed // revert burned funds T::Currency::deposit_creating(&transfer.sender.account_id, transfer.amount); - frame_system::Pallet::::deposit_event(Into::<::Event>::into( - Event::::OutgoingTransferFailed { - domain_id: dst_domain_id, - message_id, - err, - }, - )); + frame_system::Pallet::::deposit_event( + Into::<::RuntimeEvent>::into( + Event::::OutgoingTransferFailed { + domain_id: dst_domain_id, + message_id, + err, + }, + ), + ); } } diff --git a/domains/pallets/transporter/src/mock.rs b/domains/pallets/transporter/src/mock.rs index f1e3a77be22..fa71fbfccf1 100644 --- a/domains/pallets/transporter/src/mock.rs +++ b/domains/pallets/transporter/src/mock.rs @@ -32,8 +32,8 @@ impl frame_system::Config for MockRuntime { type BlockWeights = (); type BlockLength = (); type DbWeight = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -41,7 +41,7 @@ impl frame_system::Config for MockRuntime { type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = ConstU64<250>; type Version = (); type PalletInfo = PalletInfo; @@ -62,7 +62,7 @@ impl pallet_balances::Config for MockRuntime { type AccountStore = System; type Balance = Balance; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type MaxLocks = (); type MaxReserves = (); @@ -90,7 +90,7 @@ impl Sender for MockMessenger { } impl Config for MockRuntime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SelfDomainId = SelfDomainId; type SelfEndpointId = SelfEndpointId; type Currency = Balances; diff --git a/domains/pallets/transporter/src/tests.rs b/domains/pallets/transporter/src/tests.rs index 56836220ffd..a2ae9a4e309 100644 --- a/domains/pallets/transporter/src/tests.rs +++ b/domains/pallets/transporter/src/tests.rs @@ -1,6 +1,6 @@ use crate::mock::{ - new_test_ext, AccountId, Balance, Balances, Event, MockRuntime, Origin, SelfDomainId, - SelfEndpointId, System, Transporter, USER_ACCOUNT, + new_test_ext, AccountId, Balance, Balances, MockRuntime, RuntimeEvent, RuntimeOrigin, + SelfDomainId, SelfEndpointId, System, Transporter, USER_ACCOUNT, }; use crate::{EndpointHandler, Error, Location, Transfer}; use codec::Encode; @@ -25,7 +25,7 @@ fn test_initiate_transfer_failed() { domain_id: dst_domain_id, account_id: account, }; - let res = Transporter::transfer(Origin::signed(account), dst_location, 500); + let res = Transporter::transfer(RuntimeOrigin::signed(account), dst_location, 500); assert_err!(res, Error::::LowBalance); }) } @@ -45,13 +45,13 @@ fn test_initiate_transfer() { domain_id: dst_domain_id, account_id: account, }; - let res = Transporter::transfer(Origin::signed(account), dst_location, 500); + let res = Transporter::transfer(RuntimeOrigin::signed(account), dst_location, 500); assert_ok!(res); let balance = Balances::free_balance(&account); assert_eq!(balance, 500); let total_balance = Balances::total_issuance(); assert_eq!(total_balance, 500); - System::assert_has_event(Event::Transporter( + System::assert_has_event(RuntimeEvent::Transporter( crate::Event::::OutgoingTransferInitiated { domain_id: dst_domain_id, message_id: 0, @@ -103,9 +103,9 @@ fn initiate_transfer(dst_domain_id: DomainId, account: AccountId, amount: Balanc account_id: account, }; - let res = Transporter::transfer(Origin::signed(account), dst_location, amount); + let res = Transporter::transfer(RuntimeOrigin::signed(account), dst_location, amount); assert_ok!(res); - System::assert_has_event(Event::Transporter( + System::assert_has_event(RuntimeEvent::Transporter( crate::Event::::OutgoingTransferInitiated { domain_id: dst_domain_id, message_id: 0, @@ -218,7 +218,7 @@ fn test_transfer_response_revert() { assert_eq!(balance, 1000); let total_balance = Balances::total_issuance(); assert_eq!(total_balance, 1000); - System::assert_has_event(Event::Transporter( + System::assert_has_event(RuntimeEvent::Transporter( crate::Event::::OutgoingTransferFailed { domain_id: dst_domain_id, message_id: 0, @@ -272,7 +272,7 @@ fn test_transfer_response_successful() { assert_eq!(balance, 500); let total_balance = Balances::total_issuance(); assert_eq!(total_balance, 500); - System::assert_has_event(Event::Transporter( + System::assert_has_event(RuntimeEvent::Transporter( crate::Event::::OutgoingTransferSuccessful { domain_id: dst_domain_id, message_id: 0, diff --git a/domains/primitives/domain-tracker/Cargo.toml b/domains/primitives/domain-tracker/Cargo.toml index 7b7baae86b1..94b7699dde9 100644 --- a/domains/primitives/domain-tracker/Cargo.toml +++ b/domains/primitives/domain-tracker/Cargo.toml @@ -15,10 +15,10 @@ include = [ [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", path = "../../../crates/sp-domains" } -sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/primitives/executor-registry/Cargo.toml b/domains/primitives/executor-registry/Cargo.toml index 79b0a7d8a31..07a61167ba7 100644 --- a/domains/primitives/executor-registry/Cargo.toml +++ b/domains/primitives/executor-registry/Cargo.toml @@ -13,7 +13,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/primitives/messenger/Cargo.toml b/domains/primitives/messenger/Cargo.toml index af5ad68d649..6bbb886ae05 100644 --- a/domains/primitives/messenger/Cargo.toml +++ b/domains/primitives/messenger/Cargo.toml @@ -15,12 +15,12 @@ include = [ [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", path = "../../../crates/sp-domains" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/primitives/system-runtime/Cargo.toml b/domains/primitives/system-runtime/Cargo.toml index db7ab4bf819..6a013d6089d 100644 --- a/domains/primitives/system-runtime/Cargo.toml +++ b/domains/primitives/system-runtime/Cargo.toml @@ -13,11 +13,11 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] parity-scale-codec = { version = "3.1.5", default-features = false, features = ["derive"] } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", default-features = false, path = "../../../crates/sp-domains" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/domains/runtime/system/Cargo.toml b/domains/runtime/system/Cargo.toml index 9385b858b68..b08a80fd88f 100644 --- a/domains/runtime/system/Cargo.toml +++ b/domains/runtime/system/Cargo.toml @@ -20,29 +20,29 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" # Substrate Dependencies ## Substrate Primitive Dependencies -sp-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-offchain = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-session = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-transaction-pool = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-version = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-offchain = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-session = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-transaction-pool = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-version = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } ## Substrate FRAME Dependencies -frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-support = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-support = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } ## Substrate Pallet Dependencies -pallet-balances = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } domain-pallet-executive = { path = "../../pallets/executive", default-features = false } pallet-domain-registry = { path = "../../pallets/domain-registry", default-features = false } @@ -53,7 +53,7 @@ system-runtime-primitives = { path = "../../primitives/system-runtime", default- [build-dependencies] subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../../../crates/subspace-wasm-tools" } -substrate-wasm-builder = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-wasm-builder = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = [ diff --git a/domains/runtime/system/src/runtime.rs b/domains/runtime/system/src/runtime.rs index c693594506b..9b1ee2b58bb 100644 --- a/domains/runtime/system/src/runtime.rs +++ b/domains/runtime/system/src/runtime.rs @@ -1,8 +1,9 @@ +use frame_support::dispatch::DispatchClass; use frame_support::traits::{ConstU16, ConstU32, Everything}; use frame_support::weights::constants::{ BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND, }; -use frame_support::weights::{ConstantMultiplier, DispatchClass, IdentityFee, Weight}; +use frame_support::weights::{ConstantMultiplier, IdentityFee, Weight}; use frame_support::{construct_runtime, parameter_types}; use frame_system::limits::{BlockLength, BlockWeights}; use sp_api::impl_runtime_apis; @@ -51,10 +52,11 @@ pub type SignedExtra = ( ); /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; /// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = domain_pallet_executive::Executive< @@ -115,7 +117,7 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2; +const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.div(2).set_proof_size(u64::MAX); /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] @@ -162,7 +164,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The aggregated dispatch type that is available for extrinsics. - type Call = Call; + type RuntimeCall = RuntimeCall; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. @@ -176,9 +178,9 @@ impl frame_system::Config for Runtime { /// The header type. type Header = generic::Header; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; /// Runtime version. @@ -219,7 +221,7 @@ impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; @@ -234,7 +236,7 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; type WeightToFee = IdentityFee; type LengthToFee = ConstantMultiplier; @@ -243,8 +245,8 @@ impl pallet_transaction_payment::Config for Runtime { } impl domain_pallet_executive::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type Call = RuntimeCall; } parameter_types! { @@ -261,7 +263,7 @@ parameter_types! { } impl pallet_executor_registry::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type StakeWeight = sp_domains::StakeWeight; type MinExecutorStake = MinExecutorStake; @@ -283,7 +285,7 @@ parameter_types! { } impl pallet_domain_registry::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type StakeWeight = sp_domains::StakeWeight; type ExecutorRegistry = ExecutorRegistry; @@ -440,7 +442,7 @@ impl_runtime_apis! { UncheckedExtrinsic::new_unsigned( domain_pallet_executive::Call::sudo_unchecked_weight_unsigned { call: Box::new(set_code_call.into()), - weight: 0 + weight: Weight::zero(), }.into() ).encode() } diff --git a/domains/service/Cargo.toml b/domains/service/Cargo.toml index 1120c71efdd..c44b60309bc 100644 --- a/domains/service/Cargo.toml +++ b/domains/service/Cargo.toml @@ -17,7 +17,7 @@ futures = "0.3.21" hex-literal = "0.3.1" log = "0.4.17" serde = { version = "1.0.143", features = ["derive"] } -clap = { version = "3.2.16", features = ["derive"] } +clap = { version = "4.0.22", features = ["derive"] } # RPC related Dependencies jsonrpsee = { version = "0.15.1", features = ["server"] } @@ -26,41 +26,41 @@ jsonrpsee = { version = "0.15.1", features = ["server"] } system-domain-runtime = { path = "../runtime/system" } # Substrate Dependencies -frame-benchmarking = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-benchmarking-cli = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["runtime-benchmarks"] } +frame-benchmarking = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-benchmarking-cli = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["runtime-benchmarks"] } -pallet-transaction-payment-rpc = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-transaction-payment-rpc = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } -substrate-frame-rpc-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-frame-rpc-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } ## Substrate Client Dependencies -sc-chain-spec = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-cli = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sc-client-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-executor = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-rpc = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-rpc-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-service = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["wasmtime"] } -sc-telemetry = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-utils = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-chain-spec = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-client-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-executor = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-rpc = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-rpc-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-rpc-spec-v2 = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-service = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["wasmtime"] } +sc-telemetry = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-utils = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } ## Substrate Primitive Dependencies -sp-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-keystore = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-offchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-session = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-keystore = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-offchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-session = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } # Cumulus dependencies domain-client-consensus-relay-chain = { path = "../client/consensus-relay-chain" } @@ -74,7 +74,7 @@ subspace-core-primitives = { path = "../../crates/subspace-core-primitives" } subspace-runtime-primitives = { path = "../../crates/subspace-runtime-primitives" } [build-dependencies] -substrate-build-script-utils = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-build-script-utils = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] runtime-benchmarks = [ diff --git a/domains/service/src/lib.rs b/domains/service/src/lib.rs index e54c5601752..17f15beb2ff 100644 --- a/domains/service/src/lib.rs +++ b/domains/service/src/lib.rs @@ -265,7 +265,7 @@ where let validator = secondary_chain_config.role.is_authority(); let transaction_pool = params.transaction_pool.clone(); let mut task_manager = params.task_manager; - let (network, system_rpc_tx, network_starter) = + let (network, system_rpc_tx, tx_handler_controller, network_starter) = sc_service::build_network(BuildNetworkParams { config: &secondary_chain_config, client: client.clone(), @@ -280,11 +280,13 @@ where let rpc_builder = { let client = client.clone(); let transaction_pool = transaction_pool.clone(); + let chain_spec = secondary_chain_config.chain_spec.cloned_box(); Box::new(move |deny_unsafe, _| { let deps = crate::rpc::FullDeps { client: client.clone(), pool: transaction_pool.clone(), + chain_spec: chain_spec.cloned_box(), deny_unsafe, }; @@ -302,6 +304,7 @@ where backend: backend.clone(), network: network.clone(), system_rpc_tx, + tx_handler_controller, telemetry: telemetry.as_mut(), })?; diff --git a/domains/service/src/rpc.rs b/domains/service/src/rpc.rs index a81effd3bfa..75fd496067d 100644 --- a/domains/service/src/rpc.rs +++ b/domains/service/src/rpc.rs @@ -7,8 +7,9 @@ use jsonrpsee::RpcModule; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; -use sc_client_api::AuxStore; +use sc_client_api::{AuxStore, BlockBackend}; use sc_rpc::DenyUnsafe; +use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer}; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; @@ -24,6 +25,8 @@ pub struct FullDeps { pub client: Arc, /// Transaction pool instance. pub pool: Arc

, + /// A copy of the chain spec. + pub chain_spec: Box, /// Whether to deny unsafe calls pub deny_unsafe: DenyUnsafe, } @@ -34,6 +37,7 @@ pub fn create_full( ) -> Result, Box> where C: ProvideRuntimeApi + + BlockBackend + HeaderBackend + AuxStore + HeaderMetadata @@ -49,9 +53,19 @@ where let FullDeps { client, pool, + chain_spec, deny_unsafe, } = deps; + let chain_name = chain_spec.name().to_string(); + let genesis_hash = client + .block_hash(0) + .ok() + .flatten() + .expect("Genesis block exists; qed"); + let properties = chain_spec.properties(); + module.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?; + module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client).into_rpc())?; diff --git a/domains/test/runtime/Cargo.toml b/domains/test/runtime/Cargo.toml index 3a86b341429..5fecbf4a7ba 100644 --- a/domains/test/runtime/Cargo.toml +++ b/domains/test/runtime/Cargo.toml @@ -14,7 +14,7 @@ targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../../../crates/subspace-wasm-tools" } -substrate-wasm-builder = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-wasm-builder = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [dependencies] hex-literal = { version = '0.3.1', optional = true } @@ -24,29 +24,29 @@ scale-info = { version = "2.1.2", default-features = false, features = ["derive" # Substrate Dependencies ## Substrate Primitive Dependencies -sp-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-offchain = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-session = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-transaction-pool = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-version = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-offchain = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-session = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-transaction-pool = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-version = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } ## Substrate FRAME Dependencies -frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-support = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-support = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system-benchmarking = { default-features = false, optional = true, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } ## Substrate Pallet Dependencies -pallet-balances = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment-rpc-runtime-api = { default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } domain-pallet-executive = { path = "../../pallets/executive", default-features = false } pallet-domain-registry = { path = "../../pallets/domain-registry", default-features = false } diff --git a/domains/test/runtime/src/runtime.rs b/domains/test/runtime/src/runtime.rs index 294445c001c..faf99282902 100644 --- a/domains/test/runtime/src/runtime.rs +++ b/domains/test/runtime/src/runtime.rs @@ -1,8 +1,9 @@ +use frame_support::dispatch::DispatchClass; use frame_support::traits::{ConstU16, ConstU32, Everything}; use frame_support::weights::constants::{ BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND, }; -use frame_support::weights::{ConstantMultiplier, DispatchClass, IdentityFee, Weight}; +use frame_support::weights::{ConstantMultiplier, IdentityFee, Weight}; use frame_support::{construct_runtime, parameter_types}; use frame_system::limits::{BlockLength, BlockWeights}; use sp_api::impl_runtime_apis; @@ -51,10 +52,11 @@ pub type SignedExtra = ( ); /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; /// Extrinsic type that has already been checked. -pub type CheckedExtrinsic = generic::CheckedExtrinsic; +pub type CheckedExtrinsic = generic::CheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = domain_pallet_executive::Executive< @@ -67,7 +69,7 @@ pub type Executive = domain_pallet_executive::Executive< >; /// The payload being signed in transactions. -pub type SignedPayload = generic::SignedPayload; +pub type SignedPayload = generic::SignedPayload; /// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// the specifics of the runtime. They can then be made to be agnostic over specific formats @@ -118,7 +120,7 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 0.5 of a second of compute with a 12 second average block time. -const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND / 2; +const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.div(2).set_proof_size(u64::MAX); /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] @@ -165,7 +167,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The aggregated dispatch type that is available for extrinsics. - type Call = Call; + type RuntimeCall = RuntimeCall; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. @@ -179,9 +181,9 @@ impl frame_system::Config for Runtime { /// The header type. type Header = generic::Header; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = BlockHashCount; /// Runtime version. @@ -222,7 +224,7 @@ impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; @@ -237,7 +239,7 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; type WeightToFee = IdentityFee; type LengthToFee = ConstantMultiplier; @@ -246,8 +248,8 @@ impl pallet_transaction_payment::Config for Runtime { } impl domain_pallet_executive::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type Call = RuntimeCall; } parameter_types! { @@ -261,7 +263,7 @@ parameter_types! { } impl pallet_executor_registry::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type StakeWeight = sp_domains::StakeWeight; type MinExecutorStake = MinExecutorStake; @@ -283,7 +285,7 @@ parameter_types! { } impl pallet_domain_registry::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type StakeWeight = sp_domains::StakeWeight; type ExecutorRegistry = ExecutorRegistry; @@ -440,7 +442,7 @@ impl_runtime_apis! { UncheckedExtrinsic::new_unsigned( domain_pallet_executive::Call::sudo_unchecked_weight_unsigned { call: Box::new(set_code_call.into()), - weight: 0 + weight: Weight::zero() }.into() ).encode() } diff --git a/domains/test/service/Cargo.toml b/domains/test/service/Cargo.toml index 9472c0ef764..c3592f1da19 100644 --- a/domains/test/service/Cargo.toml +++ b/domains/test/service/Cargo.toml @@ -19,26 +19,27 @@ tokio = { version = "1.20.1", features = ["macros"] } tracing = "0.1.36" # Substrate -frame-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-support = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-client-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-executor = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-rpc = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-service = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sc-tracing = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-arithmetic = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-keyring = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-inherents = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-timestamp = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -substrate-test-client = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-support = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-client-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-executor = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-common = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-rpc = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-service = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sc-tracing = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-arithmetic = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-keyring = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-inherents = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-timestamp = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +substrate-test-client = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } domain-client-consensus-relay-chain = { path = "../../client/consensus-relay-chain" } domain-client-executor = { path = "../../client/domain-executor" } diff --git a/domains/test/service/src/lib.rs b/domains/test/service/src/lib.rs index 2da5654eec7..af159594f06 100644 --- a/domains/test/service/src/lib.rs +++ b/domains/test/service/src/lib.rs @@ -25,8 +25,8 @@ use domain_test_runtime::Hash; use futures::StreamExt; use sc_client_api::execution_extensions::ExecutionStrategies; use sc_consensus_slots::SlotProportion; -use sc_network::config::TransportConfig; use sc_network::{multiaddr, NetworkService, NetworkStateInfo}; +use sc_network_common::config::{NonReservedPeerMode, TransportConfig}; use sc_service::config::{ DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, NetworkConfiguration, OffchainWorkerConfig, PruningMode, WasmExecutionMethod, @@ -228,6 +228,7 @@ pub struct TestNodeBuilder { secondary_nodes: Vec, secondary_nodes_exclusive: bool, primary_nodes: Vec, + base_path: BasePath, } impl TestNodeBuilder { @@ -236,13 +237,19 @@ impl TestNodeBuilder { /// `para_id` - The parachain id this node is running for. /// `tokio_handle` - The tokio handler to use. /// `key` - The key that will be used to generate the name. - pub fn new(tokio_handle: tokio::runtime::Handle, key: Sr25519Keyring) -> Self { + /// `base_path` - Where databases will be stored. + pub fn new( + tokio_handle: tokio::runtime::Handle, + key: Sr25519Keyring, + base_path: BasePath, + ) -> Self { TestNodeBuilder { key, tokio_handle, secondary_nodes: Vec::new(), secondary_nodes_exclusive: false, primary_nodes: Vec::new(), + base_path, } } @@ -314,6 +321,7 @@ impl TestNodeBuilder { self.secondary_nodes, self.secondary_nodes_exclusive, role, + BasePath::new(self.base_path.path().join("secondary")), ) .expect("could not generate secondary chain node Configuration"); @@ -324,6 +332,7 @@ impl TestNodeBuilder { false, primary_force_authoring, primary_force_synced, + BasePath::new(self.base_path.path().join("primary")), ); primary_chain_config.network.node_name = @@ -360,10 +369,10 @@ pub fn node_config( tokio_handle: tokio::runtime::Handle, key: Sr25519Keyring, nodes: Vec, - nodes_exlusive: bool, + nodes_exclusive: bool, role: Role, + base_path: BasePath, ) -> Result { - let base_path = BasePath::new_temp_dir()?; let root = base_path.path().to_path_buf(); let key_seed = key.to_seed(); @@ -376,10 +385,9 @@ pub fn node_config( None, ); - if nodes_exlusive { + if nodes_exclusive { network_config.default_peers_set.reserved_nodes = nodes; - network_config.default_peers_set.non_reserved_mode = - sc_network::config::NonReservedPeerMode::Deny; + network_config.default_peers_set.non_reserved_mode = NonReservedPeerMode::Deny; } else { network_config.boot_nodes = nodes; } @@ -404,10 +412,9 @@ pub fn node_config( database: DatabaseSource::ParityDb { path: root.join("paritydb"), }, - state_cache_size: 67108864, - state_cache_child_ratio: None, + trie_cache_maximum_size: Some(16 * 1024 * 1024), state_pruning: Some(PruningMode::ArchiveAll), - blocks_pruning: BlocksPruning::All, + blocks_pruning: BlocksPruning::KeepAll, chain_spec: spec, wasm_method: WasmExecutionMethod::Interpreted, // NOTE: we enforce the use of the native runtime to make the errors more debuggable @@ -462,7 +469,7 @@ impl TestNode { /// Construct and send an extrinsic to this node. pub async fn construct_and_send_extrinsic( &self, - function: impl Into, + function: impl Into, caller: Sr25519Keyring, immortal: bool, nonce: u32, @@ -484,7 +491,7 @@ impl TestNode { /// Construct an extrinsic that can be applied to the test runtime. pub fn construct_extrinsic( client: &Client, - function: impl Into, + function: impl Into, caller: Sr25519Keyring, immortal: bool, nonce: u32, @@ -543,6 +550,16 @@ pub async fn run_primary_chain_validator_node( tokio_handle: tokio::runtime::Handle, key: Sr25519Keyring, boot_nodes: Vec, + base_path: BasePath, ) -> (subspace_test_service::PrimaryTestNode, NetworkStarter) { - subspace_test_service::run_validator_node(tokio_handle, key, boot_nodes, true, true, true).await + subspace_test_service::run_validator_node( + tokio_handle, + key, + boot_nodes, + true, + true, + true, + base_path, + ) + .await } diff --git a/orml/vesting/Cargo.toml b/orml/vesting/Cargo.toml index ef5f1ab01b8..d3f9e5bae05 100644 --- a/orml/vesting/Cargo.toml +++ b/orml/vesting/Cargo.toml @@ -8,19 +8,19 @@ authors = ["Laminar Developers "] edition = "2021" [dependencies] -scale-info = { version = "2.1", default-features = false, features = ["derive"] } -serde = { version = "1.0.143", optional = true } +scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } +serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["max-encoded-len"] } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-io = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-std = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -frame-support = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -frame-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-io = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-std = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +frame-support = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +frame-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } [dev-dependencies] -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-balances = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-balances = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/orml/vesting/src/default_weight.rs b/orml/vesting/src/default_weight.rs index 9a4008031a1..d716ab75904 100644 --- a/orml/vesting/src/default_weight.rs +++ b/orml/vesting/src/default_weight.rs @@ -8,20 +8,20 @@ use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; impl crate::WeightInfo for () { fn vested_transfer() -> Weight { - (310_862_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(310_862_000) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } fn claim(i: u32) -> Weight { - (158_614_000 as Weight) - .saturating_add((958_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(158_614_000) + .saturating_add(Weight::from_ref_time(958_000).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } fn update_vesting_schedules(i: u32) -> Weight { - (119_811_000 as Weight) - .saturating_add((2_320_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(119_811_000) + .saturating_add(Weight::from_ref_time(2_320_000).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } } diff --git a/orml/vesting/src/lib.rs b/orml/vesting/src/lib.rs index 6ff03bc3084..163f10b1bbb 100644 --- a/orml/vesting/src/lib.rs +++ b/orml/vesting/src/lib.rs @@ -32,7 +32,7 @@ use frame_support::{ ensure, pallet_prelude::*, traits::{Currency, EnsureOrigin, ExistenceRequirement, Get, LockIdentifier, LockableCurrency, WithdrawReasons}, - transactional, BoundedVec, + BoundedVec, }; use frame_system::{ensure_root, ensure_signed, pallet_prelude::*}; use scale_info::TypeInfo; @@ -123,7 +123,7 @@ pub mod module { #[pallet::config] pub trait Config: frame_system::Config { - type Event: From> + IsType<::Event>; + type RuntimeEvent: From> + IsType<::RuntimeEvent>; type Currency: LockableCurrency; @@ -132,7 +132,7 @@ pub mod module { type MinVestedTransfer: Get>; /// Required origin for vested transfer. - type VestedTransferOrigin: EnsureOrigin; + type VestedTransferOrigin: EnsureOrigin; /// Weight information for extrinsics in this module. type WeightInfo: WeightInfo; @@ -219,7 +219,9 @@ pub mod module { .iter() .try_fold::<_, _, Result, DispatchError>>(Zero::zero(), |acc_amount, schedule| { let amount = ensure_valid_vesting_schedule::(schedule)?; - Ok(acc_amount + amount) + acc_amount + .checked_add(&amount) + .ok_or_else(|| ArithmeticError::Overflow.into()) }) .expect("Invalid vesting schedule"); @@ -302,8 +304,6 @@ pub mod module { } } -// TODO: Remove this with ORML upgrade, without `transactional` macro test fails -#[allow(deprecated)] impl Pallet { fn do_claim(who: &T::AccountId) -> BalanceOf { let locked = Self::locked_balance(who); @@ -339,7 +339,6 @@ impl Pallet { }) } - #[transactional] fn do_vested_transfer(from: &T::AccountId, to: &T::AccountId, schedule: VestingScheduleOf) -> DispatchResult { let schedule_amount = ensure_valid_vesting_schedule::(&schedule)?; @@ -369,7 +368,9 @@ impl Pallet { .iter() .try_fold::<_, _, Result, DispatchError>>(Zero::zero(), |acc_amount, schedule| { let amount = ensure_valid_vesting_schedule::(schedule)?; - Ok(acc_amount + amount) + acc_amount + .checked_add(&amount) + .ok_or_else(|| ArithmeticError::Overflow.into()) })?; ensure!( T::Currency::free_balance(who) >= total_amount, diff --git a/orml/vesting/src/mock.rs b/orml/vesting/src/mock.rs index c59f2171227..75024a63fed 100644 --- a/orml/vesting/src/mock.rs +++ b/orml/vesting/src/mock.rs @@ -3,113 +3,113 @@ #![cfg(test)] use super::*; -use frame_support::traits::{ConstU32, ConstU64, EnsureOrigin, Everything}; -use frame_support::{construct_runtime, parameter_types}; +use frame_support::{ + construct_runtime, parameter_types, + traits::{ConstU32, ConstU64, EnsureOrigin, Everything}, +}; use frame_system::RawOrigin; use sp_core::H256; -use sp_runtime::testing::Header; -use sp_runtime::traits::IdentityLookup; +use sp_runtime::{testing::Header, traits::IdentityLookup}; use crate as vesting; pub type AccountId = u128; impl frame_system::Config for Runtime { - type Origin = Origin; - type Call = Call; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = ::sp_runtime::traits::BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type Header = Header; - type Event = Event; - type BlockHashCount = ConstU64<250>; - type BlockWeights = (); - type BlockLength = (); - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type DbWeight = (); - type BaseCallFilter = Everything; - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = ConstU32<16>; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = ::sp_runtime::traits::BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = ConstU64<250>; + type BlockWeights = (); + type BlockLength = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type DbWeight = (); + type BaseCallFilter = Everything; + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = ConstU32<16>; } type Balance = u64; impl pallet_balances::Config for Runtime { - type Balance = Balance; - type DustRemoval = (); - type Event = Event; - type ExistentialDeposit = ConstU64<1>; - type AccountStore = frame_system::Pallet; - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; - type WeightInfo = (); + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ConstU64<1>; + type AccountStore = frame_system::Pallet; + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type WeightInfo = (); } pub struct EnsureAliceOrBob; -impl EnsureOrigin for EnsureAliceOrBob { - type Success = AccountId; - - fn try_origin(o: Origin) -> Result { - Into::, Origin>>::into(o).and_then(|o| match o { - RawOrigin::Signed(ALICE) => Ok(ALICE), - RawOrigin::Signed(BOB) => Ok(BOB), - r => Err(Origin::from(r)), - }) - } - - #[cfg(feature = "runtime-benchmarks")] - fn successful_origin() -> Origin { - let zero_account_id = - AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) - .expect("infinite length input; no invalid inputs for type; qed"); - Origin::from(RawOrigin::Signed(zero_account_id)) - } +impl EnsureOrigin for EnsureAliceOrBob { + type Success = AccountId; + + fn try_origin(o: RuntimeOrigin) -> Result { + Into::, RuntimeOrigin>>::into(o).and_then(|o| match o { + RawOrigin::Signed(ALICE) => Ok(ALICE), + RawOrigin::Signed(BOB) => Ok(BOB), + r => Err(RuntimeOrigin::from(r)), + }) + } + + #[cfg(feature = "runtime-benchmarks")] + fn successful_origin() -> RuntimeOrigin { + let zero_account_id = AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()) + .expect("infinite length input; no invalid inputs for type; qed"); + RuntimeOrigin::from(RawOrigin::Signed(zero_account_id)) + } } parameter_types! { - pub static MockBlockNumberProvider: u64 = 0; + pub static MockBlockNumberProvider: u64 = 0; } impl BlockNumberProvider for MockBlockNumberProvider { - type BlockNumber = u64; + type BlockNumber = u64; - fn current_block_number() -> Self::BlockNumber { - Self::get() - } + fn current_block_number() -> Self::BlockNumber { + Self::get() + } } impl Config for Runtime { - type Event = Event; - type Currency = PalletBalances; - type MinVestedTransfer = ConstU64<5>; - type VestedTransferOrigin = EnsureAliceOrBob; - type WeightInfo = (); - type MaxVestingSchedules = ConstU32<2>; - type BlockNumberProvider = MockBlockNumberProvider; + type RuntimeEvent = RuntimeEvent; + type Currency = PalletBalances; + type MinVestedTransfer = ConstU64<5>; + type VestedTransferOrigin = EnsureAliceOrBob; + type WeightInfo = (); + type MaxVestingSchedules = ConstU32<2>; + type BlockNumberProvider = MockBlockNumberProvider; } type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; construct_runtime!( - pub struct Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Pallet, Call, Storage, Config, Event}, - Vesting: vesting::{Pallet, Storage, Call, Event, Config}, - PalletBalances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - } + pub enum Runtime where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic, + { + System: frame_system::{Pallet, Call, Storage, Config, Event}, + Vesting: vesting::{Pallet, Storage, Call, Event, Config}, + PalletBalances: pallet_balances::{Pallet, Call, Storage, Config, Event}, + } ); pub const ALICE: AccountId = 1; @@ -120,27 +120,27 @@ pub const CHARLIE: AccountId = 3; pub struct ExtBuilder; impl ExtBuilder { - pub fn build() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, 100), (CHARLIE, 50)], - } - .assimilate_storage(&mut t) - .unwrap(); - - vesting::GenesisConfig:: { - vesting: vec![ - // who, start, period, period_count, per_period - (CHARLIE, 2, 3, 1, 5), - (CHARLIE, 2 + 3, 3, 3, 5), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - t.into() - } + pub fn build() -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, 100), (CHARLIE, 50)], + } + .assimilate_storage(&mut t) + .unwrap(); + + vesting::GenesisConfig:: { + vesting: vec![ + // who, start, period, period_count, per_period + (CHARLIE, 2, 3, 1, 5), + (CHARLIE, 2 + 3, 3, 3, 5), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + t.into() + } } diff --git a/orml/vesting/src/tests.rs b/orml/vesting/src/tests.rs index bb974254d42..465f5f62ac9 100644 --- a/orml/vesting/src/tests.rs +++ b/orml/vesting/src/tests.rs @@ -4,8 +4,9 @@ use super::*; use frame_support::{assert_noop, assert_ok, error::BadOrigin}; -use mock::{Event, *}; +use mock::*; use pallet_balances::{BalanceLock, Reasons}; +use sp_runtime::traits::Dispatchable; #[test] fn vesting_from_chain_spec_works() { @@ -38,7 +39,7 @@ fn vesting_from_chain_spec_works() { MockBlockNumberProvider::set(13); - assert_ok!(Vesting::claim(Origin::signed(CHARLIE))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(CHARLIE))); assert_ok!(PalletBalances::ensure_can_withdraw( &CHARLIE, @@ -50,7 +51,7 @@ fn vesting_from_chain_spec_works() { MockBlockNumberProvider::set(14); - assert_ok!(Vesting::claim(Origin::signed(CHARLIE))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(CHARLIE))); assert_ok!(PalletBalances::ensure_can_withdraw( &CHARLIE, @@ -72,9 +73,13 @@ fn vested_transfer_works() { period_count: 1u32, per_period: 100u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); assert_eq!(Vesting::vesting_schedules(&BOB), vec![schedule.clone()]); - System::assert_last_event(Event::Vesting(crate::Event::VestingScheduleAdded { + System::assert_last_event(RuntimeEvent::Vesting(crate::Event::VestingScheduleAdded { from: ALICE, to: BOB, vesting_schedule: schedule, @@ -91,7 +96,7 @@ fn add_new_vesting_schedule_merges_with_current_locked_balance_and_until() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); MockBlockNumberProvider::set(12); @@ -101,7 +106,11 @@ fn add_new_vesting_schedule_merges_with_current_locked_balance_and_until() { period_count: 1u32, per_period: 7u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, another_schedule)); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + another_schedule + )); assert_eq!( PalletBalances::locks(&BOB).get(0), @@ -123,7 +132,7 @@ fn cannot_use_fund_if_not_claimed() { period_count: 1u32, per_period: 50u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); assert!(PalletBalances::ensure_can_withdraw(&BOB, 1, WithdrawReasons::TRANSFER, 49).is_err()); }); } @@ -138,7 +147,7 @@ fn vested_transfer_fails_if_zero_period_or_count() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule), Error::::ZeroVestingPeriod ); @@ -149,7 +158,7 @@ fn vested_transfer_fails_if_zero_period_or_count() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule), Error::::ZeroVestingPeriodCount ); }); @@ -165,7 +174,7 @@ fn vested_transfer_fails_if_transfer_err() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(BOB), ALICE, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(BOB), ALICE, schedule), pallet_balances::Error::::InsufficientBalance, ); }); @@ -181,7 +190,7 @@ fn vested_transfer_fails_if_overflow() { per_period: u64::MAX, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule), ArithmeticError::Overflow, ); @@ -192,7 +201,7 @@ fn vested_transfer_fails_if_overflow() { per_period: 1u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, another_schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, another_schedule), ArithmeticError::Overflow, ); }); @@ -208,7 +217,7 @@ fn vested_transfer_fails_if_bad_origin() { per_period: 100u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(CHARLIE), BOB, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(CHARLIE), BOB, schedule), BadOrigin ); }); @@ -223,23 +232,23 @@ fn claim_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); MockBlockNumberProvider::set(11); // remain locked if not claimed - assert!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10).is_err()); + assert!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10).is_err()); // unlocked after claiming - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(VestingSchedules::::contains_key(BOB)); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10)); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10)); // more are still locked - assert!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 1).is_err()); + assert!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 1).is_err()); MockBlockNumberProvider::set(21); // claim more - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(!VestingSchedules::::contains_key(BOB)); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10)); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10)); // all used up assert_eq!(PalletBalances::free_balance(BOB), 0); @@ -257,9 +266,9 @@ fn claim_for_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); - assert_ok!(Vesting::claim_for(Origin::signed(ALICE), BOB)); + assert_ok!(Vesting::claim_for(RuntimeOrigin::signed(ALICE), BOB)); assert_eq!( PalletBalances::locks(&BOB).get(0), @@ -273,7 +282,7 @@ fn claim_for_works() { MockBlockNumberProvider::set(21); - assert_ok!(Vesting::claim_for(Origin::signed(ALICE), BOB)); + assert_ok!(Vesting::claim_for(RuntimeOrigin::signed(ALICE), BOB)); // no locks anymore assert_eq!(PalletBalances::locks(&BOB), vec![]); @@ -290,7 +299,7 @@ fn update_vesting_schedules_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule)); + assert_ok!(Vesting::vested_transfer(RuntimeOrigin::signed(ALICE), BOB, schedule)); let updated_schedule = VestingSchedule { start: 0u64, @@ -299,18 +308,18 @@ fn update_vesting_schedules_works() { per_period: 10u64, }; assert_ok!(Vesting::update_vesting_schedules( - Origin::root(), + RuntimeOrigin::root(), BOB, vec![updated_schedule] )); MockBlockNumberProvider::set(11); - assert_ok!(Vesting::claim(Origin::signed(BOB))); - assert!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 1).is_err()); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); + assert!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 1).is_err()); MockBlockNumberProvider::set(21); - assert_ok!(Vesting::claim(Origin::signed(BOB))); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), ALICE, 10)); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(BOB), ALICE, 10)); // empty vesting schedules cleanup the storage and unlock the fund assert!(VestingSchedules::::contains_key(BOB)); @@ -322,7 +331,7 @@ fn update_vesting_schedules_works() { reasons: Reasons::All, }) ); - assert_ok!(Vesting::update_vesting_schedules(Origin::root(), BOB, vec![])); + assert_ok!(Vesting::update_vesting_schedules(RuntimeOrigin::root(), BOB, vec![])); assert!(!VestingSchedules::::contains_key(BOB)); assert_eq!(PalletBalances::locks(&BOB), vec![]); }); @@ -331,7 +340,7 @@ fn update_vesting_schedules_works() { #[test] fn update_vesting_schedules_fails_if_unexpected_existing_locks() { ExtBuilder::build().execute_with(|| { - assert_ok!(PalletBalances::transfer(Origin::signed(ALICE), BOB, 1)); + assert_ok!(PalletBalances::transfer(RuntimeOrigin::signed(ALICE), BOB, 1)); PalletBalances::set_lock(*b"prelocks", &BOB, 0u64, WithdrawReasons::all()); }); } @@ -346,7 +355,7 @@ fn vested_transfer_check_for_min() { per_period: 3u64, }; assert_noop!( - Vesting::vested_transfer(Origin::signed(BOB), ALICE, schedule), + Vesting::vested_transfer(RuntimeOrigin::signed(BOB), ALICE, schedule), Error::::AmountLow ); }); @@ -361,7 +370,11 @@ fn multiple_vesting_schedule_claim_works() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); let schedule2 = VestingSchedule { start: 0u64, @@ -369,19 +382,23 @@ fn multiple_vesting_schedule_claim_works() { period_count: 3u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule2.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule2.clone() + )); assert_eq!(Vesting::vesting_schedules(&BOB), vec![schedule, schedule2.clone()]); MockBlockNumberProvider::set(21); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert_eq!(Vesting::vesting_schedules(&BOB), vec![schedule2]); MockBlockNumberProvider::set(31); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(!VestingSchedules::::contains_key(BOB)); @@ -398,17 +415,30 @@ fn exceeding_maximum_schedules_should_fail() { period_count: 2u32, per_period: 10u64, }; - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone())); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + schedule.clone() + )); + + let create = RuntimeCall::Vesting(crate::Call::::vested_transfer { + dest: BOB, + schedule: schedule.clone(), + }); assert_noop!( - Vesting::vested_transfer(Origin::signed(ALICE), BOB, schedule.clone()), + create.dispatch(RuntimeOrigin::signed(ALICE)), Error::::MaxVestingSchedulesExceeded ); let schedules = vec![schedule.clone(), schedule.clone(), schedule]; assert_noop!( - Vesting::update_vesting_schedules(Origin::root(), BOB, schedules), + Vesting::update_vesting_schedules(RuntimeOrigin::root(), BOB, schedules), Error::::MaxVestingSchedulesExceeded ); }); @@ -434,24 +464,32 @@ fn cliff_vesting_works() { }; assert_eq!(PalletBalances::free_balance(BOB), 0); - assert_ok!(Vesting::vested_transfer(Origin::signed(ALICE), BOB, cliff_schedule)); + assert_ok!(Vesting::vested_transfer( + RuntimeOrigin::signed(ALICE), + BOB, + cliff_schedule + )); assert_eq!(PalletBalances::free_balance(BOB), VESTING_AMOUNT); assert_eq!(PalletBalances::locks(&BOB), vec![balance_lock.clone()]); for i in 1..VESTING_PERIOD { MockBlockNumberProvider::set(i); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert_eq!(PalletBalances::free_balance(BOB), VESTING_AMOUNT); assert_eq!(PalletBalances::locks(&BOB), vec![balance_lock.clone()]); assert_noop!( - PalletBalances::transfer(Origin::signed(BOB), CHARLIE, VESTING_AMOUNT), + PalletBalances::transfer(RuntimeOrigin::signed(BOB), CHARLIE, VESTING_AMOUNT), pallet_balances::Error::::LiquidityRestrictions, ); } MockBlockNumberProvider::set(VESTING_PERIOD); - assert_ok!(Vesting::claim(Origin::signed(BOB))); + assert_ok!(Vesting::claim(RuntimeOrigin::signed(BOB))); assert!(PalletBalances::locks(&BOB).is_empty()); - assert_ok!(PalletBalances::transfer(Origin::signed(BOB), CHARLIE, VESTING_AMOUNT)); + assert_ok!(PalletBalances::transfer( + RuntimeOrigin::signed(BOB), + CHARLIE, + VESTING_AMOUNT + )); }); } diff --git a/orml/vesting/src/weights.rs b/orml/vesting/src/weights.rs index 85f357e62f5..49c11e2ed5b 100644 --- a/orml/vesting/src/weights.rs +++ b/orml/vesting/src/weights.rs @@ -1,7 +1,7 @@ //! Autogenerated weights for orml_vesting //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-05-04, STEPS: \[50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -38,22 +38,22 @@ pub trait WeightInfo { /// Default weights. impl WeightInfo for () { fn vested_transfer() -> Weight { - (69_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(4 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(69_000_000) + .saturating_add(RocksDbWeight::get().reads(4 as u64)) + .saturating_add(RocksDbWeight::get().writes(4 as u64)) } fn claim(i: u32, ) -> Weight { - (31_747_000 as Weight) + Weight::from_ref_time(31_747_000) // Standard Error: 4_000 - .saturating_add((63_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) - .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(63_000).saturating_mul(i as u64)) + .saturating_add(RocksDbWeight::get().reads(2 as u64)) + .saturating_add(RocksDbWeight::get().writes(2 as u64)) } fn update_vesting_schedules(i: u32, ) -> Weight { - (29_457_000 as Weight) + Weight::from_ref_time(29_457_000) // Standard Error: 4_000 - .saturating_add((117_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) - .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(117_000).saturating_mul(i as u64)) + .saturating_add(RocksDbWeight::get().reads(2 as u64)) + .saturating_add(RocksDbWeight::get().writes(3 as u64)) } } diff --git a/substrate/sc-network-test/Cargo.toml b/substrate/sc-network-test/Cargo.toml index 816aa0f8b12..1f42d824a62 100644 --- a/substrate/sc-network-test/Cargo.toml +++ b/substrate/sc-network-test/Cargo.toml @@ -15,24 +15,24 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] async-std = "1.12.0" async-trait = "0.1.57" -sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network-common = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network-light = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network-sync = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-network = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-common = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-light = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-sync = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } log = "0.4.17" parking_lot = "0.12.1" futures = "0.3.21" futures-timer = "3.0.1" rand = "0.8.5" -libp2p = { version = "0.46.1", default-features = false } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +libp2p = { version = "0.49.0", default-features = false } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } substrate-test-runtime-client = { version = "2.0.0", path = "../substrate-test-runtime-client" } substrate-test-runtime = { version = "2.0.0", path = "../substrate-test-runtime" } -sp-tracing = { version = "5.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-service = { version = "0.10.0-dev", default-features = false, features = ["test-helpers"], git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-tracing = { version = "5.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-service = { version = "0.10.0-dev", default-features = false, features = ["test-helpers"], git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } diff --git a/substrate/sc-network-test/src/block_import.rs b/substrate/sc-network-test/src/block_import.rs index 7c3e3861494..0e368657216 100644 --- a/substrate/sc-network-test/src/block_import.rs +++ b/substrate/sc-network-test/src/block_import.rs @@ -40,7 +40,7 @@ fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock) let (hash, number) = (client.block_hash(1).unwrap().unwrap(), 1); let header = client.header(&BlockId::Number(1)).unwrap(); - let justifications = client.justifications(&BlockId::Number(1)).unwrap(); + let justifications = client.justifications(hash).unwrap(); let peer_id = PeerId::random(); ( client, diff --git a/substrate/sc-network-test/src/lib.rs b/substrate/sc-network-test/src/lib.rs index 1990f9d6ad7..c378cb7a907 100644 --- a/substrate/sc-network-test/src/lib.rs +++ b/substrate/sc-network-test/src/lib.rs @@ -23,7 +23,6 @@ mod block_import; mod sync; use std::{ - borrow::Cow, collections::HashMap, pin::Pin, sync::Arc, @@ -43,22 +42,24 @@ use sc_client_api::{ FinalityNotifications, ImportNotifications, }; use sc_consensus::{BasicQueue, BlockCheckParams, BlockImport, BlockImportParams, BoxJustificationImport, ForkChoiceStrategy, ImportResult, JustificationImport, JustificationSyncLink, LongestChain, Verifier}; -pub use sc_network::config::EmptyTransactionPool; use sc_network::{ - config::{ - MultiaddrWithPeerId, NetworkConfiguration, NonDefaultSetConfig, NonReservedPeerMode, Role, - SyncMode, TransportConfig, - }, + config::{NetworkConfiguration, RequestResponseConfig, Role, SyncMode}, Multiaddr, NetworkService, NetworkWorker, }; +use sc_network_common::config::{ + MultiaddrWithPeerId, NonDefaultSetConfig, NonReservedPeerMode, TransportConfig, +}; pub use sc_network_common::config::ProtocolId; +use sc_network_common::protocol::ProtocolName; +use sc_network_common::protocol::role::Roles; use sc_network_common::service::{NetworkBlock, NetworkStateInfo, NetworkSyncForkRequest}; use sc_network_light::light_client_requests::handler::LightClientRequestHandler; use sc_network_sync::{block_request_handler::BlockRequestHandler, state_request_handler::StateRequestHandler, ChainSync}; +use sc_network_sync::service::network::NetworkServiceProvider; use sc_service::client::Client; use sp_blockchain::{ well_known_cache_keys::{self, Id as CacheKeyId}, - HeaderBackend, Info as BlockchainInfo, Result as ClientResult, + Backend as BlockchainBackend, HeaderBackend, Info as BlockchainInfo, Result as ClientResult, }; use sp_consensus::{block_validation::{BlockAnnounceValidator, DefaultBlockAnnounceValidator}, BlockOrigin, Error as ConsensusError, SyncOracle}; use sp_core::H256; @@ -67,6 +68,7 @@ use sp_runtime::{ traits::{Block as BlockT, Header as HeaderT, NumberFor}, Justification, Justifications, }; +use sp_runtime::traits::Zero; use substrate_test_runtime_client::AccountKeyring; pub use substrate_test_runtime_client::{ runtime::{Block, Extrinsic, Hash, Transfer}, @@ -158,10 +160,10 @@ impl PeersClient { Some(header) => header, None => return false, }; - self.backend.have_state_at(&header.hash(), *header.number()) + self.backend.have_state_at(header.hash(), *header.number()) } - pub fn justifications(&self, block: &BlockId) -> ClientResult> { + pub fn justifications(&self, block: ::Hash) -> ClientResult> { self.client.justifications(block) } @@ -175,7 +177,7 @@ impl PeersClient { pub fn finalize_block( &self, - id: BlockId, + id: ::Hash, justification: Option, notify: bool, ) -> ClientResult<()> { @@ -511,10 +513,17 @@ where self.verifier.failed_verifications.lock().clone() } - pub fn has_block(&self, hash: &H256) -> bool { + pub fn has_block(&self, hash: H256) -> bool { self.backend .as_ref() - .map(|backend| backend.blockchain().header(BlockId::hash(*hash)).unwrap().is_some()) + .map(|backend| backend.blockchain().header(BlockId::hash(hash)).unwrap().is_some()) + .unwrap_or(false) + } + + pub fn has_body(&self, hash: H256) -> bool { + self.backend + .as_ref() + .map(|backend| backend.blockchain().body(hash).unwrap().is_some()) .unwrap_or(false) } } @@ -627,11 +636,13 @@ pub struct FullPeerConfig { /// Pruning window size. /// /// NOTE: only finalized blocks are subject for removal! - pub keep_blocks: Option, + pub blocks_pruning: Option, /// Block announce validator. pub block_announce_validator: Option + Send + Sync>>, /// List of notification protocols that the network must support. - pub notifications_protocols: Vec>, + pub notifications_protocols: Vec, + /// List of request-response protocols that the network must support. + pub request_response_protocols: Vec, /// The indices of the peers the peer should be connected to. /// /// If `None`, it will be connected to all other peers. @@ -691,7 +702,7 @@ where /// Add a full peer. fn add_full_peer_with_config(&mut self, config: FullPeerConfig) { - let mut test_client_builder = match (config.keep_blocks, config.storage_chain) { + let mut test_client_builder = match (config.blocks_pruning, config.storage_chain) { (Some(keep_blocks), true) => TestClientBuilder::with_tx_storage(keep_blocks), (None, true) => TestClientBuilder::with_tx_storage(u32::MAX), (Some(keep_blocks), false) => TestClientBuilder::with_pruning_window(keep_blocks), @@ -727,12 +738,16 @@ where network_config.transport = TransportConfig::MemoryOnly; network_config.listen_addresses = vec![listen_addr.clone()]; network_config.allow_non_globals_in_dht = true; + network_config + .request_response_protocols + .extend(config.request_response_protocols); network_config.extra_sets = config .notifications_protocols .into_iter() .map(|p| NonDefaultSetConfig { notifications_protocol: p, fallback_names: Vec::new(), + handshake: None, max_notification_size: 1024 * 1024, set_config: Default::default(), }) @@ -778,7 +793,9 @@ where let block_announce_validator = config .block_announce_validator .unwrap_or_else(|| Box::new(DefaultBlockAnnounceValidator)); - let chain_sync = ChainSync::new( + let (chain_sync_network_provider, chain_sync_network_handle) = + NetworkServiceProvider::new(); + let (chain_sync, chain_sync_service) = ChainSync::new( match network_config.sync_mode { SyncMode::Full => sc_network_common::sync::SyncMode::Full, SyncMode::Fast { skip_proofs, storage_chain_mode } => @@ -792,31 +809,50 @@ where block_announce_validator, network_config.max_parallel_downloads, None, + chain_sync_network_handle, ) .unwrap(); + let block_announce_config = chain_sync.get_block_announce_proto_config( + protocol_id.clone(), + &fork_id, + Roles::from(if config.is_authority { &Role::Authority } else { &Role::Full }), + client.info().best_number, + client.info().best_hash, + client + .block_hash(Zero::zero()) + .ok() + .flatten() + .expect("Genesis block exists; qed"), + network_config.force_synced, + ); + let network = NetworkWorker::new(sc_network::config::Params { role: if config.is_authority { Role::Authority } else { Role::Full }, executor: None, - transactions_handler_executor: Box::new(|task| { - async_std::task::spawn(task); - }), network_config, chain: client.clone(), - transaction_pool: Arc::new(EmptyTransactionPool), protocol_id, fork_id, import_queue, chain_sync: Box::new(chain_sync), + chain_sync_service, metrics_registry: None, + block_announce_config, block_request_protocol_config, state_request_protocol_config, light_client_request_protocol_config, warp_sync_protocol_config: None, + request_response_protocol_configs: vec![] }) .unwrap(); trace!(target: "test_network", "Peer identifier: {}", network.service().local_peer_id()); + let service = network.service().clone(); + async_std::task::spawn(async move { + chain_sync_network_provider.run(service).await; + }); + self.mut_peers(move |peers| { for peer in peers.iter_mut() { peer.network @@ -1015,7 +1051,7 @@ impl JustificationImport for ForceFinalized { justification: Justification, ) -> Result<(), Self::Error> { self.0 - .finalize_block(BlockId::Hash(hash), Some(justification), true) + .finalize_block(hash, Some(justification), true) .map_err(|_| ConsensusError::InvalidJustification) } } diff --git a/substrate/sc-network-test/src/sync.rs b/substrate/sc-network-test/src/sync.rs index 27269a3ec18..64dc064e9de 100644 --- a/substrate/sc-network-test/src/sync.rs +++ b/substrate/sc-network-test/src/sync.rs @@ -260,44 +260,40 @@ fn sync_justifications() { net.peer(0).push_blocks(20, false); net.block_until_sync(); + let backend = net.peer(0).client().as_backend(); + let hashof10 = backend.blockchain().expect_block_hash_from_id(&BlockId::Number(10)).unwrap(); + let hashof15 = backend.blockchain().expect_block_hash_from_id(&BlockId::Number(15)).unwrap(); + let hashof20 = backend.blockchain().expect_block_hash_from_id(&BlockId::Number(20)).unwrap(); + // there's currently no justification for block #10 - assert_eq!(net.peer(0).client().justifications(&BlockId::Number(10)).unwrap(), None); - assert_eq!(net.peer(1).client().justifications(&BlockId::Number(10)).unwrap(), None); + assert_eq!(net.peer(0).client().justifications(hashof10).unwrap(), None); + assert_eq!(net.peer(1).client().justifications(hashof10).unwrap(), None); // we finalize block #10, #15 and #20 for peer 0 with a justification let just = (*b"FRNK", Vec::new()); - net.peer(0) - .client() - .finalize_block(BlockId::Number(10), Some(just.clone()), true) - .unwrap(); - net.peer(0) - .client() - .finalize_block(BlockId::Number(15), Some(just.clone()), true) - .unwrap(); - net.peer(0) - .client() - .finalize_block(BlockId::Number(20), Some(just), true) - .unwrap(); + net.peer(0).client().finalize_block(hashof10, Some(just.clone()), true).unwrap(); + net.peer(0).client().finalize_block(hashof15, Some(just.clone()), true).unwrap(); + net.peer(0).client().finalize_block(hashof20, Some(just), true).unwrap(); - let h1 = net.peer(1).client().header(&BlockId::Number(10)).unwrap().unwrap(); - let h2 = net.peer(1).client().header(&BlockId::Number(15)).unwrap().unwrap(); - let h3 = net.peer(1).client().header(&BlockId::Number(20)).unwrap().unwrap(); + let hashof10 = net.peer(1).client().header(&BlockId::Number(10)).unwrap().unwrap().hash(); + let hashof15 = net.peer(1).client().header(&BlockId::Number(15)).unwrap().unwrap().hash(); + let hashof20 = net.peer(1).client().header(&BlockId::Number(20)).unwrap().unwrap().hash(); // peer 1 should get the justifications from the network - net.peer(1).request_justification(&h1.hash(), 10); - net.peer(1).request_justification(&h2.hash(), 15); - net.peer(1).request_justification(&h3.hash(), 20); + net.peer(1).request_justification(&hashof10, 10); + net.peer(1).request_justification(&hashof15, 15); + net.peer(1).request_justification(&hashof20, 20); block_on(futures::future::poll_fn::<(), _>(|cx| { net.poll(cx); - for height in (10..21).step_by(5) { - if net.peer(0).client().justifications(&BlockId::Number(height)).unwrap() != + for hash in [hashof10, hashof15, hashof20] { + if net.peer(0).client().justifications(hash).unwrap() != Some(Justifications::from((*b"FRNK", Vec::new()))) { return Poll::Pending } - if net.peer(1).client().justifications(&BlockId::Number(height)).unwrap() != + if net.peer(1).client().justifications(hash).unwrap() != Some(Justifications::from((*b"FRNK", Vec::new()))) { return Poll::Pending @@ -324,10 +320,7 @@ fn sync_justifications_across_forks() { net.block_until_sync(); let just = (*b"FRNK", Vec::new()); - net.peer(0) - .client() - .finalize_block(BlockId::Hash(f1_best), Some(just), true) - .unwrap(); + net.peer(0).client().finalize_block(f1_best, Some(just), true).unwrap(); net.peer(1).request_justification(&f1_best, 10); net.peer(1).request_justification(&f2_best, 11); @@ -335,9 +328,9 @@ fn sync_justifications_across_forks() { block_on(futures::future::poll_fn::<(), _>(|cx| { net.poll(cx); - if net.peer(0).client().justifications(&BlockId::Number(10)).unwrap() == + if net.peer(0).client().justifications(f1_best).unwrap() == Some(Justifications::from((*b"FRNK", Vec::new()))) && - net.peer(1).client().justifications(&BlockId::Number(10)).unwrap() == + net.peer(1).client().justifications(f1_best).unwrap() == Some(Justifications::from((*b"FRNK", Vec::new()))) { Poll::Ready(()) @@ -384,10 +377,10 @@ fn syncs_all_forks() { net.block_until_sync(); // Check that all peers have all of the branches. - assert!(net.peer(0).has_block(&b1)); - assert!(net.peer(0).has_block(&b2)); - assert!(net.peer(1).has_block(&b1)); - assert!(net.peer(1).has_block(&b2)); + assert!(net.peer(0).has_block(b1)); + assert!(net.peer(0).has_block(b2)); + assert!(net.peer(1).has_block(b1)); + assert!(net.peer(1).has_block(b2)); } #[test] @@ -566,7 +559,7 @@ fn syncs_header_only_forks() { sp_tracing::try_init_simple(); let mut net = TestNet::new(0); net.add_full_peer_with_config(Default::default()); - net.add_full_peer_with_config(FullPeerConfig { keep_blocks: Some(3), ..Default::default() }); + net.add_full_peer_with_config(FullPeerConfig { blocks_pruning: Some(3), ..Default::default() }); net.peer(0).push_blocks(2, false); net.peer(1).push_blocks(2, false); @@ -575,9 +568,13 @@ fn syncs_header_only_forks() { net.peer(1).push_blocks(4, false); // Peer 1 will sync the small fork even though common block state is missing - while !net.peer(1).has_block(&small_hash) { + while !net.peer(1).has_block(small_hash) { net.block_until_idle(); } + + net.block_until_sync(); + assert_eq!(net.peer(0).client().info().best_hash, net.peer(1).client().info().best_hash); + assert_ne!(small_hash, net.peer(0).client().info().best_hash); } #[test] @@ -681,19 +678,13 @@ fn can_sync_to_peers_with_wrong_common_block() { // both peers re-org to the same fork without notifying each other let just = Some((*b"FRNK", Vec::new())); - net.peer(0) - .client() - .finalize_block(BlockId::Hash(fork_hash), just.clone(), true) - .unwrap(); - net.peer(1) - .client() - .finalize_block(BlockId::Hash(fork_hash), just, true) - .unwrap(); + net.peer(0).client().finalize_block(fork_hash, just.clone(), true).unwrap(); + net.peer(1).client().finalize_block(fork_hash, just, true).unwrap(); let final_hash = net.peer(0).push_blocks(1, false); net.block_until_sync(); - assert!(net.peer(1).has_block(&final_hash)); + assert!(net.peer(1).has_block(final_hash)); } /// Returns `is_new_best = true` for each validated announcement. @@ -755,7 +746,7 @@ fn sync_blocks_when_block_announce_validator_says_it_is_new_best() { ForkChoiceStrategy::Custom(false), ); - while !net.peer(2).has_block(&block_hash) { + while !net.peer(2).has_block(block_hash) { net.block_until_idle(); } } @@ -799,7 +790,7 @@ fn wait_until_deferred_block_announce_validation_is_ready() { ForkChoiceStrategy::Custom(false), ); - while !net.peer(1).has_block(&block_hash) { + while !net.peer(1).has_block(block_hash) { net.block_until_idle(); } } @@ -821,7 +812,7 @@ fn sync_to_tip_requires_that_sync_protocol_is_informed_about_best_block() { net.block_until_idle(); // The peer should not have synced the block. - assert!(!net.peer(1).has_block(&block_hash)); + assert!(!net.peer(1).has_block(block_hash)); // Make sync protocol aware of the best block net.peer(0).network_service().new_best_block_imported(block_hash, 3); @@ -835,7 +826,7 @@ fn sync_to_tip_requires_that_sync_protocol_is_informed_about_best_block() { block_on(futures::future::poll_fn::<(), _>(|cx| { net.poll(cx); - if net.peer(2).has_block(&block_hash) { + if net.peer(2).has_block(block_hash) { Poll::Ready(()) } else { Poll::Pending @@ -843,7 +834,7 @@ fn sync_to_tip_requires_that_sync_protocol_is_informed_about_best_block() { })); // However peer 1 should still not have the block. - assert!(!net.peer(1).has_block(&block_hash)); + assert!(!net.peer(1).has_block(block_hash)); } /// Ensures that if we as a syncing node sync to the tip while we are connected to another peer @@ -865,10 +856,10 @@ fn sync_to_tip_when_we_sync_together_with_multiple_peers() { net.block_until_connected(); net.block_until_idle(); - assert!(!net.peer(2).has_block(&block_hash)); + assert!(!net.peer(2).has_block(block_hash)); net.peer(0).network_service().new_best_block_imported(block_hash, 10_000); - while !net.peer(2).has_block(&block_hash) && !net.peer(1).has_block(&block_hash) { + while !net.peer(2).has_block(block_hash) && !net.peer(1).has_block(block_hash) { net.block_until_idle(); } } @@ -930,7 +921,7 @@ fn block_announce_data_is_propagated() { let block_hash = net.peer(0).push_blocks_at_without_announcing(BlockId::Number(0), 1, true); net.peer(0).announce_block(block_hash, Some(vec![137])); - while !net.peer(1).has_block(&block_hash) || !net.peer(2).has_block(&block_hash) { + while !net.peer(1).has_block(block_hash) || !net.peer(2).has_block(block_hash) { net.block_until_idle(); } } @@ -975,7 +966,7 @@ fn continue_to_sync_after_some_block_announcement_verifications_failed() { let block_hash = net.peer(0).push_blocks(500, true); net.block_until_sync(); - assert!(net.peer(1).has_block(&block_hash)); + assert!(net.peer(1).has_block(block_hash)); } /// When being spammed by the same request of a peer, we ban this peer. However, we should only ban @@ -990,14 +981,14 @@ fn multiple_requests_are_accepted_as_long_as_they_are_not_fulfilled() { net.peer(0).push_blocks(10, false); net.block_until_sync(); - // there's currently no justification for block #10 - assert_eq!(net.peer(0).client().justifications(&BlockId::Number(10)).unwrap(), None); - assert_eq!(net.peer(1).client().justifications(&BlockId::Number(10)).unwrap(), None); + let hashof10 = net.peer(1).client().header(&BlockId::Number(10)).unwrap().unwrap().hash(); - let h1 = net.peer(1).client().header(&BlockId::Number(10)).unwrap().unwrap(); + // there's currently no justification for block #10 + assert_eq!(net.peer(0).client().justifications(hashof10).unwrap(), None); + assert_eq!(net.peer(1).client().justifications(hashof10).unwrap(), None); // Let's assume block 10 was finalized, but we still need the justification from the network. - net.peer(1).request_justification(&h1.hash(), 10); + net.peer(1).request_justification(&hashof10, 10); // Let's build some more blocks and wait always for the network to have synced them for _ in 0..5 { @@ -1009,16 +1000,23 @@ fn multiple_requests_are_accepted_as_long_as_they_are_not_fulfilled() { assert_eq!(1, net.peer(0).num_peers()); } + let hashof10 = net + .peer(0) + .client() + .as_backend() + .blockchain() + .expect_block_hash_from_id(&BlockId::Number(10)) + .unwrap(); // Finalize the block and make the justification available. net.peer(0) .client() - .finalize_block(BlockId::Number(10), Some((*b"FRNK", Vec::new())), true) + .finalize_block(hashof10, Some((*b"FRNK", Vec::new())), true) .unwrap(); block_on(futures::future::poll_fn::<(), _>(|cx| { net.poll(cx); - if net.peer(1).client().justifications(&BlockId::Number(10)).unwrap() != + if net.peer(1).client().justifications(hashof10).unwrap() != Some(Justifications::from((*b"FRNK", Vec::new()))) { return Poll::Pending @@ -1096,17 +1094,20 @@ fn syncs_state() { net.add_full_peer_with_config(FullPeerConfig { sync_mode: SyncMode::Fast { skip_proofs: *skip_proofs, storage_chain_mode: false }, ..Default::default() - }); - net.peer(0).push_blocks(64, false); + }); net.peer(0).push_blocks(64, false); // Wait for peer 1 to sync header chain. net.block_until_sync(); assert!(!net.peer(1).client().has_state_at(&BlockId::Number(64))); let just = (*b"FRNK", Vec::new()); - net.peer(1) + let hashof60 = net + .peer(0) .client() - .finalize_block(BlockId::Number(60), Some(just), true) + .as_backend() + .blockchain() + .expect_block_hash_from_id(&BlockId::Number(60)) .unwrap(); + net.peer(1).client().finalize_block(hashof60, Some(just), true).unwrap(); // Wait for state sync. block_on(futures::future::poll_fn::<(), _>(|cx| { net.poll(cx); @@ -1162,14 +1163,14 @@ fn syncs_indexed_blocks() { .peer(0) .client() .as_client() - .indexed_transaction(&indexed_key) + .indexed_transaction(indexed_key) .unwrap() .is_some()); assert!(net .peer(1) .client() .as_client() - .indexed_transaction(&indexed_key) + .indexed_transaction(indexed_key) .unwrap() .is_none()); @@ -1178,7 +1179,7 @@ fn syncs_indexed_blocks() { .peer(1) .client() .as_client() - .indexed_transaction(&indexed_key) + .indexed_transaction(indexed_key) .unwrap() .is_some()); } @@ -1197,7 +1198,7 @@ fn warp_sync() { ..Default::default() }); let gap_end = net.peer(0).push_blocks(63, false); - net.peer(0).push_blocks(1, false); + let target = net.peer(0).push_blocks(1, false); net.peer(1).push_blocks(64, false); net.peer(2).push_blocks(64, false); // Wait for peer 1 to sync state. @@ -1208,7 +1209,7 @@ fn warp_sync() { // Wait for peer 1 download block history block_on(futures::future::poll_fn::<(), _>(|cx| { net.poll(cx); - if net.peer(3).has_block(&gap_end) { + if net.peer(3).has_body(gap_end) && net.peer(3).has_body(target) { Poll::Ready(()) } else { Poll::Pending diff --git a/substrate/substrate-test-runtime-client/Cargo.toml b/substrate/substrate-test-runtime-client/Cargo.toml index 2f2704f268b..14dbe384935 100644 --- a/substrate/substrate-test-runtime-client/Cargo.toml +++ b/substrate/substrate-test-runtime-client/Cargo.toml @@ -12,15 +12,15 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -substrate-test-client = { version = "2.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +substrate-test-client = { version = "2.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } substrate-test-runtime = { version = "2.0.0", path = "../substrate-test-runtime" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } codec = { package = "parity-scale-codec", version = "3.1.5" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" diff --git a/substrate/substrate-test-runtime-transaction-pool/Cargo.toml b/substrate/substrate-test-runtime-transaction-pool/Cargo.toml index e285cc464ea..ae1e121fb0a 100644 --- a/substrate/substrate-test-runtime-transaction-pool/Cargo.toml +++ b/substrate/substrate-test-runtime-transaction-pool/Cargo.toml @@ -15,9 +15,9 @@ targets = ["x86_64-unknown-linux-gnu"] substrate-test-runtime-client = { version = "2.0.0", path = "../substrate-test-runtime-client" } parking_lot = "0.12.1" codec = { package = "parity-scale-codec", version = "3.1.5" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" thiserror = "1.0.32" diff --git a/substrate/substrate-test-runtime-transaction-pool/src/lib.rs b/substrate/substrate-test-runtime-transaction-pool/src/lib.rs index fe6f140fe2e..00f0ccb1951 100644 --- a/substrate/substrate-test-runtime-transaction-pool/src/lib.rs +++ b/substrate/substrate-test-runtime-transaction-pool/src/lib.rs @@ -22,7 +22,7 @@ use codec::Encode; use futures::future::ready; use parking_lot::RwLock; -use sp_blockchain::CachedHeaderMetadata; +use sp_blockchain::{CachedHeaderMetadata, TreeRoute}; use sp_runtime::{ generic::{self, BlockId}, traits::{ @@ -316,13 +316,13 @@ impl sc_transaction_pool::ChainApi for TestApi { Self::hash_and_length_inner(ex) } - fn block_body(&self, id: &BlockId) -> Self::BodyFuture { - futures::future::ready(Ok(match id { - BlockId::Number(num) => - self.chain.read().block_by_number.get(num).map(|b| b[0].0.extrinsics().to_vec()), - BlockId::Hash(hash) => - self.chain.read().block_by_hash.get(hash).map(|b| b.extrinsics().to_vec()), - })) + fn block_body(&self, hash: ::Hash) -> Self::BodyFuture { + futures::future::ready(Ok(self + .chain + .read() + .block_by_hash + .get(&hash) + .map(|b| b.extrinsics().to_vec()))) } fn block_header( @@ -336,6 +336,14 @@ impl sc_transaction_pool::ChainApi for TestApi { self.chain.read().block_by_hash.get(hash).map(|b| b.header().clone()), }) } + + fn tree_route( + &self, + from: ::Hash, + to: ::Hash, + ) -> Result, Self::Error> { + sp_blockchain::tree_route::(self, from, to).map_err(Into::into) + } } impl sp_blockchain::HeaderMetadata for TestApi { diff --git a/substrate/substrate-test-runtime/Cargo.toml b/substrate/substrate-test-runtime/Cargo.toml index ed756fc80e3..153db987932 100644 --- a/substrate/substrate-test-runtime/Cargo.toml +++ b/substrate/substrate-test-runtime/Cargo.toml @@ -13,34 +13,34 @@ publish = false targets = ["x86_64-unknown-linux-gnu"] [dependencies] -sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-application-crypto = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-consensus-subspace = { version = "0.1.0", default-features = false, path = "../../crates/sp-consensus-subspace" } -sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-keyring = { version = "6.0.0", optional = true, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime-interface = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-keyring = { version = "6.0.0", optional = true, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime-interface = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-objects = { version = "0.1.0", default-features = false, path = "../../crates/sp-objects" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-subspace = { version = "0.1.0", default-features = false, path = "../../crates/pallet-subspace" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -parity-util-mem = { version = "0.11.0", default-features = false, features = ["primitive-types"] } -sc-service = { version = "0.10.0-dev", default-features = false, optional = true, features = ["test-helpers"], git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-state-machine = { version = "0.12.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-externalities = { version = "0.12.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-trie = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +parity-util-mem = { version = "0.12.0", default-features = false, features = ["primitive-types"] } +sc-service = { version = "0.10.0-dev", default-features = false, optional = true, features = ["test-helpers"], git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-state-machine = { version = "0.12.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-externalities = { version = "0.12.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../../crates/subspace-core-primitives" } # 3rd party @@ -49,14 +49,14 @@ log = { version = "0.4.17", default-features = false } serde = { version = "1.0.143", optional = true, features = ["derive"] } [dev-dependencies] -sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-block-builder = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } substrate-test-runtime-client = { version = "2.0.0", path = "../substrate-test-runtime-client" } futures = "0.3.21" [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = [ diff --git a/substrate/substrate-test-runtime/src/lib.rs b/substrate/substrate-test-runtime/src/lib.rs index e2dc745d49b..fabbee55bff 100644 --- a/substrate/substrate-test-runtime/src/lib.rs +++ b/substrate/substrate-test-runtime/src/lib.rs @@ -26,8 +26,9 @@ pub mod system; use cfg_if::cfg_if; use codec::{Decode, Encode, Error, Input, MaxEncodedLen}; use core::num::NonZeroU64; +use frame_support::dispatch::RawOrigin; use frame_support::parameter_types; -use frame_support::traits::{ConstU32, ConstU64, CrateVersion}; +use frame_support::traits::{CallerTrait, ConstU32, ConstU64, CrateVersion}; use frame_support::weights::RuntimeDbWeight; use frame_system::limits::{BlockLength, BlockWeights}; use scale_info::TypeInfo; @@ -41,6 +42,7 @@ use sp_runtime::traits::{ BlakeTwo256, BlindCheckable, Block as BlockT, Extrinsic as ExtrinsicT, GetNodeBlockType, GetRuntimeBlockType, IdentityLookup, NumberFor, Verify, }; +use frame_support::weights::Weight; use sp_runtime::transaction_validity::{ InvalidTransaction, TransactionSource, TransactionValidity, TransactionValidityError, ValidTransaction, @@ -48,7 +50,7 @@ use sp_runtime::transaction_validity::{ use sp_runtime::{create_runtime_str, impl_opaque_keys, ApplyExtrinsicResult, Perbill}; use sp_std::marker::PhantomData; use sp_std::prelude::*; -use sp_trie::trie_types::{TrieDB, TrieDBMutV1 as TrieDBMut}; +use sp_trie::trie_types::{TrieDBBuilder,TrieDBMutBuilderV1}; use sp_trie::{PrefixedMemoryDB, StorageProof, Trie, TrieMut}; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; @@ -109,7 +111,7 @@ pub fn native_version() -> NativeVersion { } /// Calls in transactions. -#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] +#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, TypeInfo)] pub struct Transfer { pub from: AccountId, pub to: AccountId, @@ -148,7 +150,7 @@ impl Transfer { } /// Extrinsic for test-runtime. -#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode)] +#[derive(Debug, Clone, PartialEq, Eq, Encode, Decode, TypeInfo)] pub enum Extrinsic { Transfer { transfer: Transfer, @@ -221,11 +223,11 @@ impl ExtrinsicT for Extrinsic { } impl sp_runtime::traits::Dispatchable for Extrinsic { - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Config = (); type Info = (); type PostInfo = (); - fn dispatch(self, _origin: Self::Origin) -> sp_runtime::DispatchResultWithInfo { + fn dispatch(self, _origin: Self::RuntimeOrigin) -> sp_runtime::DispatchResultWithInfo { panic!("This implemention should not be used for actual dispatch."); } } @@ -425,22 +427,33 @@ impl GetRuntimeBlockType for Runtime { } #[derive(Debug, Clone, Encode, Decode, PartialEq, Eq, TypeInfo, MaxEncodedLen)] -pub struct Origin; +pub struct RuntimeOrigin; -impl From> for Origin { - fn from(_o: frame_system::Origin) -> Self { +impl From::AccountId>> for RuntimeOrigin { + fn from(_: RawOrigin<::AccountId>) -> Self { unimplemented!("Not required in tests!") } } -impl From for Result, Origin> { - fn from(_origin: Origin) -> Result, Origin> { + +impl CallerTrait<::AccountId> for RuntimeOrigin { + fn into_system(self) -> Option::AccountId>> { + unimplemented!("Not required in tests!") + } + + fn as_system_ref(&self) -> Option<&RawOrigin<::AccountId>> { + unimplemented!("Not required in tests!") + } +} + +impl From for Result, RuntimeOrigin> { + fn from(_origin: RuntimeOrigin) -> Result, RuntimeOrigin> { unimplemented!("Not required in tests!") } } -impl frame_support::traits::OriginTrait for Origin { - type Call = ::Call; - type PalletsOrigin = Origin; +impl frame_support::traits::OriginTrait for RuntimeOrigin { + type Call = ::RuntimeCall; + type PalletsOrigin = RuntimeOrigin; type AccountId = ::AccountId; fn add_filter(&mut self, _filter: impl Fn(&Self::Call) -> bool + 'static) { @@ -463,6 +476,10 @@ impl frame_support::traits::OriginTrait for Origin { unimplemented!("Not required in tests!") } + fn into_caller(self) -> Self::PalletsOrigin { + unimplemented!("Not required in tests!") + } + fn try_with_caller( self, _f: impl FnOnce(Self::PalletsOrigin) -> Result, @@ -476,24 +493,27 @@ impl frame_support::traits::OriginTrait for Origin { fn root() -> Self { unimplemented!("Not required in tests!") } - fn signed(_by: ::AccountId) -> Self { + fn signed(_by: Self::AccountId) -> Self { unimplemented!("Not required in tests!") } fn as_signed(self) -> Option { unimplemented!("Not required in tests!") } + fn as_system_ref(&self) -> Option<&RawOrigin> { + unimplemented!("Not required in tests!") + } } #[derive(Debug, Clone, Encode, Decode, Eq, PartialEq, TypeInfo)] -pub struct Event; +pub struct RuntimeEvent; -impl From> for Event { +impl From> for RuntimeEvent { fn from(_evt: frame_system::Event) -> Self { unimplemented!("Not required in tests!") } } -impl From> for Event { +impl From> for RuntimeEvent { fn from(_evt: pallet_subspace::Event) -> Self { unimplemented!("Not required in tests!") } @@ -559,15 +579,21 @@ parameter_types! { pub RuntimeBlockLength: BlockLength = BlockLength::max(4 * 1024 * 1024); pub RuntimeBlockWeights: BlockWeights = - BlockWeights::with_sensible_defaults(4 * 1024 * 1024, Perbill::from_percent(75)); + BlockWeights::with_sensible_defaults(Weight::from_ref_time(4 * 1024 * 1024), Perbill::from_percent(75)); +} + +impl From> for Extrinsic { + fn from(_: frame_system::Call) -> Self { + unimplemented!("Not required in tests!") + } } impl frame_system::Config for Runtime { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = RuntimeBlockWeights; type BlockLength = RuntimeBlockLength; - type Origin = Origin; - type Call = Extrinsic; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = Extrinsic; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -575,7 +601,7 @@ impl frame_system::Config for Runtime { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = (); type Version = (); @@ -589,6 +615,8 @@ impl frame_system::Config for Runtime { type MaxConsumers = ConstU32<16>; } +impl system::Config for Runtime {} + impl pallet_timestamp::Config for Runtime { /// A timestamp: milliseconds since the unix epoch. type Moment = u64; @@ -604,7 +632,7 @@ parameter_types! { } impl pallet_subspace::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type GlobalRandomnessUpdateInterval = ConstU64<10>; type EraDuration = ConstU64<5>; type InitialSolutionRange = ConstU64<{ u64::MAX }>; @@ -637,31 +665,23 @@ fn code_using_trie() -> u64 { (b"0103000000000000000464".to_vec(), b"0400000000".to_vec()), (b"0103000000000000000469".to_vec(), b"0401000000".to_vec()), ] - .to_vec(); + .to_vec(); let mut mdb = PrefixedMemoryDB::default(); let mut root = sp_std::default::Default::default(); - let _ = { - let mut t = TrieDBMut::::new(&mut mdb, &mut root); - for pair in &pairs { - let key: &[u8] = &pair.0; - let val: &[u8] = &pair.1; - if t.insert(key, val).is_err() { - return 101; + { + let mut t = TrieDBMutBuilderV1::::new(&mut mdb, &mut root).build(); + for (key, value) in &pairs { + if t.insert(key, value).is_err() { + return 101 } } - t - }; - - if let Ok(trie) = TrieDB::::new(&mdb, &root) { - if let Ok(iter) = trie.iter() { - iter.flatten().count() as u64 - } else { - 102 - } - } else { - 103 } + + let trie = TrieDBBuilder::::new(&mdb, &root).build(); + let res = if let Ok(iter) = trie.iter() { iter.flatten().count() as u64 } else { 102 }; + + res } impl_opaque_keys! { @@ -1254,7 +1274,7 @@ fn test_read_child_storage() { fn test_witness(proof: StorageProof, root: crate::Hash) { use sp_externalities::Externalities; let db: sp_trie::MemoryDB = proof.into_memory_db(); - let backend = sp_state_machine::TrieBackend::<_, crate::Hashing>::new(db, root); + let backend = sp_state_machine::TrieBackendBuilder::<_, crate::Hashing>::new(db, root).build(); let mut overlay = sp_state_machine::OverlayedChanges::default(); let mut cache = sp_state_machine::StorageTransactionCache::<_, _>::default(); let mut ext = sp_state_machine::Ext::new( @@ -1292,7 +1312,7 @@ mod tests { .set_execution_strategy(ExecutionStrategy::AlwaysWasm) .set_heap_pages(8) .build(); - let block_id = BlockId::Number(client.chain_info().best_number); + let block_id = BlockId::Hash(client.chain_info().best_hash); // Try to allocate 1024k of memory on heap. This is going to fail since it is twice larger // than the heap. @@ -1326,7 +1346,7 @@ mod tests { .set_execution_strategy(ExecutionStrategy::Both) .build(); let runtime_api = client.runtime_api(); - let block_id = BlockId::Number(client.chain_info().best_number); + let block_id = BlockId::Hash(client.chain_info().best_hash); runtime_api.test_storage(&block_id).unwrap(); } @@ -1336,7 +1356,8 @@ mod tests { let mut root = crate::Hash::default(); let mut mdb = sp_trie::MemoryDB::::default(); { - let mut trie = sp_trie::trie_types::TrieDBMutV1::new(&mut mdb, &mut root); + let mut trie = + sp_trie::trie_types::TrieDBMutBuilderV1::new(&mut mdb, &mut root).build(); trie.insert(b"value3", &[142]).expect("insert failed"); trie.insert(b"value4", &[124]).expect("insert failed"); }; @@ -1346,13 +1367,14 @@ mod tests { #[test] fn witness_backend_works() { let (db, root) = witness_backend(); - let backend = sp_state_machine::TrieBackend::<_, crate::Hashing>::new(db, root); + let backend = + sp_state_machine::TrieBackendBuilder::<_, crate::Hashing>::new(db, root).build(); let proof = sp_state_machine::prove_read(backend, vec![b"value3"]).unwrap(); let client = TestClientBuilder::new() .set_execution_strategy(ExecutionStrategy::Both) .build(); let runtime_api = client.runtime_api(); - let block_id = BlockId::Number(client.chain_info().best_number); + let block_id = BlockId::Hash(client.chain_info().best_hash); runtime_api.test_witness(&block_id, proof, root).unwrap(); } diff --git a/substrate/substrate-test-runtime/src/system.rs b/substrate/substrate-test-runtime/src/system.rs index 431df6c7215..a0fa8094e8f 100644 --- a/substrate/substrate-test-runtime/src/system.rs +++ b/substrate/substrate-test-runtime/src/system.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd. +// Copyright (C) 2017-2022 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,11 +19,11 @@ //! and depositing logs. use crate::{ - AccountId, Block, BlockNumber, Digest, Extrinsic, Header, Transfer, H256 as Hash, + AccountId, Block, BlockNumber, Digest, Extrinsic, Header, Runtime, Transfer, + H256 as Hash, }; use codec::{Decode, Encode, KeyedVec}; -use frame_support::{decl_module, decl_storage, storage}; -use frame_system::Config; +use frame_support::storage; use sp_core::storage::well_known_keys; use sp_io::{hashing::blake2_256, storage::root as storage_root, trie}; use sp_runtime::{ @@ -39,18 +39,32 @@ use sp_std::prelude::*; const NONCE_OF: &[u8] = b"nonce:"; const BALANCE_OF: &[u8] = b"balance:"; -decl_module! { - pub struct Module for enum Call where origin: T::Origin {} -} +pub use self::pallet::*; -decl_storage! { - trait Store for Module as TestRuntime { - ExtrinsicData: map hasher(blake2_128_concat) u32 => Vec; - // The current block number being processed. Set by `execute_block`. - Number get(fn number): Option; - ParentHash get(fn parent_hash): Hash; - StorageDigest get(fn storage_digest): Option; - } +#[frame_support::pallet] +mod pallet { + use super::*; + use frame_support::pallet_prelude::*; + + #[pallet::pallet] + #[pallet::generate_store(pub(super) trait Store)] + #[pallet::without_storage_info] + pub struct Pallet(PhantomData); + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::storage] + pub type ExtrinsicData = StorageMap<_, Blake2_128Concat, u32, Vec, ValueQuery>; + + // The current block number being processed. Set by `execute_block`. + #[pallet::storage] + pub type Number = StorageValue<_, BlockNumber, OptionQuery>; + + #[pallet::storage] + pub type ParentHash = StorageValue<_, Hash, ValueQuery>; + #[pallet::storage] + pub type StorageDigest = StorageValue<_, Digest, OptionQuery>; } pub fn balance_of_key(who: AccountId) -> Vec { @@ -67,9 +81,9 @@ pub fn nonce_of(who: AccountId) -> u64 { pub fn initialize_block(header: &Header) { // populate environment. - ::put(header.number); - ::put(header.parent_hash); - ::put(header.digest()); + >::put(header.number); + >::put(header.parent_hash); + >::put(header.digest()); storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &0u32); // try to read something that depends on current header digest @@ -80,11 +94,11 @@ pub fn initialize_block(header: &Header) { } pub fn get_block_number() -> Option { - Number::get() + >::get() } pub fn take_block_number() -> Option { - Number::take() + >::take() } #[derive(Copy, Clone)] @@ -118,8 +132,8 @@ fn execute_block_with_state_root_handler(block: &mut Block, mode: Mode) -> Heade header.state_root = new_header.state_root; } else { info_expect_equal_hash(&new_header.state_root, &header.state_root); - assert!( - new_header.state_root == header.state_root, + assert_eq!( + new_header.state_root, header.state_root, "Storage root must match that calculated.", ); } @@ -128,8 +142,8 @@ fn execute_block_with_state_root_handler(block: &mut Block, mode: Mode) -> Heade header.extrinsics_root = new_header.extrinsics_root; } else { info_expect_equal_hash(&new_header.extrinsics_root, &header.extrinsics_root); - assert!( - new_header.extrinsics_root == header.extrinsics_root, + assert_eq!( + new_header.extrinsics_root, header.extrinsics_root, "Transaction trie root must be valid.", ); } @@ -181,7 +195,7 @@ pub fn execute_transaction(utx: Extrinsic) -> ApplyExtrinsicResult { let extrinsic_index: u32 = storage::unhashed::get(well_known_keys::EXTRINSIC_INDEX).unwrap_or_default(); let result = execute_transaction_backend(&utx, extrinsic_index); - ExtrinsicData::insert(extrinsic_index, utx.encode()); + >::insert(extrinsic_index, utx.encode()); storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &(extrinsic_index + 1)); result } @@ -190,11 +204,11 @@ pub fn execute_transaction(utx: Extrinsic) -> ApplyExtrinsicResult { pub fn finalize_block() -> Header { use sp_core::storage::StateVersion; let extrinsic_index: u32 = storage::unhashed::take(well_known_keys::EXTRINSIC_INDEX).unwrap(); - let txs: Vec<_> = (0..extrinsic_index).map(ExtrinsicData::take).collect(); + let txs: Vec<_> = (0..extrinsic_index).map(>::take).collect(); let extrinsics_root = trie::blake2_256_ordered_root(txs, StateVersion::V0); - let number = ::take().expect("Number is set by `initialize_block`"); - let parent_hash = ::take(); - let digest = ::take().expect("StorageDigest is set by `initialize_block`"); + let number = >::take().expect("Number is set by `initialize_block`"); + let parent_hash = >::take(); + let digest = >::take().expect("StorageDigest is set by `initialize_block`"); // This MUST come after all changes to storage are done. Otherwise we will fail the // “Storage root does not match that calculated” assertion. @@ -303,10 +317,9 @@ mod tests { use sp_core::{ map, traits::{CodeExecutor, RuntimeCode}, - NeverNativeValue, }; use sp_io::{hashing::twox_128, TestExternalities}; - use substrate_test_runtime_client::AccountKeyring; + use substrate_test_runtime_client::{AccountKeyring, Sr25519Keyring}; // Declare an instance of the native executor dispatch for the test runtime. pub struct NativeDispatch; @@ -328,11 +341,18 @@ mod tests { } fn new_test_ext() -> TestExternalities { + let authorities = vec![ + Sr25519Keyring::Alice.to_raw_public(), + Sr25519Keyring::Bob.to_raw_public(), + Sr25519Keyring::Charlie.to_raw_public(), + ]; + TestExternalities::new_with_code( wasm_binary_unwrap(), sp_core::storage::Storage { top: map![ twox_128(b"latest").to_vec() => vec![69u8; 32], + twox_128(b"sys:auth").to_vec() => authorities.encode(), blake2_256(&AccountKeyring::Alice.to_raw_public().to_keyed_vec(b"balance:")).to_vec() => { vec![111u8, 0, 0, 0, 0, 0, 0, 0] }, @@ -380,14 +400,7 @@ mod tests { }; executor() - .call:: _>( - &mut ext, - &runtime_code, - "Core_execute_block", - &b.encode(), - false, - None, - ) + .call(&mut ext, &runtime_code, "Core_execute_block", &b.encode(), false) .0 .unwrap(); }) @@ -489,14 +502,7 @@ mod tests { }; executor() - .call:: _>( - &mut ext, - &runtime_code, - "Core_execute_block", - &b.encode(), - false, - None, - ) + .call(&mut ext, &runtime_code, "Core_execute_block", &b.encode(), false) .0 .unwrap(); }) diff --git a/test/subspace-test-client/Cargo.toml b/test/subspace-test-client/Cargo.toml index 19eda0fe542..b3a131783fc 100644 --- a/test/subspace-test-client/Cargo.toml +++ b/test/subspace-test-client/Cargo.toml @@ -18,15 +18,15 @@ targets = ["x86_64-unknown-linux-gnu"] bitvec = "1.0.1" futures = "0.3.21" schnorrkel = "0.9.1" -sc-chain-spec = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-client-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-chain-spec = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-client-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sc-consensus-subspace = { version = "0.1.0", path = "../../crates/sc-consensus-subspace" } -sc-executor = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", features = ["wasmtime"] } -sc-service = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["wasmtime"] } -sp-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-executor = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", features = ["wasmtime"] } +sc-service = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["wasmtime"] } +sp-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-consensus-subspace = { version = "0.1.0", path = "../../crates/sp-consensus-subspace" } -sp-core = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-archiving = { path = "../../crates/subspace-archiving" } subspace-core-primitives = { path = "../../crates/subspace-core-primitives" } subspace-runtime-primitives = { path = "../../crates/subspace-runtime-primitives" } diff --git a/test/subspace-test-runtime/Cargo.toml b/test/subspace-test-runtime/Cargo.toml index 552f57bfcb9..7f447526efa 100644 --- a/test/subspace-test-runtime/Cargo.toml +++ b/test/subspace-test-runtime/Cargo.toml @@ -18,12 +18,12 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } domain-test-runtime = { version = "0.1.0", default-features = false, path = "../../domains/test/runtime" } -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } hex-literal = { version = "0.3.3", optional = true } orml-vesting = { version = "0.4.1-dev", default-features = false, path = "../../orml/vesting" } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-domains = { version = "0.1.0", default-features = false, path = "../../crates/pallet-domains" } pallet-feeds = { version = "0.1.0", default-features = false, path = "../../crates/pallet-feeds" } pallet-grandpa-finality-verifier = { version = "0.1.0", default-features = false, path = "../../crates/pallet-grandpa-finality-verifier" } @@ -31,37 +31,37 @@ pallet-object-store = { version = "0.1.0", default-features = false, path = "../ pallet-offences-subspace = { version = "0.1.0", default-features = false, path = "../../crates/pallet-offences-subspace" } pallet-rewards = { version = "0.1.0", default-features = false, path = "../../crates/pallet-rewards" } pallet-subspace = { version = "0.1.0", default-features = false, path = "../../crates/pallet-subspace" } -pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } pallet-transaction-fees = { version = "0.1.0", default-features = false, path = "../../crates/pallet-transaction-fees" } -pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, version = "4.0.0-dev"} +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-block-builder = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, version = "4.0.0-dev"} sp-consensus-subspace = { version = "0.1.0", default-features = false, path = "../../crates/sp-consensus-subspace" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } sp-domains = { version = "0.1.0", default-features = false, path = "../../crates/sp-domains" } -sp-inherents = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, version = "4.0.0-dev"} +sp-inherents = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, version = "4.0.0-dev"} sp-objects = { version = "0.1.0", default-features = false, path = "../../crates/sp-objects" } -sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-core-primitives = { version = "0.1.0", default-features = false, path = "../../crates/subspace-core-primitives" } subspace-runtime-primitives = { version = "0.1.0", default-features = false, path = "../../crates/subspace-runtime-primitives" } subspace-verification = { version = "0.1.0", default-features = false, path = "../../crates/subspace-verification" } system-runtime-primitives = { version = "0.1.0", default-features = false, path = "../../domains/primitives/system-runtime" } # Used for the node template's RPCs -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [build-dependencies] subspace-wasm-tools = { version = "0.1.0", default-features = false, path = "../../crates/subspace-wasm-tools" } -substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } [features] default = ["std"] diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index e6e1d2c8c5c..257fea5a63e 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -169,7 +169,7 @@ parameter_types! { pub const Version: RuntimeVersion = VERSION; pub const BlockHashCount: BlockNumber = 2400; /// We allow for 2 seconds of compute with a 6 second average block time. - pub SubspaceBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO); + pub SubspaceBlockWeights: BlockWeights = BlockWeights::with_sensible_defaults(WEIGHT_PER_SECOND.saturating_mul(2).set_proof_size(u64::MAX), NORMAL_DISPATCH_RATIO); /// We allow for 3.75 MiB for `Normal` extrinsic with 5 MiB maximum block length. pub SubspaceBlockLength: BlockLength = BlockLength::max_with_normal_ratio(MAX_BLOCK_LENGTH, NORMAL_DISPATCH_RATIO); } @@ -188,7 +188,7 @@ impl frame_system::Config for Runtime { /// The identifier used to distinguish between accounts. type AccountId = AccountId; /// The aggregated dispatch type that is available for extrinsics. - type Call = Call; + type RuntimeCall = RuntimeCall; /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. @@ -202,9 +202,9 @@ impl frame_system::Config for Runtime { /// The header type. type Header = Header; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; /// The ubiquitous origin type. - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; /// Maximum number of block number to block hash mappings to keep (oldest pruned first). type BlockHashCount = ConstU32<250>; /// The weight of database operations that the runtime can invoke. @@ -239,7 +239,7 @@ parameter_types! { } impl pallet_subspace::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type GlobalRandomnessUpdateInterval = ConstU32; type EraDuration = ConstU32; type InitialSolutionRange = ConstU64; @@ -274,7 +274,7 @@ impl pallet_balances::Config for Runtime { /// The type for recording an account's balance. type Balance = Balance; /// The ubiquitous event type. - type Event = Event; + type RuntimeEvent = RuntimeEvent; type DustRemoval = (); // TODO: Correct value type ExistentialDeposit = ConstU128<{ 500 * SHANNON }>; @@ -320,7 +320,7 @@ impl Get for BlockchainHistorySize { } impl pallet_transaction_fees::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type MinReplicationFactor = ConstU16; type StorageFeesEscrowBlockReward = StorageFeesEscrowBlockReward; type StorageFeesEscrowBlockTax = StorageFeesEscrowBlockTax; @@ -359,8 +359,8 @@ impl pallet_transaction_payment::OnChargeTransaction for OnChargeTransa fn withdraw_fee( who: &AccountId, - call: &Call, - _info: &DispatchInfoOf, + call: &RuntimeCall, + _info: &DispatchInfoOf, fee: Self::Balance, tip: Self::Balance, ) -> Result { @@ -395,8 +395,8 @@ impl pallet_transaction_payment::OnChargeTransaction for OnChargeTransa fn correct_and_deposit_fee( who: &AccountId, - _dispatch_info: &DispatchInfoOf, - _post_info: &PostDispatchInfoOf, + _dispatch_info: &DispatchInfoOf, + _post_info: &PostDispatchInfoOf, corrected_fee: Self::Balance, tip: Self::Balance, liquidity_info: Self::LiquidityInfo, @@ -434,7 +434,7 @@ impl pallet_transaction_payment::OnChargeTransaction for OnChargeTransa } impl pallet_transaction_payment::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnChargeTransaction = OnChargeTransaction; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = IdentityFee; @@ -443,27 +443,27 @@ impl pallet_transaction_payment::Config for Runtime { } impl pallet_utility::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; type PalletsOrigin = OriginCaller; type WeightInfo = pallet_utility::weights::SubstrateWeight; } impl pallet_sudo::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; } impl frame_system::offchain::SendTransactionTypes for Runtime where - Call: From, + RuntimeCall: From, { type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = Call; + type OverarchingCall = RuntimeCall; } impl pallet_offences_subspace::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type OnOffenceHandler = Subspace; } @@ -473,7 +473,7 @@ parameter_types! { } impl pallet_domains::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type SecondaryHash = system_runtime_primitives::Hash; type ReceiptsPruningDepth = ReceiptsPruningDepth; type MaximumReceiptDrift = MaximumReceiptDrift; @@ -486,7 +486,7 @@ parameter_types! { } impl pallet_rewards::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type BlockReward = BlockReward; type VoteReward = VoteReward; @@ -543,7 +543,7 @@ parameter_types! { } impl pallet_feeds::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type FeedId = FeedId; type FeedProcessorKind = (); type MaxFeeds = MaxFeeds; @@ -560,7 +560,7 @@ impl pallet_grandpa_finality_verifier::Config for Runtime { } impl pallet_object_store::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; } parameter_types! { @@ -569,7 +569,7 @@ parameter_types! { } impl orml_vesting::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type MinVestedTransfer = MinVestedTransfer; type VestedTransferOrigin = EnsureNever; @@ -626,7 +626,8 @@ pub type SignedExtra = ( pallet_transaction_payment::ChargeTransactionPayment, ); /// Unchecked extrinsic type as expected by this runtime. -pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = + generic::UncheckedExtrinsic; /// Executive: handles dispatch to the various modules. pub type Executive = frame_executive::Executive< Runtime, @@ -636,11 +637,11 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, >; /// The payload being signed in transactions. -pub type SignedPayload = generic::SignedPayload; +pub type SignedPayload = generic::SignedPayload; fn extract_root_blocks(ext: &UncheckedExtrinsic) -> Option> { match &ext.function { - Call::Subspace(pallet_subspace::Call::store_root_blocks { root_blocks }) => { + RuntimeCall::Subspace(pallet_subspace::Call::store_root_blocks { root_blocks }) => { Some(root_blocks.clone()) } _ => None, @@ -753,7 +754,7 @@ fn extract_utility_block_object_mapping>( fn extract_call_block_object_mapping>( mut base_offset: u32, objects: &mut Vec, - call: &Call, + call: &RuntimeCall, recursion_depth_left: u16, successful_calls: &mut Peekable, ) { @@ -761,13 +762,13 @@ fn extract_call_block_object_mapping>( base_offset += 1; match call { - Call::Feeds(call) => { + RuntimeCall::Feeds(call) => { extract_feeds_block_object_mapping(base_offset, objects, call, successful_calls); } - Call::ObjectStore(call) => { + RuntimeCall::ObjectStore(call) => { extract_object_store_block_object_mapping(base_offset, objects, call); } - Call::Utility(call) => { + RuntimeCall::Utility(call) => { extract_utility_block_object_mapping( base_offset, objects, @@ -823,7 +824,7 @@ fn extract_system_bundles( let (system_bundles, core_bundles): (Vec<_>, Vec<_>) = extrinsics .into_iter() .filter_map(|uxt| { - if let Call::Domains(pallet_domains::Call::submit_bundle { + if let RuntimeCall::Domains(pallet_domains::Call::submit_bundle { signed_opaque_bundle, }) = uxt.function { @@ -850,7 +851,7 @@ fn extract_core_bundles( extrinsics .into_iter() .filter_map(|uxt| match uxt.function { - Call::Domains(pallet_domains::Call::submit_bundle { + RuntimeCall::Domains(pallet_domains::Call::submit_bundle { signed_opaque_bundle, }) if signed_opaque_bundle.domain_id() == domain_id => { Some(signed_opaque_bundle.bundle) @@ -866,7 +867,7 @@ fn extract_receipts( extrinsics .into_iter() .filter_map(|uxt| { - if let Call::Domains(pallet_domains::Call::submit_bundle { + if let RuntimeCall::Domains(pallet_domains::Call::submit_bundle { signed_opaque_bundle, }) = uxt.function { @@ -883,7 +884,7 @@ fn extract_fraud_proofs(extrinsics: Vec) -> Vec extrinsics .into_iter() .filter_map(|uxt| { - if let Call::Domains(pallet_domains::Call::submit_fraud_proof { fraud_proof }) = + if let RuntimeCall::Domains(pallet_domains::Call::submit_fraud_proof { fraud_proof }) = uxt.function { Some(fraud_proof) diff --git a/test/subspace-test-service/Cargo.toml b/test/subspace-test-service/Cargo.toml index 7cc6cf082e1..8e5bbb90301 100644 --- a/test/subspace-test-service/Cargo.toml +++ b/test/subspace-test-service/Cargo.toml @@ -15,29 +15,31 @@ include = [ targets = ["x86_64-unknown-linux-gnu"] [dependencies] -frame-system = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +frame-system = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } futures = "0.3.21" rand = "0.8.5" -pallet-balances = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -pallet-transaction-payment = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-client-api = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-executor = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-network = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sc-service = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false, features = ["wasmtime"] } -sc-tracing = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-arithmetic = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-keyring = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -sp-runtime = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +pallet-balances = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +pallet-transaction-payment = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-client-api = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-consensus-slots = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-executor = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-network-common = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sc-service = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false, features = ["wasmtime"] } +sc-tracing = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-arithmetic = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-blockchain = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-keyring = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +sp-runtime = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } subspace-runtime-primitives = { path = "../../crates/subspace-runtime-primitives" } subspace-service = { path = "../../crates/subspace-service" } subspace-test-client = { path = "../subspace-test-client" } subspace-test-runtime = { version = "0.1.0", features = ["do-not-enforce-cost-of-storage"], path = "../subspace-test-runtime" } -substrate-test-client = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +substrate-test-client = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } tokio = "1.20.1" [dev-dependencies] -sc-cli = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598", default-features = false } -sp-keyring = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } -substrate-test-utils = { git = "https://github.com/subspace/substrate", rev = "1a7c28721fa77ecce9632ad9ce473f2d3cf1a598" } +sc-cli = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f", default-features = false } +sp-keyring = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +substrate-test-utils = { git = "https://github.com/subspace/substrate", rev = "66d3f73c5ef66c975fa5f54b6736ccd6821e395f" } +tempfile = "3.3.0" diff --git a/test/subspace-test-service/src/lib.rs b/test/subspace-test-service/src/lib.rs index 5c4378bee59..796ba55822f 100644 --- a/test/subspace-test-service/src/lib.rs +++ b/test/subspace-test-service/src/lib.rs @@ -22,8 +22,9 @@ use futures::future::Future; use sc_client_api::execution_extensions::ExecutionStrategies; use sc_consensus_slots::SlotProportion; use sc_executor::NativeElseWasmExecutor; -use sc_network::config::{NetworkConfiguration, TransportConfig}; +use sc_network::config::NetworkConfiguration; use sc_network::{multiaddr, NetworkStateInfo}; +use sc_network_common::config::TransportConfig; use sc_service::config::{ DatabaseSource, KeystoreConfig, MultiaddrWithPeerId, WasmExecutionMethod, }; @@ -61,8 +62,8 @@ pub fn node_config( run_farmer: bool, force_authoring: bool, force_synced: bool, + base_path: BasePath, ) -> Configuration { - let base_path = BasePath::new_temp_dir().expect("Could not create temporary directory"); let root = base_path.path(); let role = if run_farmer { Role::Authority @@ -104,10 +105,9 @@ pub fn node_config( database: DatabaseSource::ParityDb { path: root.join("paritydb"), }, - state_cache_size: 16777216, - state_cache_child_ratio: None, + trie_cache_maximum_size: Some(64 * 1024 * 1024), state_pruning: Default::default(), - blocks_pruning: BlocksPruning::All, + blocks_pruning: BlocksPruning::KeepAll, chain_spec: Box::new(spec), wasm_method: WasmExecutionMethod::Interpreted, wasm_runtime_overrides: Default::default(), @@ -159,6 +159,7 @@ pub async fn run_validator_node( run_farmer: bool, force_authoring: bool, force_synced: bool, + base_path: BasePath, ) -> (PrimaryTestNode, NetworkStarter) { let primary_chain_config = node_config( tokio_handle, @@ -167,6 +168,7 @@ pub async fn run_validator_node( run_farmer, force_authoring, force_synced, + base_path, ); let multiaddr = primary_chain_config.network.listen_addresses[0].clone(); let executor = NativeElseWasmExecutor::::new( @@ -252,7 +254,7 @@ impl PrimaryTestNode { /// Send an extrinsic to this node. pub async fn send_extrinsic( &self, - function: impl Into, + function: impl Into, caller: Sr25519Keyring, ) -> Result { let extrinsic = construct_extrinsic(&self.client, function, caller, 0); @@ -269,7 +271,7 @@ impl PrimaryTestNode { /// Construct an extrinsic that can be applied to the test runtime. pub fn construct_extrinsic( client: &Client, - function: impl Into, + function: impl Into, caller: Sr25519Keyring, nonce: u32, ) -> UncheckedExtrinsic { @@ -323,7 +325,7 @@ pub fn construct_transfer_extrinsic( dest: sp_keyring::AccountKeyring, value: Balance, ) -> UncheckedExtrinsic { - let function = subspace_test_runtime::Call::Balances(pallet_balances::Call::transfer { + let function = subspace_test_runtime::RuntimeCall::Balances(pallet_balances::Call::transfer { dest: MultiSigner::from(dest.public()).into_account().into(), value, }); @@ -334,12 +336,16 @@ pub fn construct_transfer_extrinsic( #[cfg(test)] mod tests { use super::run_validator_node; + use sc_service::BasePath; use sp_keyring::Sr25519Keyring::{Alice, Bob}; + use tempfile::TempDir; // TODO: always enable the test to catch any potential regressions. #[substrate_test_utils::test] #[ignore] async fn test_primary_node_catching_up() { + let directory = TempDir::new().expect("Must be able to create temporary directory"); + let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_colors(false); let _ = builder.init(); @@ -347,8 +353,16 @@ mod tests { let tokio_handle = tokio::runtime::Handle::current(); // start alice - let (alice, alice_network_starter) = - run_validator_node(tokio_handle.clone(), Alice, vec![], true, true, true).await; + let (alice, alice_network_starter) = run_validator_node( + tokio_handle.clone(), + Alice, + vec![], + true, + true, + true, + BasePath::new(directory.path().join("alice")), + ) + .await; alice_network_starter.start_network(); @@ -359,6 +373,7 @@ mod tests { false, false, false, + BasePath::new(directory.path().join("bob")), ) .await;