diff --git a/.circleci/config.yml b/.circleci/config.yml index 0c5ba59d63..374589edcf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -182,7 +182,7 @@ jobs: at: . - run: name: Run benchmarks - command: ./polymesh-benchmarks benchmark pallet -p=* -e=* -r 1 -s 1 --execution native --db-cache 512 --heap-pages=2048 + command: ./polymesh-benchmarks benchmark pallet -p=* -e=* -r 1 -s 2 --execution wasm --wasm-execution compiled --db-cache 512 --heap-pages=4096 no_output_timeout: 1h migration-tests: docker: diff --git a/.maintain/benchmarks_1.sh b/.maintain/benchmarks_1.sh index e25b682319..be9ffd260f 100755 --- a/.maintain/benchmarks_1.sh +++ b/.maintain/benchmarks_1.sh @@ -5,6 +5,7 @@ #./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_babe -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs >> data.txt 2>> log.txt ./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_timestamp -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs >> data.txt 2>> log.txt ./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_scheduler -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs >> data.txt 2>> log.txt +./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_preimage -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs >> data.txt 2>> log.txt ./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_indices -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs >> data.txt 2>> log.txt ./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_corporate_actions -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs >> data.txt 2>> log.txt ./target/release/polymesh benchmark pallet -s 100 -r 5 -p=pallet_asset -e=* --heap-pages 4096 --db-cache 512 --execution wasm --wasm-execution compiled --output ./pallets/weights/src/ --template ./.maintain/frame-weight-template.hbs >> data.txt 2>> log.txt diff --git a/.maintain/frame-weight-template.hbs b/.maintain/frame-weight-template.hbs index b37875046f..ae62083125 100644 --- a/.maintain/frame-weight-template.hbs +++ b/.maintain/frame-weight-template.hbs @@ -20,6 +20,7 @@ //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} //! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: {{cmd.repeat}}, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}` //! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}} +//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}` // Executed Command: {{#each args as |arg|~}} @@ -32,33 +33,37 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for {{pallet}} using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl {{pallet}}::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl {{pallet}}::WeightInfo for SubstrateWeight { {{#each benchmarks as |benchmark|}} {{#each benchmark.comments as |comment|}} // {{comment}} {{/each}} + {{#each benchmark.component_ranges as |range|}} + /// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`. + {{/each}} fn {{benchmark.name~}} ( {{~#each benchmark.components as |c| ~}} {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} ) -> Weight { - ({{underscore benchmark.base_weight}} as Weight) + // Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds. + Weight::from_ref_time({{underscore benchmark.base_weight}}) {{#each benchmark.component_weight as |cw|}} // Standard Error: {{underscore cw.error}} - .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)) + .saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into())) {{/each}} {{#if (ne benchmark.base_reads "0")}} - .saturating_add(DbWeight::get().reads({{benchmark.base_reads}} as Weight)) + .saturating_add(DbWeight::get().reads({{benchmark.base_reads}})) {{/if}} {{#each benchmark.component_reads as |cr|}} - .saturating_add(DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight))) + .saturating_add(DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into()))) {{/each}} {{#if (ne benchmark.base_writes "0")}} - .saturating_add(DbWeight::get().writes({{benchmark.base_writes}} as Weight)) + .saturating_add(DbWeight::get().writes({{benchmark.base_writes}})) {{/if}} {{#each benchmark.component_writes as |cw|}} - .saturating_add(DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))) + .saturating_add(DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into()))) {{/each}} } {{/each}} diff --git a/Cargo.lock b/Cargo.lock index 9d23019085..50957b752b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -97,7 +97,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -115,6 +115,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "array-bytes" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" + [[package]] name = "arrayref" version = "0.3.6" @@ -214,7 +220,7 @@ dependencies = [ "slab", "socket2", "waker-fn", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -241,7 +247,7 @@ dependencies = [ "libc", "once_cell", "signal-hook", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -273,9 +279,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", @@ -294,50 +300,28 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.57" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +checksum = "689894c2db1ea643a50834b999abf1c110887402542955ff5451dab8f861f9ed" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "asynchronous-codec" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4401f0a3622dad2e0763fa79e0eb328bc70fb7dccfdd645341f00d671247d6" -dependencies = [ - "bytes 1.2.1", - "futures-sink", - "futures-util", - "memchr", - "pin-project-lite 0.2.9", -] - [[package]] name = "asynchronous-codec" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0de5164e5edbf51c45fb8c2d9664ae1c095cce1b265ecf7569093c0d66ef690" dependencies = [ - "bytes 1.2.1", + "bytes", "futures-sink", "futures-util", "memchr", "pin-project-lite 0.2.9", ] -[[package]] -name = "atomic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] - [[package]] name = "atomic-waker" version = "1.0.0" @@ -350,9 +334,9 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -372,7 +356,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "miniz_oxide", - "object 0.29.0", + "object", "rustc-demangle", ] @@ -406,26 +390,54 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" +dependencies = [ + "serde", +] + +[[package]] +name = "beefy-merkle-tree" +version = "4.0.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "beefy-primitives", + "sp-api", + "sp-runtime", +] + [[package]] name = "beefy-primitives" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", + "serde", "sp-api", "sp-application-crypto", "sp-core", + "sp-io", + "sp-mmr-primitives", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] -[[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" @@ -437,9 +449,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.59.2" +version = "0.60.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" dependencies = [ "bitflags", "cexpr", @@ -484,9 +496,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.4" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9cf849ee05b2ee5fba5e36f97ff8ec2533916700fc0758d40d92136a42f3388" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ "digest 0.10.5", ] @@ -498,44 +510,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" dependencies = [ "arrayvec 0.4.12", - "constant_time_eq", + "constant_time_eq 0.1.5", ] [[package]] name = "blake2b_simd" -version = "0.5.11" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" +checksum = "72936ee4afc7f8f736d1c38383b56480b5497b4617b4a77bdbf1d2ababc76127" dependencies = [ "arrayref", - "arrayvec 0.5.2", - "constant_time_eq", + "arrayvec 0.7.2", + "constant_time_eq 0.1.5", ] [[package]] name = "blake2s_simd" -version = "0.5.11" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" +checksum = "db539cc2b5f6003621f1cd9ef92d7ded8ea5232c7de0f9faa2de251cd98730d4" dependencies = [ "arrayref", - "arrayvec 0.5.2", - "constant_time_eq", + "arrayvec 0.7.2", + "constant_time_eq 0.1.5", ] [[package]] name = "blake3" -version = "0.3.8" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64485778c4f16a6a5a9d335e80d449ac6c70cdd6a06d2af18a6f6f775a125b3" +checksum = "42ae2468a89544a466886840aa467a25b766499f4f04bf7d9fcd10ecee9fccef" dependencies = [ "arrayref", - "arrayvec 0.5.2", + "arrayvec 0.7.2", "cc", - "cfg-if 0.1.10", - "constant_time_eq", - "crypto-mac 0.8.0", - "digest 0.9.0", + "cfg-if 1.0.0", + "constant_time_eq 0.2.4", ] [[package]] @@ -645,9 +655,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" [[package]] name = "byte-slice-cast" @@ -673,16 +683,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "iovec", -] - [[package]] name = "bytes" version = "1.2.1" @@ -761,6 +761,15 @@ dependencies = [ "nom", ] +[[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 = "0.1.10" @@ -773,6 +782,12 @@ 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.8.2" @@ -810,18 +825,20 @@ dependencies = [ "num-traits", "time", "wasm-bindgen", - "winapi 0.3.9", + "winapi", ] [[package]] name = "cid" -version = "0.6.1" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff0e3bc0b6446b3f9663c1a6aba6ef06c5aeaa1bc92bd18077be337198ab9768" +checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ + "core2", "multibase", - "multihash 0.13.2", - "unsigned-varint 0.5.1", + "multihash", + "serde", + "unsigned-varint", ] [[package]] @@ -833,6 +850,15 @@ dependencies = [ "generic-array 0.14.6", ] +[[package]] +name = "ckb-merkle-mountain-range" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ccb671c5921be8a84686e6212ca184cb1d7c51cadcdbfcbd1cc3f042f5dfb8" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "clang-sys" version = "1.4.0" @@ -841,7 +867,7 @@ checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" dependencies = [ "glob 0.3.0", "libc", - "libloading 0.7.3", + "libloading", ] [[package]] @@ -863,8 +889,8 @@ checksum = "86447ad904c7fb335a790c9d7fe3d0d971dc523b8ccd1561a520de9a85302750" dependencies = [ "atty", "bitflags", - "clap_derive", - "clap_lex", + "clap_derive 3.2.18", + "clap_lex 0.2.4", "indexmap", "once_cell", "strsim", @@ -872,13 +898,41 @@ dependencies = [ "textwrap 0.15.1", ] +[[package]] +name = "clap" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa91278560fc226a5d9d736cc21e485ff9aad47d26b8ffe1f54cba868b684b9f" +dependencies = [ + "bitflags", + "clap_derive 4.1.0", + "clap_lex 0.3.1", + "is-terminal", + "once_cell", + "strsim", + "termcolor", +] + [[package]] name = "clap_derive" version = "3.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" dependencies = [ - "heck 0.4.0", + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_derive" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +dependencies = [ + "heck", "proc-macro-error", "proc-macro2", "quote", @@ -894,6 +948,15 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "783fe232adfca04f90f56201b26d79682d4cd2625e0bc7290b95123afe558ade" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "cmake" version = "0.1.48" @@ -903,6 +966,27 @@ dependencies = [ "cc", ] +[[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]] +name = "comfy-table" +version = "6.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d" +dependencies = [ + "strum", + "strum_macros", + "unicode-width", +] + [[package]] name = "concurrent-queue" version = "1.2.4" @@ -914,9 +998,9 @@ dependencies = [ [[package]] name = "confidential_identity_core" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b0f9e2eb3c951ec923091ca347a44131f8b16b5b589b8d1ea32ef141279f33" +checksum = "1165f4fc4f30b6a80fb56753d50546bee544590a09b4a5096f7f4ebca8de1917" dependencies = [ "blake2", "bulletproofs", @@ -929,15 +1013,15 @@ dependencies = [ "rand_core 0.6.4", "serde", "sha3 0.9.1", - "sp-std", + "sp-std 5.0.0", "zeroize", ] [[package]] name = "confidential_identity_v1" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab7fff78ec167a992b3b481fc41b9af5a6b89b72a3bc1bfd1130a46ee2c002f8" +checksum = "e5dcf7e6037d21fc4eeafc61abcfafaa9f0a25cee1dd52891d6cc63c865002d8" dependencies = [ "blake2", "byteorder", @@ -953,15 +1037,15 @@ dependencies = [ "serde_json", "sha3 0.9.1", "sp-io", - "sp-std", + "sp-std 5.0.0", "zeroize", ] [[package]] name = "confidential_identity_v2" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beacd7949ec15f217ed3b22d078618f0c67e582173b381985596c70a0ecb3c0a" +checksum = "eb85825cd7bde6b3fe4edb80580a02e16d3f376ba68dc35a8137ebdf40437521" dependencies = [ "blake2", "byteorder", @@ -977,15 +1061,15 @@ dependencies = [ "serde_json", "sha3 0.9.1", "sp-io", - "sp-std", + "sp-std 5.0.0", "zeroize", ] [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" [[package]] name = "constant_time_eq" @@ -993,6 +1077,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +[[package]] +name = "constant_time_eq" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" + [[package]] name = "convert_case" version = "0.4.0" @@ -1044,59 +1134,62 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38faa2a16616c8e78a18d37b4726b98bfd2de192f2fdc8a39ddf568a408a0f75" +checksum = "52056f6d0584484b57fa6c1a65c1fcb15f3780d8b6a758426d9e3084169b2ddd" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f192472a3ba23860afd07d2b0217dc628f21fcc72617aa1336d98e1671f33b" +checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" dependencies = [ + "arrayvec 0.7.2", + "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", "cranelift-entity", + "cranelift-isle", "gimli", "log", - "regalloc", + "regalloc2", "smallvec", "target-lexicon", ] [[package]] name = "cranelift-codegen-meta" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32ddb89e9b89d3d9b36a5b7d7ea3261c98235a76ac95ba46826b8ec40b1a24" +checksum = "1c451b81faf237d11c7e4f3165eeb6bac61112762c5cfe7b4c0fb7241474358f" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01fd0d9f288cc1b42d9333b7a776b17e278fc888c28e6a0f09b5573d45a150bc" +checksum = "e7c940133198426d26128f08be2b40b0bd117b84771fd36798969c4d712d81fc" [[package]] name = "cranelift-entity" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3bfe172b83167604601faf9dc60453e0d0a93415b57a9c4d1a7ae6849185cf" +checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a006e3e32d80ce0e4ba7f1f9ddf66066d052a8c884a110b91d05404d6ce26dce" +checksum = "34897538b36b216cc8dd324e73263596d51b8cf610da6498322838b2546baf8a" dependencies = [ "cranelift-codegen", "log", @@ -1104,11 +1197,17 @@ dependencies = [ "target-lexicon", ] +[[package]] +name = "cranelift-isle" +version = "0.88.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b2629a569fae540f16a76b70afcc87ad7decb38dc28fa6c648ac73b51e78470" + [[package]] name = "cranelift-native" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501241b0cdf903412ec9075385ac9f2b1eb18a89044d1538e97fab603231f70c" +checksum = "20937dab4e14d3e225c5adfc9c7106bafd4ac669bdb43027b911ff794c6fb318" dependencies = [ "cranelift-codegen", "libc", @@ -1117,9 +1216,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.82.3" +version = "0.88.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d9e4211bbc3268042a96dd4de5bd979cda22434991d035f5f8eacba987fad2" +checksum = "80fc2288957a94fd342a015811479de1837850924166d1f1856d8406e6f3609b" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1229,9 +1328,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", @@ -1328,15 +1427,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ct-logs" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" -dependencies = [ - "sct 0.6.1", -] - [[package]] name = "ctor" version = "0.1.22" @@ -1356,17 +1446,6 @@ dependencies = [ "cipher", ] -[[package]] -name = "cuckoofilter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" -dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", -] - [[package]] name = "curve25519-dalek" version = "2.1.3" @@ -1420,6 +1499,50 @@ dependencies = [ "zeroize", ] +[[package]] +name = "cxx" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d1075c37807dcf850c379432f0df05ba52cc30f279c5cfc43cc221ce7f8579" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5044281f61b27bc598f2f6647d480aed48d2bf52d6eb0b627d84c0361b17aa70" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b50bc93ba22c27b0d31128d2d130a0a6b3d267ae27ef7e4fae2167dfe8781c" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "data-encoding" version = "2.3.2" @@ -1448,11 +1571,12 @@ dependencies = [ [[package]] name = "der" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", + "zeroize", ] [[package]] @@ -1468,6 +1592,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" @@ -1516,17 +1646,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" -dependencies = [ - "libc", - "redox_users 0.3.5", - "winapi 0.3.9", -] - [[package]] name = "dirs-sys" version = "0.3.7" @@ -1534,8 +1653,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", - "redox_users 0.4.3", - "winapi 0.3.9", + "redox_users", + "winapi", ] [[package]] @@ -1545,8 +1664,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users 0.4.3", - "winapi 0.3.9", + "redox_users", + "winapi", ] [[package]] @@ -1559,6 +1678,12 @@ dependencies = [ "quick-error", ] +[[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" @@ -1615,9 +1740,9 @@ checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" [[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", @@ -1627,9 +1752,9 @@ dependencies = [ [[package]] name = "ed25519" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9c280362032ea4203659fc489832d0204ef09f247a0506f170dafcac08c369" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ "signature", ] @@ -1648,6 +1773,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", + "hex", + "rand_core 0.6.4", + "sha2 0.9.9", + "zeroize", +] + [[package]] name = "ego-tree" version = "0.6.2" @@ -1662,13 +1801,14 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[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.5", "ff", "generic-array 0.14.6", "group", @@ -1678,19 +1818,13 @@ dependencies = [ "zeroize", ] -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - [[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 0.4.0", + "heck", "proc-macro2", "quote", "syn", @@ -1736,7 +1870,7 @@ checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ "errno-dragonfly", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1761,7 +1895,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.24", + "futures", ] [[package]] @@ -1796,9 +1930,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", @@ -1814,27 +1948,39 @@ dependencies = [ "log", ] +[[package]] +name = "filetime" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "windows-sys 0.42.0", +] + [[package]] name = "finality-grandpa" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9def033d8505edf199f6a5d07aa7e6d2d6185b164293b77f0efd108f4f3e11d" +checksum = "e24e6c429951433ccb7c87fd528c60084834dcd14763182c1f83291bcde24c34" dependencies = [ "either", - "futures 0.3.24", + "futures", "futures-timer", "log", "num-traits", "parity-scale-codec 3.2.1", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "scale-info", ] [[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", "rand 0.8.5", @@ -1860,15 +2006,24 @@ dependencies = [ ] [[package]] -name = "fnv" -version = "1.0.7" +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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", ] @@ -1879,13 +2034,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" dependencies = [ - "percent-encoding 2.2.0", + "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/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "frame-system", @@ -1897,27 +2058,30 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", + "sp-core", "sp-io", "sp-runtime", "sp-runtime-interface", - "sp-std", - "sp-storage", + "sp-std 5.0.0", + "sp-storage 7.0.0", ] [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "Inflector", + "array-bytes", "chrono", - "clap 3.2.22", + "clap 4.1.0", + "comfy-table", "frame-benchmarking", "frame-support", "frame-system", + "gethostname", "handlebars", "hash-db", - "hex", "itertools", "kvdb", "lazy_static", @@ -1925,7 +2089,6 @@ dependencies = [ "log", "memory-db", "parity-scale-codec 3.2.1", - "prettytable-rs", "rand 0.8.5", "rand_pcg 0.3.1", "sc-block-builder", @@ -1942,12 +2105,13 @@ dependencies = [ "sp-blockchain", "sp-core", "sp-database", - "sp-externalities", + "sp-externalities 0.13.0", "sp-inherents", "sp-keystore", "sp-runtime", "sp-state-machine", - "sp-storage", + "sp-std 5.0.0", + "sp-storage 7.0.0", "sp-trie", "tempfile", "thiserror", @@ -1957,7 +2121,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -1968,7 +2132,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -1978,13 +2142,13 @@ dependencies = [ "sp-arithmetic", "sp-npos-elections", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "frame-system", @@ -1993,8 +2157,8 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", - "sp-tracing", + "sp-std 5.0.0", + "sp-tracing 6.0.0", ] [[package]] @@ -2012,7 +2176,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "bitflags", "frame-metadata", @@ -2026,6 +2190,7 @@ dependencies = [ "scale-info", "serde", "smallvec", + "sp-api", "sp-arithmetic", "sp-core", "sp-core-hashing-proc-macro", @@ -2034,18 +2199,21 @@ dependencies = [ "sp-runtime", "sp-staking", "sp-state-machine", - "sp-std", - "sp-tracing", + "sp-std 5.0.0", + "sp-tracing 6.0.0", + "sp-weights", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "Inflector", + "cfg-expr", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -2054,7 +2222,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.2.1", @@ -2066,7 +2234,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro2", "quote", @@ -2076,7 +2244,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "log", @@ -2086,14 +2254,15 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", + "sp-weights", ] [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -2102,30 +2271,18 @@ dependencies = [ "scale-info", "sp-core", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "sp-api", ] -[[package]] -name = "fs-swap" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d47dad3685eceed8488986cad3d5027165ea5edb164331770e2059555f10a5" -dependencies = [ - "lazy_static", - "libc", - "libloading 0.5.2", - "winapi 0.3.9", -] - [[package]] name = "fs2" version = "0.4.3" @@ -2133,7 +2290,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2142,22 +2299,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394" -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "funty" version = "2.0.0" @@ -2174,12 +2315,6 @@ dependencies = [ "new_debug_unreachable", ] -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - [[package]] name = "futures" version = "0.3.24" @@ -2262,8 +2397,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" dependencies = [ "futures-io", - "rustls 0.20.6", - "webpki 0.22.0", + "rustls", + "webpki", ] [[package]] @@ -2290,7 +2425,6 @@ version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" dependencies = [ - "futures 0.1.31", "futures-channel", "futures-core", "futures-io", @@ -2331,6 +2465,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "gethostname" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "getopts" version = "0.2.21" @@ -2426,9 +2570,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", @@ -2441,7 +2585,7 @@ version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" dependencies = [ - "bytes 1.2.1", + "bytes", "fnv", "futures-core", "futures-sink", @@ -2450,7 +2594,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.4", + "tokio-util", "tracing", ] @@ -2498,15 +2642,6 @@ dependencies = [ "ahash", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.0" @@ -2522,6 +2657,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -2553,12 +2697,6 @@ dependencies = [ "proc-macro-hack", ] -[[package]] -name = "hex_fmt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" - [[package]] name = "hmac" version = "0.8.1" @@ -2579,6 +2717,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.5", +] + [[package]] name = "hmac-drbg" version = "0.3.0" @@ -2598,7 +2745,7 @@ checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ "libc", "match_cfg", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2621,9 +2768,9 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" dependencies = [ - "bytes 1.2.1", + "bytes", "fnv", - "itoa 1.0.3", + "itoa 1.0.5", ] [[package]] @@ -2632,7 +2779,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ - "bytes 1.2.1", + "bytes", "http", "pin-project-lite 0.2.9", ] @@ -2670,7 +2817,7 @@ version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" dependencies = [ - "bytes 1.2.1", + "bytes", "futures-channel", "futures-core", "futures-util", @@ -2679,7 +2826,7 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.3", + "itoa 1.0.5", "pin-project-lite 0.2.9", "socket2", "tokio", @@ -2690,19 +2837,17 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.22.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ - "ct-logs", - "futures-util", + "http", "hyper", "log", - "rustls 0.19.1", + "rustls", "rustls-native-certs", "tokio", "tokio-rustls", - "webpki 0.21.4", ] [[package]] @@ -2715,18 +2860,7 @@ dependencies = [ "core-foundation-sys", "js-sys", "wasm-bindgen", - "winapi 0.3.9", -] - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "winapi", ] [[package]] @@ -2757,19 +2891,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbc0fa01ffc752e9dbc72818cdb072cd028b86be5e09dd04c5a643704fe101a9" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[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", "fnv", - "futures 0.3.24", + "futures", "if-addrs", "ipnet", "log", @@ -2796,6 +2930,15 @@ dependencies = [ "serde", ] +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -2818,6 +2961,12 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + [[package]] name = "ink_prelude" version = "2.1.0" @@ -2857,17 +3006,18 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "0.5.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" [[package]] -name = "iovec" -version = "0.1.4" +name = "io-lifetimes" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +checksum = "e7d6c6f8c91b4b9ed43484ad1a938e393caf35960fce7f82a040497207bd8e9e" dependencies = [ "libc", + "windows-sys 0.42.0", ] [[package]] @@ -2884,7 +3034,7 @@ checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" dependencies = [ "socket2", "widestring", - "winapi 0.3.9", + "winapi", "winreg", ] @@ -2894,6 +3044,18 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +[[package]] +name = "is-terminal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +dependencies = [ + "hermit-abi 0.2.6", + "io-lifetimes 1.0.4", + "rustix 0.36.6", + "windows-sys 0.42.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -2911,9 +3073,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "jobserver" @@ -2934,147 +3096,122 @@ dependencies = [ ] [[package]] -name = "jsonrpc-client-transports" -version = "18.0.0" +name = "jsonrpsee" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b99d4207e2a04fb4581746903c2bb7eb376f88de9c699d0f3e10feeac0cd3a" +checksum = "8bd0d559d5e679b1ab2f869b486a11182923863b1b3ee8b421763cdd707b783a" dependencies = [ - "derive_more", - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-pubsub", - "log", - "serde", - "serde_json", - "url 1.7.2", + "jsonrpsee-core", + "jsonrpsee-http-server", + "jsonrpsee-proc-macros", + "jsonrpsee-types", + "jsonrpsee-ws-server", + "tracing", ] [[package]] -name = "jsonrpc-core" -version = "18.0.0" +name = "jsonrpsee-core" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" +checksum = "f3dc3e9cf2ba50b7b1d7d76a667619f82846caa39e8e8daa8a4962d74acaddca" dependencies = [ - "futures 0.3.24", - "futures-executor", + "anyhow", + "arrayvec 0.7.2", + "async-trait", + "beef", + "futures-channel", "futures-util", - "log", + "globset", + "http", + "hyper", + "jsonrpsee-types", + "lazy_static", + "parking_lot 0.12.1", + "rand 0.8.5", + "rustc-hash", "serde", - "serde_derive", "serde_json", + "soketto", + "thiserror", + "tokio", + "tracing", + "unicase", ] [[package]] -name = "jsonrpc-core-client" -version = "18.0.0" +name = "jsonrpsee-http-server" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b51da17abecbdab3e3d4f26b01c5ec075e88d3abe3ab3b05dc9aa69392764ec0" +checksum = "03802f0373a38c2420c70b5144742d800b509e2937edc4afb116434f07120117" dependencies = [ - "futures 0.3.24", - "jsonrpc-client-transports", + "futures-channel", + "futures-util", + "hyper", + "jsonrpsee-core", + "jsonrpsee-types", + "serde", + "serde_json", + "tokio", + "tracing", + "tracing-futures", ] [[package]] -name = "jsonrpc-derive" -version = "18.0.0" +name = "jsonrpsee-proc-macros" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b939a78fa820cdfcb7ee7484466746a7377760970f6f9c6fe19f9edcc8a38d2" +checksum = "bd67957d4280217247588ac86614ead007b301ca2fa9f19c19f880a536f029e3" dependencies = [ - "proc-macro-crate 0.1.5", + "proc-macro-crate 1.2.1", "proc-macro2", "quote", "syn", ] [[package]] -name = "jsonrpc-http-server" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1dea6e07251d9ce6a552abfb5d7ad6bc290a4596c8dcc3d795fae2bbdc1f3ff" -dependencies = [ - "futures 0.3.24", - "hyper", - "jsonrpc-core", - "jsonrpc-server-utils", - "log", - "net2", - "parking_lot 0.11.2", - "unicase", -] - -[[package]] -name = "jsonrpc-ipc-server" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "382bb0206323ca7cda3dcd7e245cea86d37d02457a02a975e3378fb149a48845" -dependencies = [ - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-server-utils", - "log", - "parity-tokio-ipc", - "parking_lot 0.11.2", - "tower-service", -] - -[[package]] -name = "jsonrpc-pubsub" -version = "18.0.0" +name = "jsonrpsee-types" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240f87695e6c6f62fb37f05c02c04953cf68d6408b8c1c89de85c7a0125b1011" +checksum = "e290bba767401b646812f608c099b922d8142603c9e73a50fb192d3ac86f4a0d" dependencies = [ - "futures 0.3.24", - "jsonrpc-core", - "lazy_static", - "log", - "parking_lot 0.11.2", - "rand 0.7.3", + "anyhow", + "beef", "serde", + "serde_json", + "thiserror", + "tracing", ] [[package]] -name = "jsonrpc-server-utils" -version = "18.0.0" +name = "jsonrpsee-ws-server" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4fdea130485b572c39a460d50888beb00afb3e35de23ccd7fad8ff19f0e0d4" +checksum = "d488ba74fb369e5ab68926feb75a483458b88e768d44319f37e4ecad283c7325" dependencies = [ - "bytes 1.2.1", - "futures 0.3.24", - "globset", - "jsonrpc-core", - "lazy_static", - "log", + "futures-channel", + "futures-util", + "http", + "jsonrpsee-core", + "jsonrpsee-types", + "serde_json", + "soketto", "tokio", "tokio-stream", - "tokio-util 0.6.10", - "unicase", -] - -[[package]] -name = "jsonrpc-ws-server" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f892c7d766369475ab7b0669f417906302d7c0fb521285c0a0c92e52e7c8e946" -dependencies = [ - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-server-utils", - "log", - "parity-ws", - "parking_lot 0.11.2", - "slab", + "tokio-util", + "tracing", + "tracing-futures", ] [[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 1.0.0", "ecdsa", "elliptic-curve", - "sec1", + "sha2 0.10.6", ] [[package]] @@ -3083,16 +3220,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - [[package]] name = "kv-log-macro" version = "1.0.7" @@ -3104,9 +3231,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", @@ -3114,9 +3241,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", @@ -3125,15 +3252,13 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca7fbdfd71cd663dceb0faf3367a99f8cf724514933e9867cec4995b6027cbc1" +checksum = "c076cc2cdbac89b9910c853a36c957d3862a779f31c2661174222cefb49ee597" dependencies = [ - "fs-swap", "kvdb", "log", "num_cpus", - "owning_ref", "parity-util-mem", "parking_lot 0.12.1", "regex", @@ -3147,7 +3272,7 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" dependencies = [ - "spin", + "spin 0.5.2", ] [[package]] @@ -3168,16 +3293,6 @@ version = "0.2.133" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0f80d65747a3e43d1596c7c5492d95d5edddaabd45a7fcdb02b95f644164966" -[[package]] -name = "libloading" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" -dependencies = [ - "cc", - "winapi 0.3.9", -] - [[package]] name = "libloading" version = "0.7.3" @@ -3185,7 +3300,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efbc0f03f9a775e9f6aed295c6a1ba2253c5757a9e03d55c6caa46a681abcddd" dependencies = [ "cfg-if 1.0.0", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -3196,23 +3311,18 @@ checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "libp2p" -version = "0.44.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475ce2ac4a9727e53a519f6ee05b38abfcba8f0d39c4d24f103d184e36fd5b0f" +checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" dependencies = [ - "atomic", - "bytes 1.2.1", - "futures 0.3.24", + "bytes", + "futures", "futures-timer", "getrandom 0.2.7", "instant", "lazy_static", - "libp2p-autonat", "libp2p-core", - "libp2p-deflate", "libp2p-dns", - "libp2p-floodsub", - "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-mdns", @@ -3220,157 +3330,75 @@ 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 1.0.12", - "rand 0.7.3", + "pin-project", "smallvec", ] -[[package]] -name = "libp2p-autonat" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13b690e65046af6a09c0b27bd9508fa1cab0efce889de74b0b643b9d2a98f9a" -dependencies = [ - "async-trait", - "futures 0.3.24", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-request-response", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.8.5", -] - [[package]] name = "libp2p-core" -version = "0.32.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5b02602099fb75cb2d16f9ea860a320d6eb82ce41e95ab680912c454805cd5" +checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" dependencies = [ "asn1_der", "bs58", "ed25519-dalek", "either", "fnv", - "futures 0.3.24", + "futures", "futures-timer", "instant", "lazy_static", - "libsecp256k1 0.7.1", "log", "multiaddr", - "multihash 0.16.3", + "multihash", "multistream-select", "parking_lot 0.12.1", - "pin-project 1.0.12", + "pin-project", "prost", "prost-build", "rand 0.8.5", - "ring", "rw-stream-sink", "sha2 0.10.6", "smallvec", "thiserror", - "unsigned-varint 0.7.1", + "unsigned-varint", "void", "zeroize", ] -[[package]] -name = "libp2p-deflate" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1d37f042f748e224f04785d0e987ae09a2aa518d6401d82d412dad83e360ed" -dependencies = [ - "flate2", - "futures 0.3.24", - "libp2p-core", -] - [[package]] name = "libp2p-dns" -version = "0.32.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066e33e854e10b5c93fc650458bf2179c7e0d143db260b0963e44a94859817f1" +checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720" dependencies = [ "async-std-resolver", - "futures 0.3.24", + "futures", "libp2p-core", "log", + "parking_lot 0.12.1", "smallvec", "trust-dns-resolver", ] -[[package]] -name = "libp2p-floodsub" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "733d3ea6ebe7a7a85df2bc86678b93f24b015fae5fe3b3acc4c400e795a55d2d" -dependencies = [ - "cuckoofilter", - "fnv", - "futures 0.3.24", - "libp2p-core", - "libp2p-swarm", - "log", - "prost", - "prost-build", - "rand 0.7.3", - "smallvec", -] - -[[package]] -name = "libp2p-gossipsub" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a90c989a7c0969c2ab63e898da9bc735e3be53fb4f376e9c045ce516bcc9f928" -dependencies = [ - "asynchronous-codec 0.6.0", - "base64 0.13.0", - "byteorder", - "bytes 1.2.1", - "fnv", - "futures 0.3.24", - "hex_fmt", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "prometheus-client", - "prost", - "prost-build", - "rand 0.7.3", - "regex", - "sha2 0.10.6", - "smallvec", - "unsigned-varint 0.7.1", - "wasm-timer", -] - [[package]] name = "libp2p-identify" -version = "0.35.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5ef5a5b57904c7c33d6713ef918d239dc6b7553458f3475d87f8a18e9c651c8" +checksum = "dcf9a121f699e8719bda2e6e9e9b6ddafc6cff4602471d6481c1067930ccb29b" dependencies = [ - "futures 0.3.24", + "asynchronous-codec", + "futures", "futures-timer", "libp2p-core", "libp2p-swarm", @@ -3378,21 +3406,24 @@ dependencies = [ "lru", "prost", "prost-build", + "prost-codec", "smallvec", + "thiserror", + "void", ] [[package]] name = "libp2p-kad" -version = "0.36.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "564e6bd64d177446399ed835b9451a8825b07929d6daa6a94e6405592974725e" +checksum = "6721c200e2021f6c3fab8b6cf0272ead8912d871610ee194ebd628cecf428f22" dependencies = [ - "arrayvec 0.5.2", - "asynchronous-codec 0.6.0", - "bytes 1.2.1", + "arrayvec 0.7.2", + "asynchronous-codec", + "bytes", "either", "fnv", - "futures 0.3.24", + "futures", "futures-timer", "instant", "libp2p-core", @@ -3400,27 +3431,26 @@ dependencies = [ "log", "prost", "prost-build", - "rand 0.7.3", + "rand 0.8.5", "sha2 0.10.6", "smallvec", "thiserror", "uint", - "unsigned-varint 0.7.1", + "unsigned-varint", "void", ] [[package]] name = "libp2p-mdns" -version = "0.36.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611ae873c8e280ccfab0d57c7a13cac5644f364529e233114ff07863946058b0" +checksum = "761704e727f7d68d58d7bc2231eafae5fc1b9814de24290f126df09d4bd37a15" dependencies = [ "async-io", "data-encoding", "dns-parser", - "futures 0.3.24", + "futures", "if-watch", - "lazy_static", "libp2p-core", "libp2p-swarm", "log", @@ -3432,47 +3462,45 @@ dependencies = [ [[package]] name = "libp2p-metrics" -version = "0.5.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985be799bb3796e0c136c768208c3c06604a38430571906a13dcfeda225a3b9d" +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.32.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" +checksum = "692664acfd98652de739a8acbb0a0d670f1d67190a49be6b4395e22c37337d89" dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.2.1", - "futures 0.3.24", + "asynchronous-codec", + "bytes", + "futures", "libp2p-core", "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "unsigned-varint 0.7.1", + "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.35.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd7e0c94051cda67123be68cf6b65211ba3dde7277be9068412de3e7ffd63ef" +checksum = "048155686bd81fe6cb5efdef0c6290f25ad32a0a42e8f4f72625cf6a505a206f" dependencies = [ - "bytes 1.2.1", + "bytes", "curve25519-dalek 3.2.0", - "futures 0.3.24", + "futures", "lazy_static", "libp2p-core", "log", @@ -3488,133 +3516,53 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.35.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf57a3c2e821331dda9fe612d4654d676ab6e33d18d9434a18cced72630df6ad" -dependencies = [ - "futures 0.3.24", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "rand 0.7.3", - "void", -] - -[[package]] -name = "libp2p-plaintext" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962c0fb0e7212fb96a69b87f2d09bcefd317935239bdc79cda900e7a8897a3fe" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.2.1", - "futures 0.3.24", - "libp2p-core", - "log", - "prost", - "prost-build", - "unsigned-varint 0.7.1", - "void", -] - -[[package]] -name = "libp2p-pnet" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1a458bbda880107b5b36fcb9b5a1ef0c329685da0e203ed692a8ebe64cc92c" -dependencies = [ - "futures 0.3.24", - "log", - "pin-project 1.0.12", - "rand 0.7.3", - "salsa20", - "sha3 0.9.1", -] - -[[package]] -name = "libp2p-relay" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3aa754cb7bccef51ebc3c458c6bbcef89d83b578a9925438389be841527d408f" -dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.2.1", - "either", - "futures 0.3.24", - "futures-timer", - "instant", - "libp2p-core", - "libp2p-swarm", - "log", - "pin-project 1.0.12", - "prost", - "prost-build", - "rand 0.8.5", - "smallvec", - "static_assertions", - "thiserror", - "unsigned-varint 0.7.1", - "void", -] - -[[package]] -name = "libp2p-rendezvous" -version = "0.5.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd0baab894c5b84da510b915d53264d566c3c35889f09931fe9edbd2a773bee" +checksum = "7228b9318d34689521349a86eb39a3c3a802c9efc99a0568062ffb80913e3f91" dependencies = [ - "asynchronous-codec 0.6.0", - "bimap", - "futures 0.3.24", + "futures", "futures-timer", "instant", "libp2p-core", "libp2p-swarm", "log", - "prost", - "prost-build", "rand 0.8.5", - "sha2 0.10.6", - "thiserror", - "unsigned-varint 0.7.1", "void", ] [[package]] name = "libp2p-request-response" -version = "0.17.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6a6fc6c9ad95661f46989473b34bd2993d14a4de497ff3b2668a910d4b869" +checksum = "8827af16a017b65311a410bb626205a9ad92ec0473967618425039fa5231adc1" dependencies = [ "async-trait", - "bytes 1.2.1", - "futures 0.3.24", + "bytes", + "futures", "instant", "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "unsigned-varint 0.7.1", + "unsigned-varint", ] [[package]] name = "libp2p-swarm" -version = "0.35.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0c69ad9e8f7c5fc50ad5ad9c7c8b57f33716532a2b623197f69f93e374d14c" +checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" dependencies = [ "either", "fnv", - "futures 0.3.24", + "futures", "futures-timer", "instant", "libp2p-core", "log", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", + "rand 0.8.5", "smallvec", "thiserror", "void", @@ -3622,50 +3570,38 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.27.2" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f693c8c68213034d472cbb93a379c63f4f307d97c06f1c41e4985de481687a5" +checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" dependencies = [ + "heck", "quote", "syn", ] [[package]] name = "libp2p-tcp" -version = "0.32.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193447aa729c85aac2376828df76d171c1a589c9e6b58fcc7f9d9a020734122c" +checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92" dependencies = [ "async-io", - "futures 0.3.24", + "futures", "futures-timer", "if-watch", - "ipnet", "libc", "libp2p-core", "log", "socket2", ] -[[package]] -name = "libp2p-uds" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24bdab114f7f2701757d6541266e1131b429bbae382008f207f2114ee4222dcb" -dependencies = [ - "async-std", - "futures 0.3.24", - "libp2p-core", - "log", -] - [[package]] name = "libp2p-wasm-ext" -version = "0.32.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f6ea0f84a967ef59a16083f222c18115ae2e91db69809dce275df62e101b279" +checksum = "a17b5b8e7a73e379e47b1b77f8a82c4721e97eca01abcd18e9cd91a23ca6ce97" dependencies = [ - "futures 0.3.24", + "futures", "js-sys", "libp2p-core", "parity-send-wrapper", @@ -3675,30 +3611,32 @@ dependencies = [ [[package]] name = "libp2p-websocket" -version = "0.34.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c932834c3754501c368d1bf3d0fb458487a642b90fc25df082a3a2f3d3b32e37" +checksum = "3758ae6f89b2531a24b6d9f5776bda6a626b60a57600d7185d43dfa75ca5ecc4" dependencies = [ "either", - "futures 0.3.24", + "futures", "futures-rustls", "libp2p-core", "log", + "parking_lot 0.12.1", "quicksink", "rw-stream-sink", "soketto", - "url 2.3.1", + "url", "webpki-roots", ] [[package]] name = "libp2p-yamux" -version = "0.36.0" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be902ebd89193cd020e89e89107726a38cfc0d16d18f613f4a37d046e92c7517" +checksum = "0d6874d66543c4f7e26e3b8ca9a6bead351563a13ab4fafd43c7927f7c0d6c12" dependencies = [ - "futures 0.3.24", + "futures", "libp2p-core", + "log", "parking_lot 0.12.1", "thiserror", "yamux", @@ -3706,9 +3644,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.6.1+6.28.2" +version = "0.8.0+7.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc587013734dadb7cf23468e531aa120788b87243648be42e2d3a072186291" +checksum = "611804e4666a25136fcc5f8cf425ab4d26c7f74ea245ffe92ea23b85b6420b5d" dependencies = [ "bindgen", "bzip2-sys", @@ -3826,6 +3764,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -3853,9 +3800,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.0.42" +version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "lock_api" @@ -3879,9 +3832,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.8" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ "hashbrown", ] @@ -3981,12 +3934,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "memmap2" -version = "0.2.3" +name = "memfd" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" +checksum = "b20a59d985586e4a5aef64564ac77299f8586d8be6cf9106a5a40207e8908efb" dependencies = [ - "libc", + "rustix 0.36.6", ] [[package]] @@ -4009,9 +3962,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", @@ -4020,9 +3973,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 = "merlin" @@ -4063,25 +4016,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - [[package]] name = "mio" version = "0.8.4" @@ -4095,35 +4029,32 @@ dependencies = [ ] [[package]] -name = "mio-extras" -version = "2.0.6" +name = "mockall" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +checksum = "50e4a1c770583dac7ab5e2f6c139153b783a53a1bbee9729613f193e59828326" dependencies = [ - "lazycell", - "log", - "mio 0.6.23", - "slab", + "cfg-if 1.0.0", + "downcast", + "fragile", + "lazy_static", + "mockall_derive", + "predicates", + "predicates-tree", ] [[package]] -name = "miow" -version = "0.2.2" +name = "mockall_derive" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +checksum = "832663583d5fa284ca8810bf7015e46c9fff9622d3cf34bd1eea5003fec06dd0" dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", + "cfg-if 1.0.0", + "proc-macro2", + "quote", + "syn", ] -[[package]] -name = "more-asserts" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" - [[package]] name = "multiaddr" version = "0.14.0" @@ -4134,19 +4065,19 @@ dependencies = [ "bs58", "byteorder", "data-encoding", - "multihash 0.16.3", - "percent-encoding 2.2.0", + "multihash", + "percent-encoding", "serde", "static_assertions", - "unsigned-varint 0.7.1", - "url 2.3.1", + "unsigned-varint", + "url", ] [[package]] name = "multibase" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b78c60039650ff12e140ae867ef5299a58e19dded4d334c849dc7177083667e2" +checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" dependencies = [ "base-x", "data-encoding", @@ -4155,46 +4086,19 @@ dependencies = [ [[package]] name = "multihash" -version = "0.13.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dac63698b887d2d929306ea48b63760431ff8a24fac40ddb22f9c7f49fb7cab" +checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" dependencies = [ "blake2b_simd", "blake2s_simd", "blake3", - "digest 0.9.0", - "generic-array 0.14.6", - "multihash-derive 0.7.2", - "sha2 0.9.9", - "sha3 0.9.1", - "unsigned-varint 0.5.1", -] - -[[package]] -name = "multihash" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" -dependencies = [ "core2", "digest 0.10.5", - "multihash-derive 0.8.0", + "multihash-derive", "sha2 0.10.6", - "unsigned-varint 0.7.1", -] - -[[package]] -name = "multihash-derive" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "424f6e86263cd5294cbd7f1e95746b95aca0e0d66bff31e5a40d6baa87b4aa99" -dependencies = [ - "proc-macro-crate 1.2.1", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", - "synstructure", + "sha3 0.10.5", + "unsigned-varint", ] [[package]] @@ -4219,16 +4123,16 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" +checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" dependencies = [ - "bytes 1.2.1", - "futures 0.3.24", + "bytes", + "futures", "log", - "pin-project 1.0.12", + "pin-project", "smallvec", - "unsigned-varint 0.7.1", + "unsigned-varint", ] [[package]] @@ -4241,7 +4145,7 @@ dependencies = [ "matrixmultiply", "nalgebra-macros", "num-complex", - "num-rational 0.4.1", + "num-rational", "num-traits", "rand 0.8.5", "rand_distr", @@ -4269,17 +4173,6 @@ dependencies = [ "rand 0.8.5", ] -[[package]] -name = "net2" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - [[package]] name = "netlink-packet-core" version = "0.4.2" @@ -4324,8 +4217,8 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" dependencies = [ - "bytes 1.2.1", - "futures 0.3.24", + "bytes", + "futures", "log", "netlink-packet-core", "netlink-sys", @@ -4340,8 +4233,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" dependencies = [ "async-io", - "bytes 1.2.1", - "futures 0.3.24", + "bytes", + "futures", "libc", "log", ] @@ -4370,7 +4263,7 @@ dependencies = [ "clap 3.2.22", "derive_more", "fs_extra", - "futures 0.3.24", + "futures", "hash-db", "hex", "kvdb", @@ -4378,7 +4271,7 @@ dependencies = [ "lazy_static", "log", "node-testing", - "parity-db 0.2.4", + "parity-db 0.3.17", "parity-util-mem", "polymesh-primitives", "polymesh-runtime-testnet", @@ -4395,7 +4288,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-timestamp", - "sp-tracing", + "sp-tracing 5.0.0", "sp-transaction-pool", "sp-trie", "tempfile", @@ -4424,7 +4317,7 @@ dependencies = [ "sc-executor", "sp-application-crypto", "sp-core", - "sp-externalities", + "sp-externalities 0.12.0", "sp-io", "sp-runtime", "sp-state-machine", @@ -4440,9 +4333,7 @@ version = "0.1.0" dependencies = [ "frame-support", "frame-system", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "jsonrpsee", "node-rpc-runtime-api", "pallet-compliance-manager", "pallet-identity", @@ -4457,7 +4348,8 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", - "sp-std", + "sp-std 5.0.0", + "sp-weights", ] [[package]] @@ -4477,7 +4369,8 @@ dependencies = [ "serde_json", "sp-api", "sp-runtime", - "sp-std", + "sp-std 5.0.0", + "sp-weights", ] [[package]] @@ -4488,7 +4381,7 @@ dependencies = [ "frame-support", "frame-system", "fs_extra", - "futures 0.3.24", + "futures", "log", "node-executor", "pallet-balances 0.1.0", @@ -4547,11 +4440,17 @@ dependencies = [ "minimal-lexical", ] +[[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", @@ -4569,12 +4468,12 @@ dependencies = [ [[package]] name = "num-format" -version = "0.4.0" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bafe4179722c2894288ee77a9f044f02811c86af699344c498b0840c698a2465" +checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ - "arrayvec 0.4.12", - "itoa 0.4.8", + "arrayvec 0.7.2", + "itoa 1.0.5", ] [[package]] @@ -4587,18 +4486,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" @@ -4606,6 +4493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint", "num-integer", "num-traits", ] @@ -4626,27 +4514,19 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] -[[package]] -name = "object" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ac1d3f9a1d3616fd9a60c8d74296f22406a238b6a72f5cc1e6f314df4ffbf9" -dependencies = [ - "crc32fast", - "indexmap", - "memchr", -] - [[package]] name = "object" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ + "crc32fast", + "hashbrown", + "indexmap", "memchr", ] @@ -4686,15 +4566,6 @@ version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" -[[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-asset" version = "0.1.0" @@ -4728,14 +4599,14 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "frame-system", @@ -4745,13 +4616,13 @@ dependencies = [ "sp-application-crypto", "sp-authority-discovery", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "frame-system", @@ -4760,13 +4631,13 @@ dependencies = [ "scale-info", "sp-authorship", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -4784,7 +4655,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -4808,7 +4679,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", "substrate-test-runtime-client", ] @@ -4816,7 +4687,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -4825,7 +4696,7 @@ dependencies = [ "parity-scale-codec 3.2.1", "scale-info", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -4844,7 +4715,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -4868,7 +4739,7 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -4891,7 +4762,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -4920,19 +4791,20 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "bitflags", "frame-benchmarking", "frame-support", "frame-system", + "impl-trait-for-tuples", "log", "pallet-contracts-primitives", "pallet-contracts-proc-macro", @@ -4942,72 +4814,38 @@ dependencies = [ "scale-info", "serde", "smallvec", + "sp-api", "sp-core", "sp-io", "sp-runtime", - "sp-sandbox", - "sp-std", + "sp-std 5.0.0", "wasm-instrument", - "wasmi-validation", + "wasmi 0.20.0", + "wasmparser-nostd", ] [[package]] name = "pallet-contracts-primitives" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "bitflags", "parity-scale-codec 3.2.1", - "scale-info", - "serde", - "sp-core", - "sp-rpc", "sp-runtime", - "sp-std", + "sp-std 5.0.0", + "sp-weights", ] [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "pallet-contracts-rpc" -version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" -dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", - "parity-scale-codec 3.2.1", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "pallet-contracts-rpc-runtime-api" -version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" -dependencies = [ - "pallet-contracts-primitives", - "parity-scale-codec 3.2.1", - "scale-info", - "sp-api", - "sp-runtime", - "sp-std", -] - [[package]] name = "pallet-corporate-actions" version = "0.1.0" @@ -5036,7 +4874,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -5057,13 +4895,13 @@ dependencies = [ "scale-info", "serde", "serde_derive", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -5080,7 +4918,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5102,7 +4940,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -5110,17 +4948,20 @@ dependencies = [ name = "pallet-group-rpc" version = "2.0.0" dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "frame-support", + "frame-system", + "jsonrpsee", + "node-rpc", "pallet-group-rpc-runtime-api", "parity-scale-codec 3.2.1", "polymesh-primitives", "serde", "sp-api", "sp-blockchain", + "sp-core", + "sp-rpc", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "substrate-test-runtime-client", ] @@ -5132,10 +4973,8 @@ dependencies = [ "polymesh-common-utilities", "polymesh-primitives", "serde", - "serde_json", "sp-api", - "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5164,14 +5003,14 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -5185,13 +5024,13 @@ dependencies = [ "sp-io", "sp-runtime", "sp-staking", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -5202,7 +5041,7 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5223,7 +5062,7 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -5243,13 +5082,13 @@ dependencies = [ "polymesh-common-utilities", "polymesh-primitives", "scale-info", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "frame-system", @@ -5260,7 +5099,7 @@ dependencies = [ "serde", "sp-runtime", "sp-staking", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5276,7 +5115,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5309,7 +5148,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -5330,23 +5169,24 @@ dependencies = [ "scale-info", "serde", "sp-arithmetic", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec 3.2.1", "scale-info", "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5365,34 +5205,36 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-protocol-fee-rpc" version = "0.1.0" dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "frame-support", + "frame-system", + "jsonrpsee", + "node-rpc", "pallet-protocol-fee-rpc-runtime-api", "parity-scale-codec 3.2.1", "polymesh-common-utilities", "serde", "sp-api", "sp-blockchain", + "sp-core", + "sp-rpc", "sp-runtime", + "sp-std 5.0.0", ] [[package]] name = "pallet-protocol-fee-rpc-runtime-api" version = "0.1.0" dependencies = [ - "frame-support", "parity-scale-codec 3.2.1", "polymesh-common-utilities", "serde", - "serde_json", "sp-api", "sp-runtime", ] @@ -5400,7 +5242,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "frame-system", @@ -5408,7 +5250,7 @@ dependencies = [ "safe-mix", "scale-info", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5424,7 +5266,7 @@ dependencies = [ "polymesh-primitives", "scale-info", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5444,13 +5286,13 @@ dependencies = [ "serde", "sp-core", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -5460,13 +5302,13 @@ dependencies = [ "scale-info", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-support", "frame-system", @@ -5480,7 +5322,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 5.0.0", "sp-trie", ] @@ -5515,7 +5357,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -5545,15 +5387,15 @@ dependencies = [ "sp-npos-elections", "sp-runtime", "sp-staking", - "sp-std", - "sp-tracing", + "sp-std 5.0.0", + "sp-tracing 5.0.0", "static_assertions", ] [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -5565,15 +5407,19 @@ dependencies = [ name = "pallet-staking-rpc" version = "2.0.0" dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "frame-support", + "frame-system", + "jsonrpsee", + "node-rpc", "pallet-staking-rpc-runtime-api", "parity-scale-codec 3.2.1", "serde", "sp-api", "sp-blockchain", + "sp-core", + "sp-rpc", "sp-runtime", + "sp-std 5.0.0", ] [[package]] @@ -5581,7 +5427,6 @@ name = "pallet-staking-rpc-runtime-api" version = "2.0.0" dependencies = [ "frame-support", - "serde_json", "sp-api", "sp-runtime", ] @@ -5610,7 +5455,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "substrate-test-runtime-client", ] @@ -5642,7 +5487,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -5658,7 +5503,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5677,13 +5522,13 @@ dependencies = [ "scale-info", "serde", "serde_derive", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-benchmarking", "frame-support", @@ -5694,7 +5539,7 @@ dependencies = [ "sp-inherents", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-timestamp", ] @@ -5714,7 +5559,7 @@ dependencies = [ "sp-api", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5737,15 +5582,16 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version", ] [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "impl-trait-for-tuples", @@ -5754,7 +5600,7 @@ dependencies = [ "scale-info", "serde", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -5776,14 +5622,14 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "parity-db" -version = "0.2.4" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e337f62db341435f0da05b8f6b97e984ef4ea5800510cd07c2d624688c40b47" +checksum = "2c8fdb726a43661fa54b43e7114e6b88b2289cae388eb3ad766d9d1754d83fce" dependencies = [ "blake2-rfc", "crc32fast", @@ -5791,25 +5637,27 @@ dependencies = [ "hex", "libc", "log", - "memmap2 0.2.3", - "parking_lot 0.11.2", + "lz4", + "memmap2", + "parking_lot 0.12.1", "rand 0.8.5", + "snap", ] [[package]] name = "parity-db" -version = "0.3.17" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fdb726a43661fa54b43e7114e6b88b2289cae388eb3ad766d9d1754d83fce" +checksum = "3a7511a0bec4a336b5929999d02b560d2439c993cccf98c26481484e811adc43" dependencies = [ - "blake2-rfc", + "blake2", "crc32fast", "fs2", "hex", "libc", "log", "lz4", - "memmap2 0.5.7", + "memmap2", "parking_lot 0.12.1", "rand 0.8.5", "snap", @@ -5837,6 +5685,7 @@ dependencies = [ "arrayvec 0.7.2", "bitvec 1.0.1", "byte-slice-cast 1.2.1", + "bytes", "impl-trait-for-tuples", "parity-scale-codec-derive 3.1.3", "serde", @@ -5872,25 +5721,11 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" -[[package]] -name = "parity-tokio-ipc" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9981e32fb75e004cc148f5fb70342f393830e0a4aa62e3cc93b50976218d42b6" -dependencies = [ - "futures 0.3.24", - "libc", - "log", - "rand 0.7.3", - "tokio", - "winapi 0.3.9", -] - [[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 1.0.0", "hashbrown", @@ -5899,7 +5734,7 @@ dependencies = [ "parking_lot 0.12.1", "primitive-types", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5915,36 +5750,9 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ad52817c4d343339b3bc2e26861bd21478eda0b7509acf83505727000512ac" -dependencies = [ - "byteorder", -] - -[[package]] -name = "parity-wasm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" - -[[package]] -name = "parity-ws" -version = "0.11.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5983d3929ad50f12c3eb9a6743f19d691866ecd44da74c0a3308c3f8a56df0c6" -dependencies = [ - "byteorder", - "bytes 0.4.12", - "httparse", - "log", - "mio 0.6.23", - "mio-extras", - "rand 0.7.3", - "sha-1 0.8.2", - "slab", - "url 2.3.1", -] +checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" [[package]] name = "parking" @@ -5982,9 +5790,9 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5995,7 +5803,7 @@ checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", "windows-sys 0.36.1", ] @@ -6030,12 +5838,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.2.0" @@ -6178,33 +5980,13 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pin-project" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef0f924a5ee7ea9cbcea77529dba45f8a9ba9f622419fe3386ca581a3ae9d5a" -dependencies = [ - "pin-project-internal 0.4.30", -] - [[package]] name = "pin-project" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ - "pin-project-internal 1.0.12", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "851c8d0ce9bebe43790dedfc86614c23494ac9f423dd618d3a61fc693eafe61e" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] @@ -6236,6 +6018,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" @@ -6281,7 +6073,7 @@ dependencies = [ "libc", "log", "wepoll-ffi", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -6297,18 +6089,18 @@ dependencies = [ [[package]] name = "polymesh" -version = "5.3.0" +version = "5.4.0" dependencies = [ "chrono", - "clap 3.2.22", + "clap 4.1.0", "ed25519-dalek", "frame-benchmarking", "frame-benchmarking-cli", "frame-support", "frame-system", "frame-system-rpc-runtime-api", - "futures 0.3.24", - "jsonrpc-core", + "futures", + "jsonrpsee", "log", "node-rpc", "node-rpc-runtime-api", @@ -6317,7 +6109,6 @@ dependencies = [ "pallet-balances 0.1.0", "pallet-bridge", "pallet-committee", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-group", @@ -6359,6 +6150,7 @@ dependencies = [ "sc-executor", "sc-finality-grandpa", "sc-network", + "sc-network-common", "sc-rpc", "sc-service", "sc-sync-state-rpc", @@ -6417,7 +6209,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "substrate-test-runtime-client", ] @@ -6436,13 +6228,13 @@ dependencies = [ "parity-scale-codec 3.2.1", "polymesh-common-utilities", "polymesh-primitives", - "pwasm-utils", "scale-info", "serde", "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", + "wasm-instrument", ] [[package]] @@ -6467,20 +6259,18 @@ dependencies = [ "polymesh-primitives", "scale-info", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "polymesh-node-rpc" version = "0.1.0" dependencies = [ - "jsonrpc-core", + "jsonrpsee", "node-rpc", - "pallet-contracts-rpc", "pallet-group-rpc", "pallet-protocol-fee-rpc", "pallet-staking-rpc", - "parity-scale-codec 3.2.1", "polymesh-primitives", "sc-chain-spec", "sc-client-api", @@ -6489,9 +6279,9 @@ dependencies = [ "sc-consensus-epochs", "sc-finality-grandpa", "sc-finality-grandpa-rpc", - "sc-keystore", "sc-rpc", "sc-rpc-api", + "sc-rpc-spec-v2", "sc-sync-state-rpc", "sc-transaction-pool-api", "sp-api", @@ -6502,6 +6292,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "substrate-frame-rpc-system", + "substrate-state-trie-migration-rpc", ] [[package]] @@ -6532,7 +6323,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-runtime-interface", - "sp-std", + "sp-std 5.0.0", "sp-version", ] @@ -6575,7 +6366,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -6604,7 +6395,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6661,7 +6451,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 5.0.0", "sp-transaction-pool", "sp-version", ] @@ -6689,7 +6479,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6747,7 +6536,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 5.0.0", "sp-transaction-pool", "sp-version", ] @@ -6775,7 +6564,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6834,7 +6622,7 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", + "sp-std 5.0.0", "sp-transaction-pool", "sp-version", ] @@ -6870,7 +6658,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6933,8 +6720,8 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", - "sp-tracing", + "sp-std 5.0.0", + "sp-tracing 5.0.0", "sp-transaction-pool", "sp-version", "substrate-test-runtime-client", @@ -6980,7 +6767,7 @@ dependencies = [ "pallet-utility", "polymesh-contracts", "polymesh-runtime-common", - "sp-std", + "sp-std 5.0.0", ] [[package]] @@ -7008,28 +6795,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] -name = "prettytable-rs" -version = "0.8.0" +name = "predicates" +version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fd04b170004fa2daccf418a7f8253aaf033c27760b5f225889024cf66d7ac2e" +checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ - "atty", - "csv", - "encode_unicode", - "lazy_static", - "term", - "unicode-width", + "difflib", + "float-cmp", + "itertools", + "normalize-line-endings", + "predicates-core", + "regex", +] + +[[package]] +name = "predicates-core" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" + +[[package]] +name = "predicates-tree" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "prettyplease" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78" +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", - "impl-serde", + "impl-serde 0.4.0", "scale-info", "uint", ] @@ -7086,9 +6899,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.44" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd7356a8122b6c4a24a82b278680c73357984ca2fc79a0f9fa6dea7dced7c58" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] @@ -7109,21 +6922,21 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.15.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a896938cc6018c64f279888b8c7559d3725210d5db9a3a1ee6bc7188d51d34" +checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" dependencies = [ "dtoa 1.0.3", - "itoa 1.0.3", - "owning_ref", + "itoa 1.0.5", + "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", @@ -7132,39 +6945,54 @@ dependencies = [ [[package]] name = "prost" -version = "0.9.0" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +checksum = "21dc42e00223fc37204bd4aa177e69420c604ca4a183209a8f9de30c6d934698" dependencies = [ - "bytes 1.2.1", + "bytes", "prost-derive", ] [[package]] name = "prost-build" -version = "0.9.0" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +checksum = "a3f8ad728fb08fe212df3c05169e940fbb6d9d16a877ddde14644a983ba2012e" dependencies = [ - "bytes 1.2.1", - "heck 0.3.3", + "bytes", + "heck", "itertools", "lazy_static", "log", "multimap", "petgraph", + "prettyplease", "prost", "prost-types", "regex", + "syn", "tempfile", "which", ] +[[package]] +name = "prost-codec" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "011ae9ff8359df7915f97302d591cdd9e0e27fbd5a4ddc5bd13b71079bb20987" +dependencies = [ + "asynchronous-codec", + "bytes", + "prost", + "thiserror", + "unsigned-varint", +] + [[package]] name = "prost-derive" -version = "0.9.0" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +checksum = "8bda8c0881ea9f722eb9629376db3d0b903b462477c1aafcb0566610ac28ac5d" dependencies = [ "anyhow", "itertools", @@ -7175,11 +7003,11 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.9.0" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +checksum = "a5e0526209433e96d83d750dd81a99118edbc55739e7e61a46764fd2ad537788" dependencies = [ - "bytes 1.2.1", + "bytes", "prost", ] @@ -7192,17 +7020,6 @@ dependencies = [ "cc", ] -[[package]] -name = "pwasm-utils" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "880b3384fb00b8f6ecccd5d358b93bd2201900ae3daad213791d1864f6441f5c" -dependencies = [ - "byteorder", - "log", - "parity-wasm 0.42.2", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -7371,12 +7188,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - [[package]] name = "redox_syscall" version = "0.2.16" @@ -7386,17 +7197,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" -dependencies = [ - "getrandom 0.1.16", - "redox_syscall 0.1.57", - "rust-argon2", -] - [[package]] name = "redox_users" version = "0.4.3" @@ -7404,7 +7204,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom 0.2.7", - "redox_syscall 0.2.16", + "redox_syscall", "thiserror", ] @@ -7429,13 +7229,14 @@ dependencies = [ ] [[package]] -name = "regalloc" -version = "0.0.34" +name = "regalloc2" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62446b1d3ebf980bdc68837700af1d77b37bc430e524bf95319c6eada2a4cc02" +checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" dependencies = [ + "fxhash", "log", - "rustc-hash", + "slice-group-by", "smallvec", ] @@ -7465,25 +7266,13 @@ 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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -7496,20 +7285,14 @@ dependencies = [ "quick-error", ] -[[package]] -name = "retain_mut" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389f1d5789befaf6029ebd9f7dac4af7f7e3d61b69d4f30e2ac02b57e7712b0" - [[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", ] @@ -7522,17 +7305,17 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", - "winapi 0.3.9", + "winapi", ] [[package]] name = "rocksdb" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "620f4129485ff1a7128d184bc687470c21c7951b64779ebc9cfdad3dcd920290" +checksum = "7e9562ea1d70c0cc63a34a22d977753b50cca91cc6b6527750463bd5dd8697bc" dependencies = [ "libc", "librocksdb-sys", @@ -7540,12 +7323,13 @@ dependencies = [ [[package]] name = "rpassword" -version = "5.0.1" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" +checksum = "6678cf63ab3491898c0d021b493c94c9b221d91295294a2a5746eacbe5928322" dependencies = [ "libc", - "winapi 0.3.9", + "rtoolbox", + "winapi", ] [[package]] @@ -7555,7 +7339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" dependencies = [ "async-global-executor", - "futures 0.3.24", + "futures", "log", "netlink-packet-route", "netlink-proto", @@ -7564,15 +7348,13 @@ dependencies = [ ] [[package]] -name = "rust-argon2" -version = "0.8.3" +name = "rtoolbox" +version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" +checksum = "034e22c514f5c0cb8a10ff341b9b048b5ceb21591f31c8f44c43b960f9b3524a" dependencies = [ - "base64 0.13.0", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", + "libc", + "winapi", ] [[package]] @@ -7613,29 +7395,30 @@ dependencies = [ [[package]] name = "rustix" -version = "0.33.7" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", "errno", - "io-lifetimes", + "io-lifetimes 0.7.5", "libc", - "linux-raw-sys", - "winapi 0.3.9", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", ] [[package]] -name = "rustls" -version = "0.19.1" +name = "rustix" +version = "0.36.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" dependencies = [ - "base64 0.13.0", - "log", - "ring", - "sct 0.6.1", - "webpki 0.21.4", + "bitflags", + "errno", + "io-lifetimes 1.0.4", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.42.0", ] [[package]] @@ -7646,22 +7429,31 @@ checksum = "5aab8ee6c7097ed6057f43c187a62418d0c05a4bd5f18b3571db50ee0f9ce033" dependencies = [ "log", "ring", - "sct 0.7.0", - "webpki 0.22.0", + "sct", + "webpki", ] [[package]] name = "rustls-native-certs" -version = "0.5.0" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" dependencies = [ "openssl-probe", - "rustls 0.19.1", + "rustls-pemfile", "schannel", "security-framework", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64 0.21.0", +] + [[package]] name = "rustversion" version = "1.0.9" @@ -7670,12 +7462,12 @@ checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "rw-stream-sink" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" dependencies = [ - "futures 0.3.24", - "pin-project 0.4.30", + "futures", + "pin-project", "static_assertions", ] @@ -7694,15 +7486,6 @@ dependencies = [ "rustc_version 0.2.3", ] -[[package]] -name = "salsa20" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" -dependencies = [ - "cipher", -] - [[package]] name = "same-file" version = "1.0.6" @@ -7715,7 +7498,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "log", "sp-core", @@ -7726,10 +7509,10 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "ip_network", "libp2p", @@ -7739,7 +7522,7 @@ dependencies = [ "prost-build", "rand 0.7.3", "sc-client-api", - "sc-network", + "sc-network-common", "sp-api", "sp-authority-discovery", "sp-blockchain", @@ -7753,9 +7536,9 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "futures-timer", "log", "parity-scale-codec 3.2.1", @@ -7776,7 +7559,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "sc-client-api", @@ -7792,13 +7575,13 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "impl-trait-for-tuples", - "memmap2 0.5.7", + "memmap2", "parity-scale-codec 3.2.1", "sc-chain-spec-derive", - "sc-network", + "sc-network-common", "sc-telemetry", "serde", "serde_json", @@ -7809,7 +7592,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -7820,13 +7603,13 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "array-bytes", "chrono", - "clap 3.2.22", + "clap 4.1.0", "fdlimit", - "futures 0.3.24", - "hex", + "futures", "libp2p", "log", "names", @@ -7838,6 +7621,7 @@ dependencies = [ "sc-client-db", "sc-keystore", "sc-network", + "sc-network-common", "sc-service", "sc-telemetry", "sc-tracing", @@ -7859,10 +7643,10 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "fnv", - "futures 0.3.24", + "futures", "hash-db", "log", "parity-scale-codec 3.2.1", @@ -7875,11 +7659,11 @@ dependencies = [ "sp-consensus", "sp-core", "sp-database", - "sp-externalities", + "sp-externalities 0.13.0", "sp-keystore", "sp-runtime", "sp-state-machine", - "sp-storage", + "sp-storage 7.0.0", "sp-trie", "substrate-prometheus-endpoint", ] @@ -7887,7 +7671,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "hash-db", "kvdb", @@ -7895,7 +7679,7 @@ dependencies = [ "kvdb-rocksdb", "linked-hash-map", "log", - "parity-db 0.3.17", + "parity-db 0.4.2", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", "sc-client-api", @@ -7912,10 +7696,10 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "libp2p", "log", @@ -7936,20 +7720,18 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "fork-tree", - "futures 0.3.24", + "futures", "log", "merlin 2.0.1", "num-bigint", - "num-rational 0.2.4", + "num-rational", "num-traits", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", - "rand 0.7.3", - "retain_mut", "sc-client-api", "sc-consensus", "sc-consensus-epochs", @@ -7979,12 +7761,10 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "futures", + "jsonrpsee", "sc-consensus-babe", "sc-consensus-epochs", "sc-rpc-api", @@ -8003,7 +7783,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "fork-tree", "parity-scale-codec 3.2.1", @@ -8016,10 +7796,10 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "log", "parity-scale-codec 3.2.1", @@ -8034,14 +7814,13 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-timestamp", "thiserror", ] [[package]] name = "sc-consensus-uncles" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "sc-client-api", "sp-authorship", @@ -8052,7 +7831,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "lazy_static", "lru", @@ -8064,39 +7843,37 @@ dependencies = [ "sp-api", "sp-core", "sp-core-hashing-proc-macro", - "sp-externalities", + "sp-externalities 0.13.0", "sp-io", "sp-panic-handler", "sp-runtime-interface", - "sp-tasks", "sp-trie", "sp-version", "sp-wasm-interface", "tracing", - "wasmi", + "wasmi 0.13.2", ] [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "environmental", "parity-scale-codec 3.2.1", "sc-allocator", "sp-maybe-compressed-blob", "sp-sandbox", - "sp-serializer", "sp-wasm-interface", "thiserror", "wasm-instrument", - "wasmi", + "wasmi 0.13.2", ] [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "log", "parity-scale-codec 3.2.1", @@ -8105,19 +7882,21 @@ dependencies = [ "sp-runtime-interface", "sp-sandbox", "sp-wasm-interface", - "wasmi", + "wasmi 0.13.2", ] [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "cfg-if 1.0.0", "libc", "log", + "once_cell", "parity-scale-codec 3.2.1", - "parity-wasm 0.42.2", + "parity-wasm", + "rustix 0.35.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -8129,16 +7908,16 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "ahash", + "array-bytes", "async-trait", "dyn-clone", "finality-grandpa", "fork-tree", - "futures 0.3.24", + "futures", "futures-timer", - "hex", "log", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", @@ -8149,6 +7928,7 @@ dependencies = [ "sc-consensus", "sc-keystore", "sc-network", + "sc-network-common", "sc-network-gossip", "sc-telemetry", "sc-utils", @@ -8169,14 +7949,11 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "finality-grandpa", - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "jsonrpc-pubsub", + "futures", + "jsonrpsee", "log", "parity-scale-codec 3.2.1", "sc-client-api", @@ -8193,15 +7970,15 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "ansi_term", - "futures 0.3.24", + "futures", "futures-timer", "log", "parity-util-mem", "sc-client-api", - "sc-network", + "sc-network-common", "sc-transaction-pool-api", "sp-blockchain", "sp-runtime", @@ -8210,10 +7987,10 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "array-bytes", "async-trait", - "hex", "parking_lot 0.12.1", "serde_json", "sp-application-crypto", @@ -8225,19 +8002,19 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "array-bytes", "async-trait", - "asynchronous-codec 0.5.0", + "asynchronous-codec", "bitflags", - "bytes 1.2.1", + "bytes", "cid", "either", "fnv", "fork-tree", - "futures 0.3.24", + "futures", "futures-timer", - "hex", "ip_network", "libp2p", "linked-hash-map", @@ -8246,13 +8023,13 @@ dependencies = [ "lru", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", - "pin-project 1.0.12", + "pin-project", "prost", - "prost-build", "rand 0.7.3", "sc-block-builder", "sc-client-api", "sc-consensus", + "sc-network-common", "sc-peerset", "sc-utils", "serde", @@ -8262,51 +8039,169 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", - "sp-finality-grandpa", "sp-runtime", "substrate-prometheus-endpoint", "thiserror", - "unsigned-varint 0.6.0", - "void", + "unsigned-varint", "zeroize", ] +[[package]] +name = "sc-network-bitswap" +version = "0.10.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "cid", + "futures", + "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/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "async-trait", + "bitflags", + "bytes", + "futures", + "futures-timer", + "libp2p", + "linked_hash_set", + "parity-scale-codec 3.2.1", + "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/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "ahash", - "futures 0.3.24", + "futures", "futures-timer", "libp2p", "log", "lru", - "sc-network", + "sc-network-common", + "sc-peerset", "sp-runtime", "substrate-prometheus-endpoint", "tracing", ] +[[package]] +name = "sc-network-light" +version = "0.10.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "array-bytes", + "futures", + "libp2p", + "log", + "parity-scale-codec 3.2.1", + "prost", + "prost-build", + "sc-client-api", + "sc-network-common", + "sc-peerset", + "sp-blockchain", + "sp-core", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-network-sync" +version = "0.10.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "array-bytes", + "async-trait", + "fork-tree", + "futures", + "libp2p", + "log", + "lru", + "mockall", + "parity-scale-codec 3.2.1", + "prost", + "prost-build", + "sc-client-api", + "sc-consensus", + "sc-network-common", + "sc-peerset", + "sc-utils", + "smallvec", + "sp-arithmetic", + "sp-blockchain", + "sp-consensus", + "sp-core", + "sp-finality-grandpa", + "sp-runtime", + "thiserror", +] + +[[package]] +name = "sc-network-transactions" +version = "0.10.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "array-bytes", + "futures", + "hex", + "libp2p", + "log", + "parity-scale-codec 3.2.1", + "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/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "bytes 1.2.1", + "array-bytes", + "bytes", "fnv", - "futures 0.3.24", + "futures", "futures-timer", - "hex", "hyper", "hyper-rustls", + "libp2p", "num_cpus", "once_cell", "parity-scale-codec 3.2.1", "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", @@ -8319,9 +8214,9 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "libp2p", "log", "sc-utils", @@ -8332,7 +8227,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -8341,12 +8236,11 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "hash-db", - "jsonrpc-core", - "jsonrpc-pubsub", + "jsonrpsee", "log", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", @@ -8372,13 +8266,10 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "jsonrpc-pubsub", + "futures", + "jsonrpsee", "log", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", @@ -8390,7 +8281,7 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", - "sp-tracing", + "sp-tracing 6.0.0", "sp-version", "thiserror", ] @@ -8398,38 +8289,52 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-http-server", - "jsonrpc-ipc-server", - "jsonrpc-pubsub", - "jsonrpc-ws-server", + "futures", + "jsonrpsee", "log", "serde_json", "substrate-prometheus-endpoint", "tokio", ] +[[package]] +name = "sc-rpc-spec-v2" +version = "0.10.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "futures", + "hex", + "jsonrpsee", + "parity-scale-codec 3.2.1", + "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/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "directories", "exit-future", - "futures 0.3.24", + "futures", "futures-timer", "hash-db", - "jsonrpc-core", - "jsonrpc-pubsub", + "jsonrpsee", "log", "parity-scale-codec 3.2.1", "parity-util-mem", "parking_lot 0.12.1", - "pin-project 1.0.12", + "pin-project", "rand 0.7.3", "sc-block-builder", "sc-chain-spec", @@ -8440,9 +8345,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", @@ -8457,18 +8368,19 @@ dependencies = [ "sp-blockchain", "sp-consensus", "sp-core", - "sp-externalities", + "sp-externalities 0.13.0", "sp-inherents", "sp-keystore", "sp-runtime", "sp-session", "sp-state-machine", - "sp-storage", - "sp-tracing", + "sp-storage 7.0.0", + "sp-tracing 6.0.0", "sp-transaction-pool", "sp-transaction-storage-proof", "sp-trie", "sp-version", + "static_init", "substrate-prometheus-endpoint", "tempfile", "thiserror", @@ -8480,7 +8392,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "log", "parity-scale-codec 3.2.1", @@ -8494,11 +8406,9 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "jsonrpsee", "parity-scale-codec 3.2.1", "sc-chain-spec", "sc-client-api", @@ -8515,9 +8425,9 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "libc", "log", "rand 0.7.3", @@ -8528,20 +8438,20 @@ dependencies = [ "serde_json", "sp-core", "sp-io", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "chrono", - "futures 0.3.24", + "futures", "libp2p", "log", "parking_lot 0.12.1", - "pin-project 1.0.12", + "pin-project", "rand 0.7.3", "serde", "serde_json", @@ -8552,7 +8462,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "ansi_term", "atty", @@ -8573,7 +8483,7 @@ dependencies = [ "sp-core", "sp-rpc", "sp-runtime", - "sp-tracing", + "sp-tracing 6.0.0", "thiserror", "tracing", "tracing-log", @@ -8583,7 +8493,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -8594,16 +8504,16 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "async-trait", + "futures", "futures-timer", "linked-hash-map", "log", "parity-scale-codec 3.2.1", "parity-util-mem", "parking_lot 0.12.1", - "retain_mut", "sc-client-api", "sc-transaction-pool-api", "sc-utils", @@ -8612,7 +8522,7 @@ dependencies = [ "sp-blockchain", "sp-core", "sp-runtime", - "sp-tracing", + "sp-tracing 6.0.0", "sp-transaction-pool", "substrate-prometheus-endpoint", "thiserror", @@ -8621,9 +8531,10 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "async-trait", + "futures", "log", "serde", "sp-blockchain", @@ -8634,9 +8545,9 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "futures-timer", "lazy_static", "log", @@ -8740,14 +8651,10 @@ dependencies = [ ] [[package]] -name = "sct" -version = "0.6.1" +name = "scratch" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring", - "untrusted", -] +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "sct" @@ -8761,30 +8668,32 @@ 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", ] [[package]] name = "secp256k1" -version = "0.22.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "295642060261c80709ac034f52fca8e5a9fa2c7d341ded5cdb164b7c33768b2a" +checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ "secp256k1-sys", ] [[package]] name = "secp256k1-sys" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "152e20a0fd0519390fc43ab404663af8a0b794273d2a91d60ad4a39f13ffe110" +checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" dependencies = [ "cc", ] @@ -8919,7 +8828,7 @@ version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ - "itoa 1.0.3", + "itoa 1.0.5", "ryu", "serde", ] @@ -8943,18 +8852,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha-1" version = "0.9.8" @@ -9073,11 +8970,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.5", "rand_core 0.6.4", ] @@ -9108,6 +9005,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slice-group-by" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" + [[package]] name = "smallvec" version = "1.9.0" @@ -9144,7 +9047,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -9154,19 +9057,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ "base64 0.13.0", - "bytes 1.2.1", + "bytes", "flate2", - "futures 0.3.24", + "futures", "httparse", "log", "rand 0.8.5", - "sha-1 0.9.8", + "sha-1", ] [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "hash-db", "log", @@ -9175,7 +9078,8 @@ dependencies = [ "sp-core", "sp-runtime", "sp-state-machine", - "sp-std", + "sp-std 5.0.0", + "sp-trie", "sp-version", "thiserror", ] @@ -9183,7 +9087,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "blake2", "proc-macro-crate 1.2.1", @@ -9194,75 +9098,75 @@ dependencies = [ [[package]] name = "sp-application-crypto" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", "serde", "sp-core", "sp-io", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-arithmetic" -version = "5.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "6.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec 3.2.1", "scale-info", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 5.0.0", + "sp-std 5.0.0", "static_assertions", ] [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", "sp-api", "sp-application-crypto", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "parity-scale-codec 3.2.1", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "sp-api", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "log", "lru", "parity-scale-codec 3.2.1", @@ -9278,10 +9182,10 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "log", "parity-scale-codec 3.2.1", @@ -9289,7 +9193,7 @@ dependencies = [ "sp-inherents", "sp-runtime", "sp-state-machine", - "sp-std", + "sp-std 5.0.0", "sp-version", "thiserror", ] @@ -9297,7 +9201,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "parity-scale-codec 3.2.1", @@ -9308,14 +9212,14 @@ dependencies = [ "sp-consensus-slots", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-timestamp", ] [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "merlin 2.0.1", @@ -9331,59 +9235,59 @@ dependencies = [ "sp-inherents", "sp-keystore", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-timestamp", ] [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", "serde", "sp-arithmetic", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-timestamp", ] [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", + "scale-info", "schnorrkel 0.9.1", "sp-core", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-core" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "array-bytes", "base58", "bitflags", - "blake2-rfc", + "blake2", "byteorder", "dyn-clonable", - "ed25519-dalek", - "futures 0.3.24", + "ed25519-zebra", + "futures", "hash-db", "hash256-std-hasher", - "hex", - "impl-serde", + "impl-serde 0.4.0", "lazy_static", "libsecp256k1 0.7.1", "log", "merlin 2.0.1", "num-traits", "parity-scale-codec 3.2.1", - "parity-util-mem", "parking_lot 0.12.1", "primitive-types", "rand 0.7.3", @@ -9394,37 +9298,37 @@ dependencies = [ "secrecy", "serde", "sp-core-hashing", - "sp-debug-derive", - "sp-externalities", + "sp-debug-derive 5.0.0", + "sp-externalities 0.13.0", "sp-runtime-interface", - "sp-std", - "sp-storage", + "sp-std 5.0.0", + "sp-storage 7.0.0", "ss58-registry", "substrate-bip39", "thiserror", "tiny-bip39", - "wasmi", + "wasmi 0.13.2", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "4.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "5.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "blake2", "byteorder", "digest 0.10.5", "sha2 0.10.6", "sha3 0.10.5", - "sp-std", + "sp-std 5.0.0", "twox-hash", ] [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro2", "quote", @@ -9435,7 +9339,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -9444,7 +9348,18 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d676664972e22a0796176e81e7bec41df461d1edf52090955cdab55f2c956ff2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sp-debug-derive" +version = "5.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro2", "quote", @@ -9454,18 +9369,30 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fcfd91f92a2a59224230a77c4a5d6f51709620c0aab4e51f108ccece6adc56f" +dependencies = [ + "environmental", + "parity-scale-codec 3.2.1", + "sp-std 4.0.0", + "sp-storage 6.0.0", +] + +[[package]] +name = "sp-externalities" +version = "0.13.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "environmental", "parity-scale-codec 3.2.1", - "sp-std", - "sp-storage", + "sp-std 5.0.0", + "sp-storage 7.0.0", ] [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "finality-grandpa", "log", @@ -9477,29 +9404,31 @@ dependencies = [ "sp-core", "sp-keystore", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "impl-trait-for-tuples", "parity-scale-codec 3.2.1", "sp-core", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "thiserror", ] [[package]] name = "sp-io" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "bytes", + "ed25519-dalek", + "futures", "hash-db", "libsecp256k1 0.7.1", "log", @@ -9507,12 +9436,12 @@ dependencies = [ "parking_lot 0.12.1", "secp256k1", "sp-core", - "sp-externalities", + "sp-externalities 0.13.0", "sp-keystore", "sp-runtime-interface", "sp-state-machine", - "sp-std", - "sp-tracing", + "sp-std 5.0.0", + "sp-tracing 6.0.0", "sp-trie", "sp-wasm-interface", "tracing", @@ -9521,8 +9450,8 @@ dependencies = [ [[package]] name = "sp-keyring" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "lazy_static", "sp-core", @@ -9532,34 +9461,52 @@ dependencies = [ [[package]] name = "sp-keystore" -version = "0.12.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "0.13.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "merlin 2.0.1", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", "schnorrkel 0.9.1", "serde", "sp-core", - "sp-externalities", + "sp-externalities 0.13.0", "thiserror", ] [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "thiserror", "zstd", ] +[[package]] +name = "sp-mmr-primitives" +version = "4.0.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "ckb-merkle-mountain-range", + "log", + "parity-scale-codec 3.2.1", + "scale-info", + "serde", + "sp-api", + "sp-core", + "sp-debug-derive 5.0.0", + "sp-runtime", + "sp-std 5.0.0", + "thiserror", +] + [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9567,13 +9514,13 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "sp-api", "sp-core", @@ -9582,8 +9529,8 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "4.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "5.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "backtrace", "lazy_static", @@ -9593,7 +9540,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "rustc-hash", "serde", @@ -9602,8 +9549,8 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "either", "hash256-std-hasher", @@ -9619,30 +9566,32 @@ dependencies = [ "sp-arithmetic", "sp-core", "sp-io", - "sp-std", + "sp-std 5.0.0", + "sp-weights", ] [[package]] name = "sp-runtime-interface" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec 3.2.1", "primitive-types", - "sp-externalities", + "sp-externalities 0.13.0", "sp-runtime-interface-proc-macro", - "sp-std", - "sp-storage", - "sp-tracing", + "sp-std 5.0.0", + "sp-storage 7.0.0", + "sp-tracing 6.0.0", "sp-wasm-interface", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "5.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "6.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "Inflector", "proc-macro-crate 1.2.1", @@ -9654,30 +9603,21 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "log", "parity-scale-codec 3.2.1", "sp-core", "sp-io", - "sp-std", + "sp-std 5.0.0", "sp-wasm-interface", - "wasmi", -] - -[[package]] -name = "sp-serializer" -version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" -dependencies = [ - "serde", - "serde_json", + "wasmi 0.13.2", ] [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9685,24 +9625,24 @@ dependencies = [ "sp-core", "sp-runtime", "sp-staking", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", "sp-runtime", - "sp-std", + "sp-std 5.0.0", ] [[package]] name = "sp-state-machine" -version = "0.12.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "0.13.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "hash-db", "log", @@ -9712,9 +9652,9 @@ dependencies = [ "rand 0.7.3", "smallvec", "sp-core", - "sp-externalities", + "sp-externalities 0.13.0", "sp-panic-handler", - "sp-std", + "sp-std 5.0.0", "sp-trie", "thiserror", "tracing", @@ -9724,38 +9664,45 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14804d6069ee7a388240b665f17908d98386ffb0b5d39f89a4099fc7a2a4c03f" + +[[package]] +name = "sp-std" +version = "5.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dab53af846068e3e0716d3ccc70ea0db44035c79b2ed5821aaa6635039efa37" dependencies = [ - "impl-serde", + "impl-serde 0.3.2", "parity-scale-codec 3.2.1", "ref-cast", "serde", - "sp-debug-derive", - "sp-std", + "sp-debug-derive 4.0.0", + "sp-std 4.0.0", ] [[package]] -name = "sp-tasks" -version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +name = "sp-storage" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "log", - "sp-core", - "sp-externalities", - "sp-io", - "sp-runtime-interface", - "sp-std", + "impl-serde 0.4.0", + "parity-scale-codec 3.2.1", + "ref-cast", + "serde", + "sp-debug-derive 5.0.0", + "sp-std 5.0.0", ] [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "futures-timer", @@ -9764,17 +9711,30 @@ dependencies = [ "sp-api", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "thiserror", ] [[package]] name = "sp-tracing" -version = "5.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69a67e555d171c4238bd223393cda747dd20ec7d4f5fe5c042c056cb7fde9eda" +dependencies = [ + "parity-scale-codec 3.2.1", + "sp-std 4.0.0", + "tracing", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sp-tracing" +version = "6.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", - "sp-std", + "sp-std 5.0.0", "tracing", "tracing-core", "tracing-subscriber", @@ -9783,7 +9743,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "sp-api", "sp-runtime", @@ -9792,7 +9752,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "async-trait", "log", @@ -9801,22 +9761,29 @@ dependencies = [ "sp-core", "sp-inherents", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-trie", ] [[package]] name = "sp-trie" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "ahash", "hash-db", + "hashbrown", + "lazy_static", + "lru", "memory-db", + "nohash-hasher", "parity-scale-codec 3.2.1", + "parking_lot 0.12.1", "scale-info", "sp-core", - "sp-std", + "sp-std 5.0.0", "thiserror", + "tracing", "trie-db", "trie-root 0.17.0", ] @@ -9824,16 +9791,16 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "impl-serde", + "impl-serde 0.4.0", "parity-scale-codec 3.2.1", - "parity-wasm 0.42.2", + "parity-wasm", "scale-info", "serde", "sp-core-hashing-proc-macro", "sp-runtime", - "sp-std", + "sp-std 5.0.0", "sp-version-proc-macro", "thiserror", ] @@ -9841,7 +9808,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "parity-scale-codec 3.2.1", "proc-macro2", @@ -9851,28 +9818,60 @@ dependencies = [ [[package]] name = "sp-wasm-interface" -version = "6.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +version = "7.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec 3.2.1", - "sp-std", - "wasmi", + "sp-std 5.0.0", + "wasmi 0.13.2", "wasmtime", ] +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec 3.2.1", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive 5.0.0", + "sp-std 5.0.0", +] + [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +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.29.1" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e4f0cb475a8e58d9ed8a963010108768d79e397f7aff79f9a3972ef490f97de" +checksum = "d44528162f980c0e03c71e005d334332c8da0aec9f2b0b4bdc557ed4a9f24776" dependencies = [ "Inflector", "num-format", @@ -9895,6 +9894,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", +] + +[[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" @@ -9942,20 +9969,20 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.23.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae14b91c7d11c9a851d3fbc80a963198998c2a64eec840477fa92d8ce9b70bb" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.23.1" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb0dc7ee9c15cea6199cde9a127fa16a4c5819af85395457ad72d68edc85a38" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ - "heck 0.3.3", + "heck", "proc-macro2", "quote", "rustversion", @@ -9978,18 +10005,17 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "frame-system-rpc-runtime-api", - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "futures", + "jsonrpsee", "log", "parity-scale-codec 3.2.1", "sc-client-api", "sc-rpc-api", "sc-transaction-pool-api", + "serde_json", "sp-api", "sp-block-builder", "sp-blockchain", @@ -10000,7 +10026,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "futures-util", "hyper", @@ -10010,14 +10036,35 @@ dependencies = [ "tokio", ] +[[package]] +name = "substrate-state-trie-migration-rpc" +version = "4.0.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" +dependencies = [ + "jsonrpsee", + "log", + "parity-scale-codec 3.2.1", + "sc-client-api", + "sc-rpc-api", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-state-machine", + "sp-std 5.0.0", + "sp-trie", + "trie-db", +] + [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "array-bytes", "async-trait", - "futures 0.3.24", - "hex", + "futures", "parity-scale-codec 3.2.1", "sc-client-api", "sc-client-db", @@ -10039,8 +10086,9 @@ dependencies = [ [[package]] name = "substrate-test-runtime" version = "2.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ + "beefy-merkle-tree", "beefy-primitives", "cfg-if 1.0.0", "frame-support", @@ -10061,7 +10109,7 @@ dependencies = [ "sp-consensus-aura", "sp-consensus-babe", "sp-core", - "sp-externalities", + "sp-externalities 0.13.0", "sp-finality-grandpa", "sp-inherents", "sp-io", @@ -10071,7 +10119,7 @@ dependencies = [ "sp-runtime-interface", "sp-session", "sp-state-machine", - "sp-std", + "sp-std 5.0.0", "sp-transaction-pool", "sp-trie", "sp-version", @@ -10082,9 +10130,9 @@ dependencies = [ [[package]] name = "substrate-test-runtime-client" version = "2.0.0" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "parity-scale-codec 3.2.1", "sc-block-builder", "sc-client-api", @@ -10101,9 +10149,9 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ - "futures 0.3.24", + "futures", "substrate-test-utils-derive", "tokio", ] @@ -10111,7 +10159,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -10122,17 +10170,18 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-12#4deedf52f6b7fbaf3453ca3a2e0c45588154df79" dependencies = [ "ansi_term", "build-helper", "cargo_metadata", + "filetime", "sp-maybe-compressed-blob", "strum", "tempfile", "toml", "walkdir", - "wasm-gc-api", + "wasm-opt", ] [[package]] @@ -10149,9 +10198,9 @@ checksum = "734676eb262c623cec13c3155096e08d1f8f29adce39ba17948b18dad1e54142" [[package]] name = "syn" -version = "1.0.96" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ "proc-macro2", "quote", @@ -10212,9 +10261,9 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "remove_dir_all", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -10228,17 +10277,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "term" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" -dependencies = [ - "byteorder", - "dirs", - "winapi 0.3.9", -] - [[package]] name = "termcolor" version = "1.1.3" @@ -10248,6 +10286,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.11.0" @@ -10315,9 +10359,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.4.3+5.2.1-patched.2" +version = "0.5.2+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49" +checksum = "ec45c14da997d0925c7835883e4d5c181f196fa142f8c19d7643d1e9af2592c3" dependencies = [ "cc", "fs_extra", @@ -10332,7 +10376,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -10395,10 +10439,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" dependencies = [ "autocfg", - "bytes 1.2.1", + "bytes", "libc", "memchr", - "mio 0.8.4", + "mio", "num_cpus", "parking_lot 0.12.1", "pin-project-lite 0.2.9", @@ -10421,13 +10465,13 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.22.0" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" dependencies = [ - "rustls 0.19.1", + "rustls", "tokio", - "webpki 0.21.4", + "webpki", ] [[package]] @@ -10441,28 +10485,15 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes 1.2.1", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.2.9", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ - "bytes 1.2.1", + "bytes", "futures-core", + "futures-io", "futures-sink", "pin-project-lite 0.2.9", "tokio", @@ -10509,11 +10540,11 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.26" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ - "lazy_static", + "once_cell", "valuable", ] @@ -10523,7 +10554,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" dependencies = [ - "pin-project 1.0.12", + "pin-project", "tracing", ] @@ -10533,10 +10564,8 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" dependencies = [ - "ahash", "lazy_static", "log", - "lru", "tracing-core", ] @@ -10575,9 +10604,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", @@ -10606,9 +10635,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 1.0.0", @@ -10620,30 +10649,30 @@ dependencies = [ "idna 0.2.3", "ipnet", "lazy_static", - "log", "rand 0.8.5", "smallvec", "thiserror", "tinyvec", - "url 2.3.1", + "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 1.0.0", "futures-util", "ipconfig", "lazy_static", - "log", "lru-cache", "parking_lot 0.12.1", "resolv-conf", "smallvec", "thiserror", + "tracing", "trust-dns-proto", ] @@ -10667,7 +10696,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 0.1.10", "digest 0.10.5", - "rand 0.7.3", + "rand 0.8.5", "static_assertions", ] @@ -10745,12 +10774,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" - [[package]] name = "unicode-width" version = "0.1.10" @@ -10773,32 +10796,14 @@ dependencies = [ "subtle", ] -[[package]] -name = "unsigned-varint" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" - -[[package]] -name = "unsigned-varint" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35581ff83d4101e58b582e607120c7f5ffb17e632a980b1f38334d76b36908b2" -dependencies = [ - "asynchronous-codec 0.5.0", - "bytes 1.2.1", - "futures-io", - "futures-util", -] - [[package]] name = "unsigned-varint" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" dependencies = [ - "asynchronous-codec 0.6.0", - "bytes 1.2.1", + "asynchronous-codec", + "bytes", "futures-io", "futures-util", ] @@ -10809,17 +10814,6 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.3.1" @@ -10828,7 +10822,7 @@ checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", "idna 0.3.0", - "percent-encoding 2.2.0", + "percent-encoding", ] [[package]] @@ -10918,7 +10912,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", - "winapi 0.3.9", + "winapi", "winapi-util", ] @@ -11026,23 +11020,53 @@ dependencies = [ ] [[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]] @@ -11051,7 +11075,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" dependencies = [ - "futures 0.3.24", + "futures", "js-sys", "parking_lot 0.11.2", "pin-utils", @@ -11062,56 +11086,101 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +dependencies = [ + "parity-wasm", + "wasmi-validation", + "wasmi_core 0.2.1", +] + +[[package]] +name = "wasmi" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01bf50edb2ea9d922aa75a7bf3c15e26a6c9e2d18c56e862b49737a582901729" +dependencies = [ + "spin 0.9.4", + "wasmi_arena", + "wasmi_core 0.5.0", + "wasmparser-nostd", +] + +[[package]] +name = "wasmi-validation" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasmi_arena" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1ea379cbb0b41f3a9f0bf7b47036d036aae7f43383d8cc487d4deccf40dee0a" + +[[package]] +name = "wasmi_core" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" dependencies = [ "downcast-rs", - "errno", - "libc", "libm", "memory_units", - "num-rational 0.2.4", + "num-rational", "num-traits", - "parity-wasm 0.42.2", - "wasmi-validation", ] [[package]] -name = "wasmi-validation" -version = "0.4.1" +name = "wasmi_core" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "c5bf998ab792be85e20e771fe14182b4295571ad1d4f89d3da521c1bef5f597a" dependencies = [ - "parity-wasm 0.42.2", + "downcast-rs", + "libm", + "num-traits", ] [[package]] name = "wasmparser" -version = "0.83.0" +version = "0.89.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.91.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" +checksum = "9c37f310b5a62bfd5ae7c0f1d8e6f98af16a5d6d84ba764e9c36439ec14e318b" +dependencies = [ + "indexmap-nostd", +] [[package]] name = "wasmtime" -version = "0.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ffb4705016d5ca91e18a72ed6822dab50e6d5ddd7045461b17ef19071cdef1" +checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" dependencies = [ "anyhow", - "backtrace", "bincode", "cfg-if 1.0.0", "indexmap", - "lazy_static", "libc", "log", - "object 0.27.1", + "object", "once_cell", "paste", "psm", "rayon", - "region", "serde", "target-lexicon", "wasmparser", @@ -11120,14 +11189,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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45de63ddfc8b9223d1adc8f7b2ee5f35d1f6d112833934ad7ea66e4f4339e597" +dependencies = [ + "cfg-if 1.0.0", ] [[package]] name = "wasmtime-cache" -version = "0.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c6ab24291fa7cb3a181f5669f6c72599b7ef781669759b45c7828c5999d0c0" +checksum = "bcd849399d17d2270141cfe47fa0d91ee52d5f8ea9b98cf7ddde0d53e5f79882" dependencies = [ "anyhow", "base64 0.13.0", @@ -11135,19 +11213,19 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix", + "rustix 0.35.13", "serde", "sha2 0.9.9", "toml", - "winapi 0.3.9", + "windows-sys 0.36.1", "zstd", ] [[package]] name = "wasmtime-cranelift" -version = "0.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04c810078a491b7bc4866ebe045f714d2b95e6b539e1f64009a4a7606be11de" +checksum = "4bd91339b742ff20bfed4532a27b73c86b5bcbfedd6bea2dcdf2d64471e1b5c6" dependencies = [ "anyhow", "cranelift-codegen", @@ -11157,8 +11235,7 @@ dependencies = [ "cranelift-wasm", "gimli", "log", - "more-asserts", - "object 0.27.1", + "object", "target-lexicon", "thiserror", "wasmparser", @@ -11167,17 +11244,16 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "0.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61448266ea164b1ac406363cdcfac81c7c44db4d94c7a81c8620ac6c5c6cdf59" +checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" dependencies = [ "anyhow", "cranelift-entity", "gimli", "indexmap", "log", - "more-asserts", - "object 0.27.1", + "object", "serde", "target-lexicon", "thiserror", @@ -11187,9 +11263,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "0.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "156b4623c6b0d4b8c24afb846c20525922f538ef464cc024abab7ea8de2109a2" +checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" dependencies = [ "addr2line", "anyhow", @@ -11198,60 +11274,59 @@ dependencies = [ "cpp_demangle", "gimli", "log", - "object 0.27.1", - "region", + "object", "rustc-demangle", - "rustix", + "rustix 0.35.13", "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.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5dc31f811760a6c76b2672c404866fd19b75e5fb3b0075a3e377a6846490654" +checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" dependencies = [ - "lazy_static", - "object 0.27.1", - "rustix", + "object", + "once_cell", + "rustix 0.35.13", ] [[package]] name = "wasmtime-runtime" -version = "0.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f907beaff69d4d920fa4688411ee4cc75c0f01859e424677f9e426e2ef749864" +checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" dependencies = [ "anyhow", - "backtrace", "cc", "cfg-if 1.0.0", "indexmap", "libc", "log", "mach", + "memfd", "memoffset", - "more-asserts", + "paste", "rand 0.8.5", - "region", - "rustix", + "rustix 0.35.13", "thiserror", + "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "winapi 0.3.9", + "windows-sys 0.36.1", ] [[package]] name = "wasmtime-types" -version = "0.35.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514ef0e5fd197b9609dc9eb74beba0c84d5a12b2417cbae55534633329ba4852" +checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" dependencies = [ "cranelift-entity", "serde", @@ -11290,16 +11365,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki" version = "0.22.0" @@ -11316,7 +11381,7 @@ version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" dependencies = [ - "webpki 0.22.0", + "webpki", ] [[package]] @@ -11345,12 +11410,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - [[package]] name = "winapi" version = "0.3.9" @@ -11361,12 +11420,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -11379,7 +11432,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -11537,17 +11590,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] @@ -11576,7 +11619,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d9ba232399af1783a58d8eb26f6b5006fbefe2dc9ef36bd283324792d03ea5" dependencies = [ - "futures 0.3.24", + "futures", "log", "nohash-hasher", "parking_lot 0.12.1", @@ -11607,18 +11650,18 @@ dependencies = [ [[package]] name = "zstd" -version = "0.10.2+zstd.1.5.2" +version = "0.11.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4a6bd64f22b5e3e94b4e238669ff9f10815c27a5180108b849d24174a83847" +checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "4.1.6+zstd.1.5.2" +version = "5.0.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b61c51bb270702d6167b8ce67340d2754b088d0c091b06e593aa772c3ee9bb" +checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" dependencies = [ "libc", "zstd-sys", @@ -11626,10 +11669,11 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "1.6.3+zstd.1.5.2" +version = "2.0.5+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc49afa5c8d634e75761feda8c592051e7eeb4683ba827211eb0d731d3402ea8" +checksum = "edc50ffce891ad571e9f9afe5039c4837bede781ac4bb13052ed7ae695518596" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 065889de6d..c0e589e529 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "polymesh" -version = "5.3.0" +version = "5.4.0" authors = ["Polymesh Association"] build = "build.rs" edition = "2021" @@ -11,98 +11,99 @@ path = "src/main.rs" # Path build to use our Substrate version from github, `branch = "develop"`. [patch.crates-io] -frame-benchmarking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -frame-benchmarking-cli = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -frame-executive = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -frame-support = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -frame-election-provider-support = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -frame-system = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -frame-system-benchmarking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -frame-system-rpc-runtime-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-balances = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-contracts = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-contracts-primitives = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-contracts-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-contracts-rpc-runtime-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-im-online = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-indices = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-offences = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-preimage = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-randomness-collective-flip = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-scheduler = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-session = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-staking-reward-curve = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-timestamp = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -pallet-treasury = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-basic-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-block-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-chain-spec = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-cli = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-client-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-client-db = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-consensus = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-consensus-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-consensus-babe-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-consensus-epochs = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-consensus-slots = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-consensus-uncles = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-executor = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-finality-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-finality-grandpa-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-keystore = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-network = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-rpc-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-service = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-telemetry = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-transaction-pool = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-transaction-pool-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sc-sync-state-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-application-crypto = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-arithmetic = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-block-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-blockchain = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-consensus = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-consensus-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-consensus-slots = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-core = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-externalities = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-finality-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-inherents = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-io = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-keystore = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-keyring = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-npos-elections = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-offchain = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-runtime = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-runtime-interface = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-serializer = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-session = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-staking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-state-machine = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-std = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-storage = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-timestamp = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-tracing = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-transaction-pool = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-transaction-storage-proof = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-trie = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -sp-version = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -substrate-frame-rpc-system = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -substrate-prometheus-endpoint = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -substrate-test-utils = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -substrate-test-utils-derive = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } -substrate-wasm-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } +frame-benchmarking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +frame-benchmarking-cli = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +frame-executive = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +frame-support = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +frame-election-provider-support = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +frame-system = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +frame-system-benchmarking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +frame-system-rpc-runtime-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-balances = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-contracts = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-contracts-primitives = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-im-online = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-indices = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-offences = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-preimage = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-randomness-collective-flip = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-scheduler = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-session = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-staking-reward-curve = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-timestamp = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +pallet-treasury = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-basic-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-block-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-chain-spec = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-cli = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-client-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-client-db = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-consensus = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-consensus-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-consensus-babe-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-consensus-epochs = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-consensus-slots = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-consensus-uncles = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-executor = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-finality-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-finality-grandpa-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-keystore = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-network = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-network-common = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-rpc-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-rpc-spec-v2 = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-service = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-telemetry = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-transaction-pool = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-transaction-pool-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sc-sync-state-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-application-crypto = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-arithmetic = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-block-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-blockchain = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-consensus = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-consensus-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-consensus-slots = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-core = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-externalities = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-finality-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-inherents = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-io = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-keystore = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-keyring = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-npos-elections = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-offchain = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-runtime = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-weights = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-runtime-interface = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-session = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-staking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-state-machine = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-std = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-storage = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-timestamp = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-tracing = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-transaction-pool = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-transaction-storage-proof = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-trie = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +sp-version = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +substrate-frame-rpc-system = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +substrate-state-trie-migration-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +substrate-prometheus-endpoint = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +substrate-test-utils = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +substrate-test-utils-derive = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } +substrate-wasm-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } bulletproofs = { version = "4.0.0", git = "https://github.com/PolymeshAssociation/bulletproofs", branch = "polymesh" } @@ -201,16 +202,16 @@ polymesh-runtime-testnet = { path = "pallets/runtime/testnet" } # General chrono = "0.4.11" ed25519-dalek = "1.0.0" -futures = "0.3.4" -jsonrpc-core = { version = "18.0", features = ["arbitrary_precision"] } -log = "0.4.8" -serde = { version = "1.0.104", default-features = false } +futures = "0.3.21" +jsonrpsee = { version = "0.15.1", features = ["server"] } +log = "0.4.17" +serde = { version = "1.0.136", default-features = false } serde_json = { version = "1.0", features = ["arbitrary_precision"] } -clap = { version = "3.1.6", features = ["derive"] } +clap = { version = "4.0.9", features = ["derive"] } rustc-hex = "2.1.0" # Pin version to work around substrate logging issue. -tracing-core = "=0.1.26" +tracing-core = "0.1.30" # Substrate codec = { version = "3.0.0", package = "parity-scale-codec" } @@ -218,7 +219,6 @@ frame-support = "4.0.0-dev" frame-system = "4.0.0-dev" frame-system-rpc-runtime-api = "4.0.0-dev" grandpa = { package = "sc-finality-grandpa", version = "0.10.0-dev" } -pallet-contracts-rpc-runtime-api = "4.0.0-dev" pallet-babe = "4.0.0-dev" pallet-im-online = "4.0.0-dev" pallet-indices = "4.0.0-dev" @@ -227,17 +227,18 @@ prometheus-endpoint = { package = "substrate-prometheus-endpoint", version = "0. sc-authority-discovery = "0.10.0-dev" sc-basic-authorship = "0.10.0-dev" sc-chain-spec = "4.0.0-dev" -sc-cli = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-cli = { version = "0.10.0-dev" } sc-client-api = "4.0.0-dev" -sc-client-db = "0.10.0-dev" +sc-client-db = { version = "0.10.0-dev", default-features = false } sc-consensus = "0.10.0-dev" sc-consensus-babe = "0.10.0-dev" sc-consensus-slots = "0.10.0-dev" sc-consensus-uncles = "0.10.0-dev" -sc-executor = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-executor = { version = "0.10.0-dev" } sc-network = "0.10.0-dev" +sc-network-common = { version = "0.10.0-dev" } sc-rpc = "4.0.0-dev" -sc-service = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-service = { version = "0.10.0-dev" } sc-telemetry = "4.0.0-dev" sc-transaction-pool = "4.0.0-dev" sc-sync-state-rpc = { version = "0.10.0-dev" } @@ -249,12 +250,12 @@ sp-blockchain = "4.0.0-dev" sp-consensus = "0.10.0-dev" sp-consensus-babe = "0.10.0-dev" sp-consensus-slots = "0.10.0-dev" -sp-keyring = { version = "6.0.0" } -sp-core = "6.0.0" +sp-keyring = { version = "7.0.0" } +sp-core = "7.0.0" sp-inherents = "4.0.0-dev" sp-transaction-storage-proof = "4.0.0-dev" sp-offchain = "4.0.0-dev" -sp-runtime = "6.0.0" +sp-runtime = "7.0.0" sp-timestamp = "4.0.0-dev" sp-session = "4.0.0-dev" sp-transaction-pool = { version = "4.0.0-dev" } @@ -270,7 +271,10 @@ vergen = "3.1.0" default = ["std"] running-ci = [ "polymesh-runtime-develop/running-ci" ] default_identity = [ "polymesh-common-utilities/default_identity" ] -runtime-benchmarks = [ "polymesh-runtime-develop/runtime-benchmarks" ] +runtime-benchmarks = [ + "sc-client-db/runtime-benchmarks", + "polymesh-runtime-develop/runtime-benchmarks", +] # Only build a "ci" runtime. ci-runtime = [ "polymesh-runtime-develop/ci-runtime" ] diff --git a/bin/bench/Cargo.toml b/bin/bench/Cargo.toml index 225d760e53..d26cc3ec87 100644 --- a/bin/bench/Cargo.toml +++ b/bin/bench/Cargo.toml @@ -13,19 +13,19 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" node-primitives = { package = "polymesh-primitives", path = "../../primitives" } node-runtime = { package = "polymesh-runtime-testnet", path = "../../pallets/runtime/testnet" } node-testing = { path = "../testing" } -sc-cli = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-cli = { version = "0.10.0-dev" } sc-client-api = { version = "4.0.0-dev" } -sp-runtime = { version = "6.0.0" } -sp-state-machine = { version = "0.12.0" } +sp-runtime = { version = "7.0.0" } +sp-state-machine = { version = "0.13.0" } log = "0.4.8" serde = "1.0.101" serde_json = "1.0.41" clap = { version = "3.1.6", features = ["derive"] } derive_more = "0.99.2" -kvdb = "0.11" -kvdb-rocksdb = "0.15.0" -sp-trie = { version = "6.0.0" } -sp-core = { version = "6.0.0" } +kvdb = "0.12" +kvdb-rocksdb = "0.16.0" +sp-trie = { version = "7.0.0" } +sp-core = { version = "7.0.0" } sp-consensus = { version = "0.10.0-dev" } sp-transaction-pool = { version = "4.0.0-dev" } sc-basic-authorship = { version = "0.10.0-dev" } @@ -38,7 +38,7 @@ fs_extra = "1" hex = "0.4.0" rand = { version = "0.7.2", features = ["small_rng"] } lazy_static = "1.4.0" -parity-util-mem = { version = "0.11.0", default-features = false, features = ["primitive-types"] } -parity-db = { version = "0.2.4" } +parity-util-mem = { version = "0.12.0", default-features = false, features = ["primitive-types"] } +parity-db = { version = "0.3.16" } sc-transaction-pool = { version = "4.0.0-dev" } futures = { version = "0.3.4", features = ["thread-pool"] } diff --git a/bin/crypto-cli/Cargo.toml b/bin/crypto-cli/Cargo.toml index 3be8b6439f..6fb80d1856 100644 --- a/bin/crypto-cli/Cargo.toml +++ b/bin/crypto-cli/Cargo.toml @@ -7,6 +7,6 @@ edition = "2021" [dependencies] polymesh-primitives = { path = "../../primitives" } -confidential_identity_v1 = { version = "1.0.1" } +confidential_identity_v1 = { version = "1.1.0" } codec = { version = "3.0.0", package = "parity-scale-codec" } hex = "0.4.0" diff --git a/bin/executor/Cargo.toml b/bin/executor/Cargo.toml index d94292340a..1e26ed2ddb 100644 --- a/bin/executor/Cargo.toml +++ b/bin/executor/Cargo.toml @@ -15,11 +15,11 @@ targets = ["x86_64-unknown-linux-gnu"] codec = { package = "parity-scale-codec", version = "3.0.0" } node-primitives = { package = "polymesh-primitives", path = "../../primitives" } node-runtime = { package = "polymesh-runtime-testnet", path = "../../pallets/runtime/testnet" } -sc-executor = { version = "0.10.0-dev", features = ["wasmtime"] } -sp-core = { version = "6.0.0" } -sp-io = { version = "6.0.0" } -sp-state-machine = { version = "0.12.0" } -sp-trie = { version = "6.0.0" } +sc-executor = { version = "0.10.0-dev" } +sp-core = { version = "7.0.0" } +sp-io = { version = "7.0.0" } +sp-state-machine = { version = "0.13.0" } +sp-trie = { version = "7.0.0" } trie-root = "0.16.0" frame-benchmarking = { version = "4.0.0-dev" } @@ -38,19 +38,13 @@ pallet-indices = { version = "4.0.0-dev" } pallet-session = { version = "4.0.0-dev" } pallet-timestamp = { version = "4.0.0-dev" } pallet-treasury = { version = "4.0.0-dev" } -sp-application-crypto = { version = "6.0.0" } -sp-runtime = { version = "6.0.0" } +sp-application-crypto = { version = "7.0.0" } +sp-runtime = { version = "7.0.0" } sp-externalities = { version = "0.12.0" } -substrate-test-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } +substrate-test-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } wabt = "0.10.0" [features] -wasmtime = [ - "sc-executor/wasmtime", -] -wasmi-errno = [ - "sc-executor/wasmi-errno", -] stress-test = [] [[bench]] diff --git a/bin/testing/Cargo.toml b/bin/testing/Cargo.toml index 4a89df684c..029eb6a753 100644 --- a/bin/testing/Cargo.toml +++ b/bin/testing/Cargo.toml @@ -21,25 +21,25 @@ pallet-transaction-payment = { path = "../../pallets/transaction-payment" } pallet-permissions = { path = "../../pallets/permissions" } pallet-staking = { path = "../../pallets/staking" } pallet-balances = { path = "../../pallets/balances" } -node-executor = { path = "../executor", features = ["wasmtime"] } +node-executor = { path = "../executor" } -sc-service = { version = "0.10.0-dev", features = ["test-helpers", "db", "wasmtime"] } -sc-client-db = { version = "0.10.0-dev", features = ["kvdb-rocksdb", "parity-db"] } +sc-service = { version = "0.10.0-dev", features = ["test-helpers"] } +sc-client-db = { version = "0.10.0-dev", features = ["kvdb-rocksdb"] } sc-client-api = { version = "4.0.0-dev" } codec = { package = "parity-scale-codec", version = "3.0.0" } #pallet-contracts = { version = "4.0.0-dev" } pallet-grandpa = { version = "4.0.0-dev" } pallet-indices = { version = "4.0.0-dev" } -sp-keyring = { version = "6.0.0" } -sp-core = { version = "6.0.0" } -sp-io = { version = "6.0.0" } +sp-keyring = { version = "7.0.0" } +sp-core = { version = "7.0.0" } +sp-io = { version = "7.0.0" } frame-support = { version = "4.0.0-dev" } pallet-session = { version = "4.0.0-dev" } -sp-runtime = { version = "6.0.0" } -sc-executor = { version = "0.10.0-dev", features = ["wasmtime"] } +sp-runtime = { version = "7.0.0" } +sc-executor = { version = "0.10.0-dev" } sp-consensus = { version = "0.10.0-dev" } frame-system = { version = "4.0.0-dev" } -substrate-test-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } +substrate-test-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } pallet-timestamp = { version = "4.0.0-dev" } pallet-treasury = { version = "4.0.0-dev" } wabt = "0.10.0" @@ -56,4 +56,4 @@ futures = "0.3.1" [dev-dependencies] criterion = "0.3.0" -sc-cli = { version = "0.10.0-dev", features = ["wasmtime"] } +sc-cli = { version = "0.10.0-dev" } diff --git a/migration-tests/Cargo.toml b/migration-tests/Cargo.toml index 2c07480a92..fbec3d7491 100644 --- a/migration-tests/Cargo.toml +++ b/migration-tests/Cargo.toml @@ -16,7 +16,7 @@ sp-state-machine-old = { package = "sp-state-machine", git = "https://github.com # New migration helpers remote-externalities = { path = "remote-externalities" } frame-support = { version = "4.0.0-dev" } -sp-core = { version = "6.0.0" } +sp-core = { version = "7.0.0" } # Old pallets polymesh-runtime-old = { package = "polymesh-runtime-testnet", git = "https://github.com/PolymeshAssociation/Polymesh", rev = "14951c75b778d5ee75c8ecdc02b70b6eb6d7b172" } diff --git a/migration-tests/remote-externalities/Cargo.toml b/migration-tests/remote-externalities/Cargo.toml index e768dc275e..65eb3d0765 100644 --- a/migration-tests/remote-externalities/Cargo.toml +++ b/migration-tests/remote-externalities/Cargo.toml @@ -16,8 +16,8 @@ log = "0.4.11" bincode = "1.3.1" tokio = "0.1.22" -sp-io = { version = "6.0.0" } -sp-core = { version = "6.0.0" } +sp-io = { version = "7.0.0" } +sp-core = { version = "7.0.0" } [dev-dependencies] async-std = { version = "1.6.5", features = ["attributes"] } diff --git a/node-rpc/Cargo.toml b/node-rpc/Cargo.toml index 81c4d06b2c..740c64ea7c 100644 --- a/node-rpc/Cargo.toml +++ b/node-rpc/Cargo.toml @@ -10,34 +10,32 @@ repository = "https://github.com/PolymeshAssociation/substrate" targets = ["x86_64-unknown-linux-gnu"] [dependencies] +jsonrpsee = { version = "0.15.1", features = ["server"] } + polymesh-primitives = { path = "../primitives", default-features = false } -pallet-contracts-rpc = { version = "4.0.0-dev" } pallet-group-rpc = { path = "../pallets/group/rpc" } pallet-staking-rpc = { path = "../pallets/staking/rpc" } pallet-protocol-fee-rpc = { path = "../pallets/protocol-fee/rpc" } node-rpc = { path = "../rpc" } -jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } - -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -sp-blockchain = { version = "4.0.0-dev" } -sp-runtime = { version = "6.0.0" } -sp-api = { version = "4.0.0-dev" } -sc-client-api = { version = "4.0.0-dev" } -sp-consensus = { version = "0.10.0-dev" } -sp-consensus-babe = { version = "0.10.0-dev" } -sp-block-builder = { version = "4.0.0-dev" } -sp-keystore = { version = "0.12.0" } - -sc-rpc = { version = "4.0.0-dev" } -sc-rpc-api = { version = "0.10.0-dev" } sc-chain-spec = { version = "4.0.0-dev" } +sc-client-api = { version = "4.0.0-dev" } sc-consensus-babe = { version = "0.10.0-dev" } sc-consensus-babe-rpc = { version = "0.10.0-dev" } sc-consensus-epochs = { version = "0.10.0-dev" } sc-finality-grandpa = { version = "0.10.0-dev" } sc-finality-grandpa-rpc = { version = "0.10.0-dev" } -sc-keystore = { version = "4.0.0-dev" } +sc-rpc = { version = "4.0.0-dev" } +sc-rpc-api = { version = "0.10.0-dev" } +sc-rpc-spec-v2 = { version = "0.10.0-dev" } sc-sync-state-rpc = { version = "0.10.0-dev" } sc-transaction-pool-api = { version = "4.0.0-dev" } +sp-api = { version = "4.0.0-dev" } +sp-block-builder = { version = "4.0.0-dev" } +sp-blockchain = { version = "4.0.0-dev" } +sp-consensus = { version = "0.10.0-dev" } +sp-consensus-babe = { version = "0.10.0-dev" } +sp-keystore = { version = "0.13.0" } +sp-runtime = { version = "7.0.0" } substrate-frame-rpc-system = { version = "4.0.0-dev" } +substrate-state-trie-migration-rpc = { version = "4.0.0-dev" } diff --git a/node-rpc/src/lib.rs b/node-rpc/src/lib.rs index 116cfb9f10..8dcb2caac0 100644 --- a/node-rpc/src/lib.rs +++ b/node-rpc/src/lib.rs @@ -30,16 +30,18 @@ #![warn(missing_docs)] -use polymesh_primitives::{ - AccountId, Balance, Block, BlockNumber, Hash, IdentityId, Index, Moment, Ticker, -}; +use std::sync::Arc; + +use jsonrpsee::RpcModule; +use polymesh_primitives::{AccountId, Block, BlockNumber, Hash, IdentityId, Index, Moment, Ticker}; use sc_client_api::AuxStore; -use sc_consensus_babe::{Config, Epoch}; +use sc_consensus_babe::{BabeConfiguration, Epoch}; use sc_consensus_epochs::SharedEpochChanges; use sc_finality_grandpa::{ FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState, }; -use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; +use sc_rpc::SubscriptionTaskExecutor; +pub use sc_rpc_api::DenyUnsafe; use sc_transaction_pool_api::TransactionPool; use sp_api::ProvideRuntimeApi; use sp_block_builder::BlockBuilder; @@ -47,12 +49,11 @@ use sp_blockchain::{Error as BlockChainError, HeaderBackend, HeaderMetadata}; use sp_consensus::SelectChain; use sp_consensus_babe::BabeApi; use sp_keystore::SyncCryptoStorePtr; -use std::sync::Arc; /// Extra dependencies for BABE. pub struct BabeDeps { /// BABE protocol config. - pub babe_config: Config, + pub babe_config: BabeConfiguration, /// BABE pending epoch changes. pub shared_epoch_changes: SharedEpochChanges, /// The keystore that manages the keys of the node. @@ -91,15 +92,14 @@ pub struct FullDeps { pub grandpa: GrandpaDeps, } -/// A IO handler that uses all Full RPC extensions. -pub type IoHandler = jsonrpc_core::IoHandler; - /// Instantiate all Full RPC extensions. pub fn create_full( deps: FullDeps, -) -> Result, Box> + backend: Arc, +) -> Result, Box> where C: ProvideRuntimeApi + + sc_client_api::BlockBackend + HeaderBackend + AuxStore + HeaderMetadata @@ -107,7 +107,6 @@ where + Send + 'static, C::Api: substrate_frame_rpc_system::AccountNonceApi, - C::Api: pallet_contracts_rpc::ContractsRuntimeApi, C::Api: node_rpc::transaction_payment::TransactionPaymentRuntimeApi, C::Api: pallet_staking_rpc::StakingRuntimeApi, C::Api: node_rpc::pips::PipsRuntimeApi, @@ -124,23 +123,26 @@ where B: sc_client_api::Backend + Send + Sync + 'static, B::State: sc_client_api::backend::StateBackend>, { - use node_rpc::compliance_manager::{ComplianceManager, ComplianceManagerApi}; + use node_rpc::compliance_manager::{ComplianceManager, ComplianceManagerApiServer}; use node_rpc::{ - asset::{Asset, AssetApi}, - identity::{Identity, IdentityApi}, - nft::{NFTApi, NFT}, - pips::{Pips, PipsApi}, - transaction_payment::{TransactionPayment, TransactionPaymentApi}, + asset::{Asset, AssetApiServer}, + identity::{Identity, IdentityApiServer}, + nft::{NFTApiServer, NFT}, + pips::{Pips, PipsApiServer}, + transaction_payment::{TransactionPayment, TransactionPaymentApiServer}, }; - use pallet_contracts_rpc::{Contracts, ContractsApi}; - use pallet_group_rpc::{Group, GroupApi}; - use pallet_protocol_fee_rpc::{ProtocolFee, ProtocolFeeApi}; - use pallet_staking_rpc::{Staking, StakingApi}; - use sc_consensus_babe_rpc::BabeRpcHandler; - use sc_finality_grandpa_rpc::GrandpaRpcHandler; - use substrate_frame_rpc_system::{FullSystem, SystemApi}; - - let mut io = jsonrpc_core::IoHandler::default(); + use pallet_group_rpc::{Group, GroupApiServer}; + use pallet_protocol_fee_rpc::{ProtocolFee, ProtocolFeeApiServer}; + use pallet_staking_rpc::{Staking, StakingApiServer}; + use sc_consensus_babe_rpc::{Babe, BabeApiServer}; + use sc_finality_grandpa_rpc::{Grandpa, GrandpaApiServer}; + use sc_rpc::dev::{Dev, DevApiServer}; + use sc_rpc_spec_v2::chain_spec::{ChainSpec, ChainSpecApiServer}; + use sc_sync_state_rpc::{SyncState, SyncStateApiServer}; + use substrate_frame_rpc_system::{System, SystemApiServer}; + use substrate_state_trie_migration_rpc::{StateMigration, StateMigrationApiServer}; + + let mut io = RpcModule::new(()); let FullDeps { client, pool, @@ -164,58 +166,63 @@ where finality_provider, } = grandpa; - io.extend_with(SystemApi::to_delegate(FullSystem::new( - client.clone(), - pool, - deny_unsafe, - ))); + 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(); + io.merge(ChainSpec::new(chain_name, genesis_hash, properties).into_rpc())?; + + io.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; // Making synchronous calls in light client freezes the browser currently, - // more context: https://github.com/PolymeshAssociation/substrate/pull/3480 + // more context: https://github.com/paritytech/substrate/pull/3480 // These RPCs should use an asynchronous caller instead. - io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone()))); - io.extend_with(TransactionPaymentApi::to_delegate(TransactionPayment::new( - client.clone(), - ))); - io.extend_with(sc_consensus_babe_rpc::BabeApi::to_delegate( - BabeRpcHandler::new( + io.merge(TransactionPayment::new(client.clone()).into_rpc())?; + io.merge( + Babe::new( client.clone(), shared_epoch_changes.clone(), keystore, babe_config, select_chain, deny_unsafe, - ), - )); - io.extend_with(sc_finality_grandpa_rpc::GrandpaApi::to_delegate( - GrandpaRpcHandler::new( + ) + .into_rpc(), + )?; + io.merge( + Grandpa::new( + subscription_executor, shared_authority_set.clone(), shared_voter_state, justification_stream, - subscription_executor, finality_provider, - ), - )); + ) + .into_rpc(), + )?; - io.extend_with(sc_sync_state_rpc::SyncStateRpcApi::to_delegate( - sc_sync_state_rpc::SyncStateRpcHandler::new( + io.merge( + SyncState::new( chain_spec, client.clone(), shared_authority_set, shared_epoch_changes, - )?, - )); - io.extend_with(StakingApi::to_delegate(Staking::new(client.clone()))); - io.extend_with(PipsApi::to_delegate(Pips::new(client.clone()))); - io.extend_with(IdentityApi::to_delegate(Identity::new(client.clone()))); - io.extend_with(ProtocolFeeApi::to_delegate(ProtocolFee::new( - client.clone(), - ))); - io.extend_with(AssetApi::to_delegate(Asset::new(client.clone()))); - io.extend_with(GroupApi::to_delegate(Group::from(client.clone()))); - io.extend_with(ComplianceManagerApi::to_delegate(ComplianceManager::new( - client.clone(), - ))); - io.extend_with(NFTApi::to_delegate(NFT::new(client))); + )? + .into_rpc(), + )?; + + io.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?; + io.merge(Dev::new(client.clone(), deny_unsafe).into_rpc())?; + + io.merge(Staking::new(client.clone()).into_rpc())?; + io.merge(Pips::new(client.clone()).into_rpc())?; + io.merge(Identity::new(client.clone()).into_rpc())?; + io.merge(ProtocolFee::new(client.clone()).into_rpc())?; + io.merge(Asset::new(client.clone()).into_rpc())?; + io.merge(Group::from(client.clone()).into_rpc())?; + io.merge(ComplianceManager::new(client.clone()).into_rpc())?; + io.merge(NFT::new(client).into_rpc())?; Ok(io) } diff --git a/pallets/asset/Cargo.toml b/pallets/asset/Cargo.toml index f5ed4f881f..f47f1a9d28 100644 --- a/pallets/asset/Cargo.toml +++ b/pallets/asset/Cargo.toml @@ -30,11 +30,11 @@ arrayvec = { version = "0.7.1", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-arithmetic = { version = "5.0.0", default-features = false } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/asset/src/checkpoint/mod.rs b/pallets/asset/src/checkpoint/mod.rs index 1979a5bcb3..a5ffb4b0f8 100644 --- a/pallets/asset/src/checkpoint/mod.rs +++ b/pallets/asset/src/checkpoint/mod.rs @@ -183,7 +183,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; diff --git a/pallets/asset/src/lib.rs b/pallets/asset/src/lib.rs index 25b4bd0cf0..eb2f13d1f7 100644 --- a/pallets/asset/src/lib.rs +++ b/pallets/asset/src/lib.rs @@ -359,7 +359,7 @@ type Identity = identity::Module; // Public interface for this runtime module. decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; @@ -1003,7 +1003,7 @@ decl_error! { } } -impl AssetFnTrait for Module { +impl AssetFnTrait for Module { fn ensure_granular(ticker: &Ticker, value: Balance) -> DispatchResult { Self::ensure_granular(ticker, value) } @@ -1014,7 +1014,7 @@ impl AssetFnTrait for Module { } fn create_asset( - origin: T::Origin, + origin: T::RuntimeOrigin, name: AssetName, ticker: Ticker, divisible: bool, @@ -1035,7 +1035,7 @@ impl AssetFnTrait for Module { ) } - fn register_ticker(origin: T::Origin, ticker: Ticker) -> DispatchResult { + fn register_ticker(origin: T::RuntimeOrigin, ticker: Ticker) -> DispatchResult { Self::base_register_ticker(origin, ticker) } @@ -1060,13 +1060,13 @@ impl AssetFnTrait for Module { ScopeIdOf::insert(ticker, did, did); } - fn issue(origin: T::Origin, ticker: Ticker, total_supply: Balance) -> DispatchResult { + fn issue(origin: T::RuntimeOrigin, ticker: Ticker, total_supply: Balance) -> DispatchResult { Self::issue(origin, ticker, total_supply) } #[cfg(feature = "runtime-benchmarks")] fn register_asset_metadata_type( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Option, name: AssetMetadataName, spec: AssetMetadataSpec, @@ -1158,7 +1158,7 @@ impl Module { Ok(()) } - pub fn base_register_ticker(origin: T::Origin, ticker: Ticker) -> DispatchResult { + pub fn base_register_ticker(origin: T::RuntimeOrigin, ticker: Ticker) -> DispatchResult { let to_did = Identity::::ensure_perms(origin)?; let expiry = Self::ticker_registration_checks(&ticker, to_did, false, || { Self::ticker_registration_config() @@ -1179,7 +1179,7 @@ impl Module { } pub fn ensure_agent_with_custody_and_perms( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, portfolio_kind: PortfolioKind, ) -> Result { @@ -1621,7 +1621,7 @@ impl Module { } /// Accepts and executes the ticker transfer. - fn base_accept_ticker_transfer(origin: T::Origin, auth_id: u64) -> DispatchResult { + fn base_accept_ticker_transfer(origin: T::RuntimeOrigin, auth_id: u64) -> DispatchResult { let to = Identity::::ensure_perms(origin)?; >::accept_auth_with(&to.into(), auth_id, |data, auth_by| { let ticker = extract_auth!(data, TransferTicker(t)); @@ -1646,7 +1646,7 @@ impl Module { } /// Accept and process a token ownership transfer. - fn base_accept_token_ownership_transfer(origin: T::Origin, id: u64) -> DispatchResult { + fn base_accept_token_ownership_transfer(origin: T::RuntimeOrigin, id: u64) -> DispatchResult { let to = Identity::::ensure_perms(origin)?; >::accept_auth_with(&to.into(), id, |data, auth_by| { let ticker = extract_auth!(data, TransferAssetOwnership(t)); @@ -1763,7 +1763,7 @@ impl Module { } fn base_create_asset( - origin: T::Origin, + origin: T::RuntimeOrigin, name: AssetName, ticker: Ticker, divisible: bool, @@ -1907,7 +1907,7 @@ impl Module { Ok(did) } - fn set_freeze(origin: T::Origin, ticker: Ticker, freeze: bool) -> DispatchResult { + fn set_freeze(origin: T::RuntimeOrigin, ticker: Ticker, freeze: bool) -> DispatchResult { let did = >::ensure_perms(origin, ticker)?; Self::ensure_asset_exists(&ticker)?; @@ -1926,7 +1926,11 @@ impl Module { Ok(()) } - fn base_rename_asset(origin: T::Origin, ticker: Ticker, name: AssetName) -> DispatchResult { + fn base_rename_asset( + origin: T::RuntimeOrigin, + ticker: Ticker, + name: AssetName, + ) -> DispatchResult { Self::ensure_asset_name_bounded(&name)?; Self::ensure_asset_exists(&ticker)?; let did = >::ensure_perms(origin, ticker)?; @@ -1946,7 +1950,7 @@ impl Module { } fn base_redeem( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, value: Balance, portfolio_kind: PortfolioKind, @@ -2021,7 +2025,7 @@ impl Module { Ok(()) } - fn base_make_divisible(origin: T::Origin, ticker: Ticker) -> DispatchResult { + fn base_make_divisible(origin: T::RuntimeOrigin, ticker: Ticker) -> DispatchResult { let did = >::ensure_perms(origin, ticker)?; Tokens::try_mutate(&ticker, |token| -> DispatchResult { @@ -2039,7 +2043,7 @@ impl Module { } fn base_add_documents( - origin: T::Origin, + origin: T::RuntimeOrigin, docs: Vec, ticker: Ticker, ) -> DispatchResult { @@ -2071,7 +2075,7 @@ impl Module { } fn base_remove_documents( - origin: T::Origin, + origin: T::RuntimeOrigin, ids: Vec, ticker: Ticker, ) -> DispatchResult { @@ -2084,7 +2088,7 @@ impl Module { } fn base_set_funding_round( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, name: FundingRoundName, ) -> DispatchResult { @@ -2106,7 +2110,7 @@ impl Module { } fn base_update_identifiers( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, identifiers: Vec, ) -> DispatchResult { @@ -2161,7 +2165,7 @@ impl Module { } fn base_set_asset_metadata( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, key: AssetMetadataKey, value: AssetMetadataValue, @@ -2208,7 +2212,7 @@ impl Module { } fn base_set_asset_metadata_details( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, key: AssetMetadataKey, detail: AssetMetadataValueDetail, @@ -2242,7 +2246,7 @@ impl Module { } fn base_register_and_set_local_asset_metadata( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec, @@ -2259,7 +2263,7 @@ impl Module { } fn base_register_asset_metadata_local_type( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec, @@ -2302,7 +2306,7 @@ impl Module { } fn base_register_asset_metadata_global_type( - origin: T::Origin, + origin: T::RuntimeOrigin, name: AssetMetadataName, spec: AssetMetadataSpec, ) -> DispatchResult { @@ -2333,7 +2337,7 @@ impl Module { } fn base_claim_classic_ticker( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, ethereum_signature: ethereum::EcdsaSignature, ) -> DispatchResult { @@ -2378,7 +2382,7 @@ impl Module { } fn base_reserve_classic_ticker( - origin: T::Origin, + origin: T::RuntimeOrigin, classic_ticker_import: ClassicTickerImport, contract_did: IdentityId, config: TickerRegistrationConfig, @@ -2408,7 +2412,7 @@ impl Module { } fn base_controller_transfer( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, value: Balance, from_portfolio: PortfolioId, @@ -2593,7 +2597,7 @@ impl Module { } fn base_register_custom_asset_type( - origin: T::Origin, + origin: T::RuntimeOrigin, ty: Vec, ) -> Result { let did = Identity::::ensure_perms(origin)?; @@ -2622,7 +2626,7 @@ impl Module { } fn base_update_asset_type( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, asset_type: AssetType, ) -> DispatchResult { @@ -2650,7 +2654,7 @@ impl Module { } fn base_remove_local_metadata_key( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, local_key: AssetMetadataLocalKey, ) -> DispatchResult { @@ -2685,7 +2689,7 @@ impl Module { } fn base_remove_metadata_value( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, metadata_key: AssetMetadataKey, ) -> DispatchResult { diff --git a/pallets/balances/Cargo.toml b/pallets/balances/Cargo.toml index db9c7aa858..0d6639e0e4 100644 --- a/pallets/balances/Cargo.toml +++ b/pallets/balances/Cargo.toml @@ -16,10 +16,10 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false} codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } @@ -28,7 +28,7 @@ frame-support = { version = "4.0.0-dev", default-features = false } pallet-timestamp = { version = "4.0.0-dev", default-features = false } # Only for test in STD -substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2", optional = true} +substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12", optional = true} # Benchmarking frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } diff --git a/pallets/balances/src/lib.rs b/pallets/balances/src/lib.rs index 6669f04b60..66297d5714 100644 --- a/pallets/balances/src/lib.rs +++ b/pallets/balances/src/lib.rs @@ -169,8 +169,9 @@ use frame_support::traits::Get; use frame_support::{ decl_error, decl_module, decl_storage, ensure, traits::{ - BalanceStatus as Status, Currency, ExistenceRequirement, Imbalance, LockIdentifier, - LockableCurrency, ReservableCurrency, SignedImbalance, StoredMap, WithdrawReasons, + tokens::{fungible, BalanceStatus as Status, DepositConsequence, WithdrawConsequence}, + Currency, ExistenceRequirement, Imbalance, LockIdentifier, LockableCurrency, + ReservableCurrency, SignedImbalance, StoredMap, WithdrawReasons, }, StorageValue, }; @@ -254,7 +255,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; // Polymesh modified code. Existential Deposit requirements are zero in Polymesh. @@ -441,7 +442,7 @@ impl Module { pub fn block_rewards_reserve() -> T::AccountId { SystematicIssuers::BlockRewardReserve .as_pallet_id() - .into_account() + .into_account_truncating() } /// Get both the free and reserved balances of an account. @@ -460,6 +461,83 @@ impl Module { Some(new) } + fn deposit_consequence( + _who: &T::AccountId, + amount: Balance, + account: &AccountData, + mint: bool, + ) -> DepositConsequence { + if amount.is_zero() { + return DepositConsequence::Success; + } + + if mint && TotalIssuance::get().checked_add(amount).is_none() { + return DepositConsequence::Overflow; + } + + let new_total_balance = match account.total().checked_add(amount) { + Some(x) => x, + None => return DepositConsequence::Overflow, + }; + + if new_total_balance < T::ExistentialDeposit::get() { + return DepositConsequence::BelowMinimum; + } + + // NOTE: We assume that we are a provider, so don't need to do any checks in the + // case of account creation. + + DepositConsequence::Success + } + + fn withdraw_consequence( + who: &T::AccountId, + amount: Balance, + account: &AccountData, + ) -> WithdrawConsequence { + if amount.is_zero() { + return WithdrawConsequence::Success; + } + + if TotalIssuance::get().checked_sub(amount).is_none() { + return WithdrawConsequence::Underflow; + } + + let new_total_balance = match account.total().checked_sub(amount) { + Some(x) => x, + None => return WithdrawConsequence::NoFunds, + }; + + // Provider restriction - total account balance cannot be reduced to zero if it cannot + // sustain the loss of a provider reference. + // NOTE: This assumes that the pallet is a provider (which is true). Is this ever changes, + // then this will need to adapt accordingly. + let ed = T::ExistentialDeposit::get(); + let success = if new_total_balance < ed { + if frame_system::Pallet::::can_dec_provider(who) { + WithdrawConsequence::ReducedToZero(new_total_balance) + } else { + return WithdrawConsequence::WouldDie; + } + } else { + WithdrawConsequence::Success + }; + + // Enough free funds to have them be reduced. + let new_free_balance = match account.free.checked_sub(amount) { + Some(b) => b, + None => return WithdrawConsequence::NoFunds, + }; + + // Eventual free funds must be no less than the frozen balance. + let min_balance = account.frozen(Reasons::All); + if new_free_balance < min_balance { + return WithdrawConsequence::Frozen; + } + + success + } + /// Mutate an account to some new value, or delete it entirely with `None`. /// /// NOTE: Doesn't do any preparatory work for creating a new account, so should only be used @@ -808,6 +886,9 @@ impl Currency for Module { if value.is_zero() { return (NegativeImbalance::zero(), Zero::zero()); } + if Self::total_balance(who).is_zero() { + return (NegativeImbalance::zero(), value); + } Self::mutate_account(who, |account| { let free_slash = cmp::min(account.free, value); @@ -980,10 +1061,15 @@ impl ReservableCurrency for Module { /// Unreserve some funds, returning any amount that was unable to be unreserved. /// /// Is a no-op if the value to be unreserved is zero. + /// + /// NOTE: returns amount value which wasn't successfully unreserved. fn unreserve(who: &T::AccountId, value: Self::Balance) -> Self::Balance { if value.is_zero() { return Zero::zero(); } + if Self::total_balance(who).is_zero() { + return value; + } let actual = Self::mutate_account(who, |account| { let actual = cmp::min(account.reserved, value); @@ -1009,6 +1095,9 @@ impl ReservableCurrency for Module { if value.is_zero() { return (NegativeImbalance::zero(), Zero::zero()); } + if Self::total_balance(who).is_zero() { + return (NegativeImbalance::zero(), value); + } Self::mutate_account(who, |account| { // underflow should never happen, but it if does, there's nothing to be done here. @@ -1023,6 +1112,8 @@ impl ReservableCurrency for Module { /// Is a no-op if: /// - the value to be moved is zero; or /// - the `slashed` id equal to `beneficiary` and the `status` is `Reserved`. + /// + /// NOTE: returns actual amount of transferred value in `Ok` case. fn repatriate_reserved( slashed: &T::AccountId, beneficiary: &T::AccountId, @@ -1035,7 +1126,7 @@ impl ReservableCurrency for Module { if slashed == beneficiary { return match status { - Status::Free => Ok(Self::unreserve(slashed, value)), + Status::Free => Ok(value.saturating_sub(Self::unreserve(slashed, value))), Status::Reserved => Ok(value.saturating_sub(Self::reserved_balance(slashed))), }; } @@ -1194,3 +1285,40 @@ impl LockableCurrencyExt for Module { Ok(()) } } + +impl fungible::Inspect for Module { + type Balance = Balance; + + fn total_issuance() -> Self::Balance { + TotalIssuance::get() + } + fn minimum_balance() -> Self::Balance { + T::ExistentialDeposit::get() + } + fn balance(who: &T::AccountId) -> Self::Balance { + Self::account(who).total() + } + fn reducible_balance(who: &T::AccountId, keep_alive: bool) -> Self::Balance { + let a = Self::account(who); + // Liquid balance is what is neither reserved nor locked/frozen. + let liquid = a.free.saturating_sub(a.fee_frozen.max(a.misc_frozen)); + if frame_system::Pallet::::can_dec_provider(who) && !keep_alive { + liquid + } else { + // `must_remain_to_exist` is the part of liquid balance which must remain to keep total + // over ED. + let must_remain_to_exist = + T::ExistentialDeposit::get().saturating_sub(a.total() - liquid); + liquid.saturating_sub(must_remain_to_exist) + } + } + fn can_deposit(who: &T::AccountId, amount: Self::Balance, mint: bool) -> DepositConsequence { + Self::deposit_consequence(who, amount, &Self::account(who), mint) + } + fn can_withdraw( + who: &T::AccountId, + amount: Self::Balance, + ) -> WithdrawConsequence { + Self::withdraw_consequence(who, amount, &Self::account(who)) + } +} diff --git a/pallets/base/Cargo.toml b/pallets/base/Cargo.toml index b0136ee102..f00741fefc 100644 --- a/pallets/base/Cargo.toml +++ b/pallets/base/Cargo.toml @@ -15,14 +15,14 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } -sp-std = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } -sp-io = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } -sp-runtime = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } -sp-version = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } -sp-api = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } -frame-system = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } -frame-support = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-05-2" } +sp-core = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } +sp-std = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } +sp-io = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } +sp-runtime = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } +sp-version = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } +sp-api = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } +frame-system = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } +frame-support = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-12" } [features] default = ["std"] diff --git a/pallets/base/src/lib.rs b/pallets/base/src/lib.rs index 80ab77dd4f..fc7edd3be5 100644 --- a/pallets/base/src/lib.rs +++ b/pallets/base/src/lib.rs @@ -31,10 +31,10 @@ use frame_support::traits::{Get, StorageInfo, StorageInfoTrait}; use frame_support::{decl_error, decl_module, ensure}; pub use polymesh_common_utilities::traits::base::{Config, Event}; use polymesh_primitives::checked_inc::CheckedInc; -use sp_std::vec::Vec; +use sp_std::{vec, vec::Vec}; decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; const MaxLen: u32 = T::MaxLen::get(); diff --git a/pallets/bridge/Cargo.toml b/pallets/bridge/Cargo.toml index 3bc9d171af..8697523bbf 100644 --- a/pallets/bridge/Cargo.toml +++ b/pallets/bridge/Cargo.toml @@ -16,9 +16,9 @@ pallet-multisig = { path = "../multisig", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } pallet-scheduler = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/bridge/src/lib.rs b/pallets/bridge/src/lib.rs index 0c65c48695..18f9211103 100644 --- a/pallets/bridge/src/lib.rs +++ b/pallets/bridge/src/lib.rs @@ -105,14 +105,13 @@ mod genesis; use codec::{Decode, Encode}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, - dispatch::{DispatchError, DispatchResult}, + dispatch::{DispatchClass, DispatchError, DispatchResult, Pays}, ensure, fail, storage::StorageDoubleMap, traits::{ schedule::{Anon as ScheduleAnon, DispatchTime, LOWEST_PRIORITY}, Currency, }, - weights::{DispatchClass, Pays}, }; use frame_system::{ensure_root, ensure_signed, RawOrigin}; use pallet_balances as balances; @@ -134,7 +133,7 @@ type Identity = pallet_identity::Module; type System = frame_system::Pallet; pub trait Config: multisig::Config + BalancesConfig + pallet_base::Config { - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; type Proposal: From> + Into<::Proposal>; /// Scheduler of timelocked bridge transactions. type Scheduler: ScheduleAnon< @@ -351,7 +350,7 @@ decl_event! { } decl_module! { - pub struct Module for enum Call where origin: ::Origin { + pub struct Module for enum Call where origin: ::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -569,18 +568,18 @@ impl Module { Self::controller() } - fn ensure_admin_did(origin: T::Origin) -> Result { + fn ensure_admin_did(origin: T::RuntimeOrigin) -> Result { let sender = Self::ensure_admin(origin)?; Context::current_identity_or::>(&sender) } - fn ensure_admin(origin: T::Origin) -> Result { + fn ensure_admin(origin: T::RuntimeOrigin) -> Result { let sender = ensure_signed(origin)?; ensure!(sender == Self::admin(), Error::::BadAdmin); Ok(sender) } - fn ensure_freeze_admin_did(origin: T::Origin) -> Result { + fn ensure_freeze_admin_did(origin: T::RuntimeOrigin) -> Result { let sender = ensure_signed(origin)?; if !>::get(&sender) { // Not a freeze admin, check if they are the main admin. @@ -747,7 +746,7 @@ impl Module { /// Proposes a vector of bridge transaction. The bridge controller must be set. fn base_batch_propose_bridge_tx( - origin: T::Origin, + origin: T::RuntimeOrigin, bridge_txs: Vec>, send_event: bool, ) -> DispatchResult { @@ -775,7 +774,7 @@ impl Module { /// Handles an approved bridge transaction proposal. fn base_handle_bridge_tx( - origin: T::Origin, + origin: T::RuntimeOrigin, bridge_tx: BridgeTx, ) -> DispatchResult { let sender = ensure_signed(origin)?; @@ -820,7 +819,7 @@ impl Module { /// Forces handling a transaction by bypassing the bridge limit and timelock. fn base_force_handle_bridge_tx( - origin: T::Origin, + origin: T::RuntimeOrigin, bridge_tx: BridgeTx, ) -> DispatchResult { Self::ensure_admin(origin)?; @@ -871,7 +870,7 @@ impl Module { } fn base_handle_scheduled_bridge_tx( - origin: T::Origin, + origin: T::RuntimeOrigin, bridge_tx: BridgeTx, ) -> DispatchResult { ensure_root(origin)?; @@ -879,42 +878,51 @@ impl Module { Self::handle_bridge_tx_now(bridge_tx, tx_details, false, None) } - fn base_change_controller(origin: T::Origin, controller: T::AccountId) -> DispatchResult { + fn base_change_controller( + origin: T::RuntimeOrigin, + controller: T::AccountId, + ) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; >::put(controller.clone()); Self::deposit_event(RawEvent::ControllerChanged(did, controller)); Ok(()) } - fn base_change_admin(origin: T::Origin, admin: T::AccountId) -> DispatchResult { + fn base_change_admin(origin: T::RuntimeOrigin, admin: T::AccountId) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; >::put(admin.clone()); Self::deposit_event(RawEvent::AdminChanged(did, admin)); Ok(()) } - fn base_change_timelock(origin: T::Origin, timelock: T::BlockNumber) -> DispatchResult { + fn base_change_timelock(origin: T::RuntimeOrigin, timelock: T::BlockNumber) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; >::put(timelock); Self::deposit_event(RawEvent::TimelockChanged(did, timelock)); Ok(()) } - fn base_add_freeze_admin(origin: T::Origin, freeze_admin: T::AccountId) -> DispatchResult { + fn base_add_freeze_admin( + origin: T::RuntimeOrigin, + freeze_admin: T::AccountId, + ) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; >::insert(freeze_admin.clone(), true); Self::deposit_event(RawEvent::FreezeAdminAdded(did, freeze_admin)); Ok(()) } - fn base_remove_freeze_admin(origin: T::Origin, freeze_admin: T::AccountId) -> DispatchResult { + fn base_remove_freeze_admin( + origin: T::RuntimeOrigin, + freeze_admin: T::AccountId, + ) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; >::remove(freeze_admin.clone()); Self::deposit_event(RawEvent::FreezeAdminRemoved(did, freeze_admin)); Ok(()) } - fn set_freeze(origin: T::Origin, freeze: bool) -> DispatchResult { + fn set_freeze(origin: T::RuntimeOrigin, freeze: bool) -> DispatchResult { let did = if freeze { Self::ensure_freeze_admin_did(origin)? } else { @@ -934,7 +942,7 @@ impl Module { } fn base_change_bridge_limit( - origin: T::Origin, + origin: T::RuntimeOrigin, amount: Balance, duration: T::BlockNumber, ) -> DispatchResult { @@ -948,7 +956,7 @@ impl Module { } fn base_change_bridge_exempted( - origin: T::Origin, + origin: T::RuntimeOrigin, exempted: Vec<(IdentityId, bool)>, ) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; @@ -960,7 +968,7 @@ impl Module { } fn base_freeze_txs( - origin: T::Origin, + origin: T::RuntimeOrigin, bridge_txs: Vec>, ) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; @@ -983,7 +991,7 @@ impl Module { } fn base_unfreeze_txs( - origin: T::Origin, + origin: T::RuntimeOrigin, bridge_txs: Vec>, ) -> DispatchResult { // NB: An admin can call Freeze + Unfreeze on a transaction to bypass the timelock. @@ -1013,7 +1021,7 @@ impl Module { } fn base_remove_txs( - origin: T::Origin, + origin: T::RuntimeOrigin, bridge_txs: Vec>, ) -> DispatchResult { let did = Self::ensure_admin_did(origin)?; diff --git a/pallets/committee/Cargo.toml b/pallets/committee/Cargo.toml index fdd971a421..369c64ba92 100644 --- a/pallets/committee/Cargo.toml +++ b/pallets/committee/Cargo.toml @@ -17,10 +17,10 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/committee/src/benchmarking.rs b/pallets/committee/src/benchmarking.rs index 56bb164956..95d88fae59 100644 --- a/pallets/committee/src/benchmarking.rs +++ b/pallets/committee/src/benchmarking.rs @@ -54,7 +54,7 @@ fn make_proposals_and_vote(users: &[User]) -> DispatchResult where I: Instance, T: Config, - >::Origin: From>, + >::RuntimeOrigin: From>, { assert!( users.len() > 0, @@ -88,7 +88,7 @@ fn make_members_and_proposals() -> Result>, DispatchError> where I: Instance, T: Config + TestUtilsFn>, - >::Origin: From>, + >::RuntimeOrigin: From>, { let members: Vec<_> = (0..COMMITTEE_MEMBERS_MAX) .map(|i| user::("member", i)) @@ -131,7 +131,7 @@ benchmarks_instance! { where_clause { where T: TestUtilsFn>, - >::Origin: From>, + >::RuntimeOrigin: From>, } set_vote_threshold { diff --git a/pallets/committee/src/lib.rs b/pallets/committee/src/lib.rs index 5015cf24ef..783399d45f 100644 --- a/pallets/committee/src/lib.rs +++ b/pallets/committee/src/lib.rs @@ -61,12 +61,14 @@ pub mod benchmarking; use core::marker::PhantomData; use core::mem; use frame_support::{ - codec::{Decode, Encode}, + codec::{Decode, Encode, MaxEncodedLen}, decl_error, decl_event, decl_module, decl_storage, - dispatch::{DispatchError, DispatchResult, Dispatchable, Parameter, PostDispatchInfo}, + dispatch::{ + DispatchClass, DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, Parameter, + PostDispatchInfo, Weight, + }, ensure, traits::{ChangeMembers, EnsureOrigin, InitializeMembers}, - weights::{DispatchClass, GetDispatchInfo, Weight}, }; use pallet_identity as identity; use polymesh_common_utilities::{ @@ -101,29 +103,32 @@ pub type ProposalIndex = u32; /// The committee trait. pub trait Config: frame_system::Config + IdentityConfig { /// The outer origin type. - type Origin: From> + Into<::Origin>; + type RuntimeOrigin: From> + + Into<::RuntimeOrigin>; /// The outer call type. type Proposal: Parameter - + Dispatchable>::Origin, PostInfo = PostDispatchInfo> - + GetDispatchInfo + + Dispatchable< + RuntimeOrigin = >::RuntimeOrigin, + PostInfo = PostDispatchInfo, + > + GetDispatchInfo + From>; /// Required origin for changing behaviour of this module. - type CommitteeOrigin: EnsureOrigin<>::Origin>; + type CommitteeOrigin: EnsureOrigin<>::RuntimeOrigin>; /// Required origin for changing the voting threshold. - type VoteThresholdOrigin: EnsureOrigin<>::Origin>; + type VoteThresholdOrigin: EnsureOrigin<>::RuntimeOrigin>; /// The outer event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Weight computation. type WeightInfo: WeightInfo; } /// Origin for the committee module. -#[derive(PartialEq, Eq, Clone, Debug, Encode, Decode, TypeInfo)] +#[derive(PartialEq, Eq, Clone, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] pub enum RawOrigin { /// It has been condoned by M of N members of this committee /// with `M` and `N` set dynamically in `set_vote_threshold`. @@ -244,7 +249,7 @@ decl_error! { type Identity = identity::Module; decl_module! { - pub struct Module, I: Instance=DefaultInstance> for enum Call where origin: >::Origin { + pub struct Module, I: Instance=DefaultInstance> for enum Call where origin: >::RuntimeOrigin { type Error = Error; @@ -394,7 +399,9 @@ impl, I: Instance> Module { } /// Ensures that `origin` is a committee member, returning its identity, or throws `NotAMember`. - fn ensure_is_member(origin: >::Origin) -> Result { + fn ensure_is_member( + origin: >::RuntimeOrigin, + ) -> Result { let did = >::ensure_perms(origin.into())?; Self::ensure_did_is_member(&did)?; Ok(did) @@ -543,7 +550,7 @@ impl, I: Instance> Module { /// # Arguments /// * `proposal` - A dispatchable call. fn propose( - origin: >::Origin, + origin: >::RuntimeOrigin, proposal: >::Proposal, ) -> DispatchResult { // 1. Ensure `origin` is a committee member. diff --git a/pallets/common/Cargo.toml b/pallets/common/Cargo.toml index 95a7fd26eb..37927a8f7d 100644 --- a/pallets/common/Cargo.toml +++ b/pallets/common/Cargo.toml @@ -20,11 +20,11 @@ pallet-session = { version = "4.0.0-dev", default-features = false } pallet-timestamp = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false } -sp-arithmetic = { version = "5.0.0", default-features = false } -sp-core = { version = "6.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # Benchmarks frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } @@ -32,7 +32,7 @@ schnorrkel = { version = "0.10.1", default-features = false, optional = true } [dev-dependencies] lazy_static = { version = "1.4.0", default-features = false } -substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2" } +substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12" } [features] default = ["std", "equalize"] diff --git a/pallets/common/src/benchs/asset.rs b/pallets/common/src/benchs/asset.rs index 87b600242b..6775c0d911 100644 --- a/pallets/common/src/benchs/asset.rs +++ b/pallets/common/src/benchs/asset.rs @@ -12,7 +12,7 @@ use sp_std::vec; pub type ResultTicker = Result; /// Create a ticker and register it. -pub fn make_ticker(owner: T::Origin, opt_name: Option<&[u8]>) -> Ticker { +pub fn make_ticker(owner: T::RuntimeOrigin, opt_name: Option<&[u8]>) -> Ticker { let ticker = match opt_name { Some(name) => Ticker::from_slice_truncated(name), _ => Ticker::repeating(b'A'), diff --git a/pallets/common/src/traits/asset.rs b/pallets/common/src/traits/asset.rs index 0629419b56..0a1969fc7c 100644 --- a/pallets/common/src/traits/asset.rs +++ b/pallets/common/src/traits/asset.rs @@ -130,9 +130,9 @@ pub trait Config: + portfolio::Config { /// The overarching event type. - type Event: From> + type RuntimeEvent: From> + From - + Into<::Event>; + + Into<::RuntimeEvent>; type Currency: Currency; @@ -156,12 +156,12 @@ pub trait Config: /// Max length for the Asset Metadata type definition. type AssetMetadataTypeDefMaxLength: Get; - type AssetFn: AssetFnTrait; + type AssetFn: AssetFnTrait; type WeightInfo: WeightInfo; type CPWeightInfo: crate::traits::checkpoint::WeightInfo; - type NFTFn: NFTTrait; + type NFTFn: NFTTrait; } decl_event! { diff --git a/pallets/common/src/traits/balances.rs b/pallets/common/src/traits/balances.rs index 185996147f..ed2600f577 100644 --- a/pallets/common/src/traits/balances.rs +++ b/pallets/common/src/traits/balances.rs @@ -14,7 +14,7 @@ // along with this program. If not, see . use crate::traits::{identity::Config as IdentityConfig, NegativeImbalance}; -use codec::{Decode, Encode}; +use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ decl_event, dispatch::{DispatchError, DispatchResult}, @@ -36,7 +36,17 @@ pub struct Memo(pub [u8; 32]); // POLYMESH-NOTE: Make `AccountData` public to access it from the outside module. /// All balance information for an account. -#[derive(Encode, Decode, TypeInfo, Clone, PartialEq, Eq, Default, RuntimeDebug)] +#[derive( + Encode, + Decode, + Clone, + PartialEq, + Eq, + Default, + RuntimeDebug, + MaxEncodedLen, + TypeInfo +)] pub struct AccountData { /// Non-reserved part of the balance. There may still be restrictions on this, but it is the /// total pool what may in principle be transferred, reserved and used for tipping. @@ -154,7 +164,7 @@ pub trait Config: IdentityConfig { type DustRemoval: OnUnbalanced>; /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// This type is no longer needed but kept for compatibility reasons. /// The minimum amount required to keep an account open. diff --git a/pallets/common/src/traits/external_agents.rs b/pallets/common/src/traits/external_agents.rs index 1294bea73d..6c2389e25d 100644 --- a/pallets/common/src/traits/external_agents.rs +++ b/pallets/common/src/traits/external_agents.rs @@ -16,7 +16,7 @@ pub trait WeightInfo { pub trait Config: frame_system::Config + crate::balances::Config { /// The overarching event type. - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; type WeightInfo: WeightInfo; } diff --git a/pallets/common/src/traits/group.rs b/pallets/common/src/traits/group.rs index a48ff9a6d3..34c7da0bb1 100644 --- a/pallets/common/src/traits/group.rs +++ b/pallets/common/src/traits/group.rs @@ -93,24 +93,24 @@ pub trait WeightInfo { pub trait Config: frame_system::Config + pallet_timestamp::Config + IdentityConfig { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Required origin for changing the active limit. /// It's recommended that e.g., in case of a committee, /// this be an origin that cannot be formed through a committee majority. - type LimitOrigin: EnsureOrigin<::Origin>; + type LimitOrigin: EnsureOrigin<::RuntimeOrigin>; /// Required origin for adding a member (though can always be Root). - type AddOrigin: EnsureOrigin<::Origin>; + type AddOrigin: EnsureOrigin<::RuntimeOrigin>; /// Required origin for removing a member (though can always be Root). - type RemoveOrigin: EnsureOrigin<::Origin>; + type RemoveOrigin: EnsureOrigin<::RuntimeOrigin>; /// Required origin for adding and removing a member in a single action. - type SwapOrigin: EnsureOrigin<::Origin>; + type SwapOrigin: EnsureOrigin<::RuntimeOrigin>; /// Required origin for resetting membership. - type ResetOrigin: EnsureOrigin<::Origin>; + type ResetOrigin: EnsureOrigin<::RuntimeOrigin>; /// The receiver of the signal for when the membership has been initialized. This happens pre- /// genesis and will usually be the same as `MembershipChanged`. If you need to do something @@ -127,7 +127,7 @@ pub trait Config: frame_system::Config + pallet_timestamp::Config + IdentityC decl_event!( pub enum Event where ::AccountId, - >::Event, + >::RuntimeEvent, { /// The given member was added; see the transaction for who. /// caller DID, New member DID. @@ -147,7 +147,7 @@ decl_event!( /// The limit of how many active members there can be concurrently was changed. ActiveLimitChanged(IdentityId, MemberCount, MemberCount), /// Phantom member, never used. - Dummy(sp_std::marker::PhantomData<(AccountId, Event)>), + Dummy(sp_std::marker::PhantomData<(AccountId, RuntimeEvent)>), } ); diff --git a/pallets/common/src/traits/identity.rs b/pallets/common/src/traits/identity.rs index 9a069cf599..5920614224 100644 --- a/pallets/common/src/traits/identity.rs +++ b/pallets/common/src/traits/identity.rs @@ -27,9 +27,8 @@ use crate::{ use codec::{Decode, Encode}; use frame_support::{ decl_event, - dispatch::PostDispatchInfo, + dispatch::{GetDispatchInfo, PostDispatchInfo, Weight}, traits::{Currency, EnsureOrigin, Get, GetCallMetadata}, - weights::{GetDispatchInfo, Weight}, Parameter, }; use polymesh_primitives::{ @@ -174,7 +173,7 @@ pub trait WeightInfo { fn add_authorization_full(data: &AuthorizationData) -> Weight { let perm_cost = match data { AuthorizationData::JoinIdentity(perms) => Self::permissions_cost_perms(perms), - _ => 0, + _ => Weight::zero(), }; perm_cost.saturating_add(Self::add_authorization()) } @@ -188,11 +187,13 @@ pub trait WeightInfo { /// The module's configuration trait. pub trait Config: CommonConfig + pallet_timestamp::Config + crate::traits::base::Config { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// An extrinsic call. type Proposal: Parameter - + Dispatchable::Origin, PostInfo = PostDispatchInfo> - + GetCallMetadata + + Dispatchable< + RuntimeOrigin = ::RuntimeOrigin, + PostInfo = PostDispatchInfo, + > + GetCallMetadata + GetDispatchInfo + From>; /// MultiSig module @@ -206,14 +207,14 @@ pub trait Config: CommonConfig + pallet_timestamp::Config + crate::traits::base: /// Charges fee for forwarded call type ChargeTxFeeTarget: ChargeTxFee; /// Used to check and update CDD - type CddHandler: CddAndFeeDetails::Call>; + type CddHandler: CddAndFeeDetails::RuntimeCall>; type Public: IdentifyAccount; type OffChainSignature: Verify + Member + Decode + Encode + TypeInfo; type ProtocolFee: ChargeProtocolFee; /// Origin for Governance Committee voting majority origin. - type GCVotingMajorityOrigin: EnsureOrigin; + type GCVotingMajorityOrigin: EnsureOrigin; /// Weight information for extrinsics in the identity pallet. type WeightInfo: WeightInfo; diff --git a/pallets/common/src/traits/mod.rs b/pallets/common/src/traits/mod.rs index bcc8512727..381b1a206a 100644 --- a/pallets/common/src/traits/mod.rs +++ b/pallets/common/src/traits/mod.rs @@ -68,7 +68,7 @@ pub mod base { pub trait Config: frame_system::Config { /// The overarching event type. - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; /// The maximum length governing `TooLong`. /// diff --git a/pallets/common/src/traits/nft.rs b/pallets/common/src/traits/nft.rs index 642960787a..5ff48166b1 100644 --- a/pallets/common/src/traits/nft.rs +++ b/pallets/common/src/traits/nft.rs @@ -19,7 +19,7 @@ use crate::{asset, base, identity, portfolio}; pub trait Config: frame_system::Config + base::Config + asset::Config + identity::Config + portfolio::Config { - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; type WeightInfo: WeightInfo; diff --git a/pallets/common/src/traits/portfolio.rs b/pallets/common/src/traits/portfolio.rs index 88e3e7e0de..9cbbcaaec8 100644 --- a/pallets/common/src/traits/portfolio.rs +++ b/pallets/common/src/traits/portfolio.rs @@ -99,9 +99,9 @@ pub trait WeightInfo { } pub trait Config: CommonConfig + identity::Config + base::Config { - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; /// Asset module. - type Asset: AssetFnTrait; + type Asset: AssetFnTrait; type WeightInfo: WeightInfo; /// Maximum number of fungible assets that can be moved in a single transfer call. type MaxNumberOfFungibleMoves: Get; diff --git a/pallets/common/src/traits/relayer.rs b/pallets/common/src/traits/relayer.rs index bfd0fad3a9..2288a22ebc 100644 --- a/pallets/common/src/traits/relayer.rs +++ b/pallets/common/src/traits/relayer.rs @@ -28,7 +28,7 @@ pub trait SubsidiserTrait { pub trait Config: CommonConfig + identity::Config { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; type WeightInfo: WeightInfo; } diff --git a/pallets/common/src/traits/statistics.rs b/pallets/common/src/traits/statistics.rs index 9c90d96911..44b9ec6cdb 100644 --- a/pallets/common/src/traits/statistics.rs +++ b/pallets/common/src/traits/statistics.rs @@ -14,9 +14,9 @@ pub trait Config: frame_system::Config + crate::traits::identity::Config + crate::traits::external_agents::Config { /// The overarching event type. - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; /// Asset module. - type Asset: AssetFnTrait; + type Asset: AssetFnTrait; /// Maximum stats that can be enabled for an Asset. type MaxStatsPerAsset: Get; /// Maximum transfer conditions that can be enabled for an Asset. diff --git a/pallets/common/src/traits/transaction_payment.rs b/pallets/common/src/traits/transaction_payment.rs index f8c81f3edd..7585f0253a 100644 --- a/pallets/common/src/traits/transaction_payment.rs +++ b/pallets/common/src/traits/transaction_payment.rs @@ -1,6 +1,6 @@ use polymesh_primitives::IdentityId; -use frame_support::weights::DispatchInfo; +use frame_support::dispatch::DispatchInfo; use sp_runtime::transaction_validity::{InvalidTransaction, TransactionValidity}; // Polymesh note: This was specifically added for Polymesh diff --git a/pallets/compliance-manager/Cargo.toml b/pallets/compliance-manager/Cargo.toml index 4b8d3e167d..ec3d02c06b 100644 --- a/pallets/compliance-manager/Cargo.toml +++ b/pallets/compliance-manager/Cargo.toml @@ -26,10 +26,10 @@ either = { version = "1.6.1", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/compliance-manager/src/lib.rs b/pallets/compliance-manager/src/lib.rs index 8a10296c5a..093af14f3a 100644 --- a/pallets/compliance-manager/src/lib.rs +++ b/pallets/compliance-manager/src/lib.rs @@ -112,10 +112,10 @@ pub trait Config: pallet_timestamp::Config + frame_system::Config + BalancesConfig + IdentityConfig + EAConfig { /// The overarching event type. - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; /// Asset module - type Asset: AssetFnTrait; + type Asset: AssetFnTrait; /// Weight details of all extrinsic type WeightInfo: WeightInfo; @@ -128,11 +128,11 @@ pub mod weight_for { use super::*; pub fn weight_for_verify_restriction(no_of_compliance_requirements: u64) -> Weight { - no_of_compliance_requirements * 100_000_000 + no_of_compliance_requirements * Weight::from_ref_time(100_000_000) } pub fn weight_for_reading_asset_compliance() -> Weight { - T::DbWeight::get().reads(1) + 1_000_000 + T::DbWeight::get().reads(1) + Weight::from_ref_time(1_000_000) } } @@ -168,7 +168,7 @@ decl_error! { decl_module! { /// The module declaration. - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -554,7 +554,7 @@ impl Module { /// Pauses or resumes the asset compliance. fn pause_resume_asset_compliance( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, pause: bool, ) -> Result { diff --git a/pallets/contracts/Cargo.toml b/pallets/contracts/Cargo.toml index 02e091886d..a1a27a9c8a 100644 --- a/pallets/contracts/Cargo.toml +++ b/pallets/contracts/Cargo.toml @@ -7,17 +7,17 @@ edition = "2021" [dependencies] serde = { version = "1.0.104", default-features = false } -pwasm-utils = { version = "0.18.2", optional = true, default-features = false } +wasm-instrument = { version = "0.3", default-features = false, optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } frame-system = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } pallet-contracts = { version = "4.0.0-dev", default-features = false } -pallet-contracts-primitives = { version = "6.0.0", default-features = false } +pallet-contracts-primitives = { version = "7.0.0", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # Polymesh specific pallet-base = { path = "../base", default-features = false } @@ -44,10 +44,10 @@ std = [ "pallet-contracts/std", "polymesh-primitives/std", "polymesh-common-utilities/std", - "pwasm-utils?/std", + "wasm-instrument?/std", ] runtime-benchmarks = [ - "pwasm-utils", + "wasm-instrument", "frame-benchmarking", "pallet-contracts/runtime-benchmarks", ] diff --git a/pallets/contracts/src/benchmarking.rs b/pallets/contracts/src/benchmarking.rs index 249ef2bbfc..eaeb0f9ff2 100644 --- a/pallets/contracts/src/benchmarking.rs +++ b/pallets/contracts/src/benchmarking.rs @@ -31,10 +31,10 @@ use polymesh_common_utilities::{ TestUtilsFn, }; use polymesh_primitives::{Balance, Permissions}; -use pwasm_utils::parity_wasm::elements::{Instruction, ValueType}; use sp_runtime::traits::StaticLookup; use sp_runtime::Perbill; use sp_std::prelude::*; +use wasm_instrument::parity_wasm::elements::{Instruction, ValueType}; pub(crate) const SEED: u32 = 0; @@ -348,7 +348,7 @@ benchmarks! { // We cannot let `c` grow to the maximum code size because the code is not allowed // to be larger than the maximum size **after instrumentation**. instantiate_with_code_perms { - let c in 0 .. Perbill::from_percent(50).mul_ceil(T::Schedule::get().limits.code_len); + let c in 0 .. Perbill::from_percent(49).mul_ceil(T::MaxCodeLen::get()); let s in 0 .. max_pages::() * 64 * 1024; let salt = vec![42u8; s as usize]; diff --git a/pallets/contracts/src/chain_extension.rs b/pallets/contracts/src/chain_extension.rs index 3535cc334c..cb561ad049 100644 --- a/pallets/contracts/src/chain_extension.rs +++ b/pallets/contracts/src/chain_extension.rs @@ -406,7 +406,7 @@ fn call_runtime( old_call: Option, ) -> ce::Result where - ::Call: GetDispatchInfo + GetCallMetadata, + ::RuntimeCall: GetDispatchInfo + GetCallMetadata, T: Config, T::AccountId: UncheckedFrom + AsRef<[u8]>, E: ce::Ext, @@ -433,7 +433,7 @@ where ExtrinsicId::try_from(input.as_slice()).ok_or(Error::::InvalidRuntimeCall)?; // Check if the extrinsic is allowed to be called. Module::::ensure_call_runtime(ext_id)?; - <::Call>::decode_all_with_depth_limit( + <::RuntimeCall>::decode_all_with_depth_limit( MAX_DECODE_DEPTH, &mut input.as_slice(), ) @@ -446,9 +446,11 @@ where let extrinsic: [u8; 2] = ext_id.into(); let params = env.read(in_len)?; let mut input = ChainInput::new(&extrinsic, params.as_slice()); - let call = - <::Call>::decode_with_depth_limit(MAX_DECODE_DEPTH, &mut input) - .map_err(|_| Error::::InvalidRuntimeCall)?; + let call = <::RuntimeCall>::decode_with_depth_limit( + MAX_DECODE_DEPTH, + &mut input, + ) + .map_err(|_| Error::::InvalidRuntimeCall)?; ensure!(input.is_empty(), Error::::DataLeftAfterDecoding); call } @@ -483,11 +485,14 @@ where Ok(ce::RetVal::Converging(0)) } +#[derive(Clone, Copy, Default)] +pub struct PolymeshExtension; + /// A chain extension allowing calls to polymesh pallets /// and using the contract's DID instead of the caller's DID. -impl ce::ChainExtension for Module +impl ce::ChainExtension for PolymeshExtension where - ::Call: GetDispatchInfo + GetCallMetadata, + ::RuntimeCall: GetDispatchInfo + GetCallMetadata, T: Config, T::AccountId: UncheckedFrom + AsRef<[u8]>, { @@ -496,9 +501,10 @@ where } fn call>( - ext_id: u32, + &mut self, env: ce::Environment, ) -> ce::Result { + let ext_id = ((env.ext_id() as u32) << 16) + env.func_id() as u32; // Decode chain extension id. let func_id = FuncId::try_from(ext_id); diff --git a/pallets/contracts/src/lib.rs b/pallets/contracts/src/lib.rs index 29e6faf14c..299e75272d 100644 --- a/pallets/contracts/src/lib.rs +++ b/pallets/contracts/src/lib.rs @@ -55,7 +55,7 @@ pub mod benchmarking; pub mod chain_extension; -pub use chain_extension::ExtrinsicId; +pub use chain_extension::{ExtrinsicId, PolymeshExtension}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, @@ -75,10 +75,9 @@ use polymesh_common_utilities::traits::identity::Config as IdentityConfig; use polymesh_common_utilities::with_transaction; use polymesh_primitives::{Balance, Permissions}; use sp_core::crypto::UncheckedFrom; -use sp_core::Bytes; use sp_runtime::traits::Hash; use sp_std::borrow::Cow; -use sp_std::vec::Vec; +use sp_std::{vec, vec::Vec}; type Identity = pallet_identity::Module; type IdentityError = pallet_identity::Error; @@ -130,7 +129,7 @@ macro_rules! cost { macro_rules! cost_batched { ($name:ident) => { - cost!($name) / Weight::from(CHAIN_EXTENSION_BATCH_SIZE) + cost!($name) / u64::from(CHAIN_EXTENSION_BATCH_SIZE) }; } @@ -193,19 +192,19 @@ pub trait WeightInfo { fn hash_twox_64(r: u32) -> Weight { let per_byte = cost_byte_batched!(chain_extension_hash_twox_64_per_kb); cost_batched!(chain_extension_hash_twox_64) - .saturating_add(per_byte.saturating_mul(r as Weight)) + .saturating_add(per_byte.saturating_mul(r as u64)) } fn hash_twox_128(r: u32) -> Weight { let per_byte = cost_byte_batched!(chain_extension_hash_twox_128_per_kb); cost_batched!(chain_extension_hash_twox_128) - .saturating_add(per_byte.saturating_mul(r as Weight)) + .saturating_add(per_byte.saturating_mul(r as u64)) } fn hash_twox_256(r: u32) -> Weight { let per_byte = cost_byte_batched!(chain_extension_hash_twox_256_per_kb); cost_batched!(chain_extension_hash_twox_256) - .saturating_add(per_byte.saturating_mul(r as Weight)) + .saturating_add(per_byte.saturating_mul(r as u64)) } fn call_runtime(in_len: u32) -> Weight { @@ -220,7 +219,7 @@ pub trait Config: IdentityConfig + BConfig + frame_system::Config { /// The overarching event type. - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; /// Max value that `in_len` can take, that is, /// the length of the data sent from a contract when using the ChainExtension. @@ -280,7 +279,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin, T::AccountId: UncheckedFrom, T::AccountId: AsRef<[u8]> { + pub struct Module for enum Call where origin: T::RuntimeOrigin, T::AccountId: UncheckedFrom, T::AccountId: AsRef<[u8]> { type Error = Error; fn deposit_event() = default; @@ -381,7 +380,7 @@ where { /// Instantiates a contract using `code` as the WASM code blob. fn base_update_call_runtime_whitelist( - origin: T::Origin, + origin: T::RuntimeOrigin, updates: Vec<(ExtrinsicId, bool)>, ) -> DispatchResult { ensure_root(origin)?; @@ -406,7 +405,7 @@ where /// Instantiates a contract using `code` as the WASM code blob. fn base_instantiate_with_code( - origin: T::Origin, + origin: T::RuntimeOrigin, endowment: Balance, gas_limit: Weight, storage_deposit_limit: Option, @@ -422,7 +421,7 @@ where Self::weight_instantiate_with_code(&code, &salt, &perms), gas_limit, storage_deposit_limit, - Code::Upload(Bytes(code)), + Code::Upload(code), inst_data, salt, perms, @@ -438,7 +437,7 @@ where /// Instantiates a contract using an existing WASM code blob with `code_hash` as its code. fn base_instantiate_with_hash( - origin: T::Origin, + origin: T::RuntimeOrigin, endowment: Balance, gas_limit: Weight, storage_deposit_limit: Option, @@ -476,7 +475,7 @@ where /// - `code` specifies the code for the contract, either as a code blob or an existing hash. /// The hash of `code` in either case is assumed to correspond to `code_hash`. fn general_instantiate( - origin: T::Origin, + origin: T::RuntimeOrigin, endowment: Balance, base_weight: Weight, gas_limit: Weight, diff --git a/pallets/corporate-actions/Cargo.toml b/pallets/corporate-actions/Cargo.toml index 9621e81da3..7d98b1d558 100644 --- a/pallets/corporate-actions/Cargo.toml +++ b/pallets/corporate-actions/Cargo.toml @@ -25,11 +25,11 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-arithmetic = { version = "5.0.0", default-features = false } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/corporate-actions/src/ballot/mod.rs b/pallets/corporate-actions/src/ballot/mod.rs index af2daafc41..bca386647f 100644 --- a/pallets/corporate-actions/src/ballot/mod.rs +++ b/pallets/corporate-actions/src/ballot/mod.rs @@ -297,7 +297,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; diff --git a/pallets/corporate-actions/src/benchmarking.rs b/pallets/corporate-actions/src/benchmarking.rs index 83dfc00188..9b7ee7ca87 100644 --- a/pallets/corporate-actions/src/benchmarking.rs +++ b/pallets/corporate-actions/src/benchmarking.rs @@ -86,7 +86,7 @@ fn details(len: u32) -> CADetails { .into() } -fn add_docs(origin: &T::Origin, ticker: Ticker, n: u32) -> Vec { +fn add_docs(origin: &T::RuntimeOrigin, ticker: Ticker, n: u32) -> Vec { let ids = (0..n).map(DocumentId).collect::>(); let docs = (0..n).map(|_| make_document()).collect::>(); >::add_documents(origin.clone(), docs, ticker).unwrap(); @@ -98,7 +98,7 @@ pub(crate) fn setup_ca>>(kind: CAKind) -> >::set(1000u32.into()); - let origin: T::Origin = owner.origin().into(); + let origin: T::RuntimeOrigin = owner.origin().into(); >::initiate_corporate_action( origin.clone(), ticker, @@ -276,7 +276,7 @@ benchmarks! { let d in 0..MAX_DOCS; let (owner, ticker) = setup::(); - let origin: T::Origin = owner.origin().into(); + let origin: T::RuntimeOrigin = owner.origin().into(); let ids = add_docs::(&origin, ticker, d); let ids2 = ids.clone(); >::initiate_corporate_action( diff --git a/pallets/corporate-actions/src/distribution/benchmarking.rs b/pallets/corporate-actions/src/distribution/benchmarking.rs index 86602b5382..47e5e2e7da 100644 --- a/pallets/corporate-actions/src/distribution/benchmarking.rs +++ b/pallets/corporate-actions/src/distribution/benchmarking.rs @@ -30,7 +30,7 @@ const MAX_DID_WHT_IDS: u32 = 1000; fn portfolio(owner: &User, pnum: PortfolioNumber, ticker: Ticker, amount: Balance) { let did = owner.did(); - let origin: T::Origin = owner.origin().into(); + let origin: T::RuntimeOrigin = owner.origin().into(); >::create_portfolio(origin.clone(), "portfolio".into()).unwrap(); >::move_portfolio_funds( origin, diff --git a/pallets/corporate-actions/src/distribution/mod.rs b/pallets/corporate-actions/src/distribution/mod.rs index cdf592ecbc..fe1bd01352 100644 --- a/pallets/corporate-actions/src/distribution/mod.rs +++ b/pallets/corporate-actions/src/distribution/mod.rs @@ -161,7 +161,7 @@ decl_storage! { storage_migration_ver!(0); decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -386,7 +386,7 @@ decl_error! { impl Module { fn base_distribute( - origin: T::Origin, + origin: T::RuntimeOrigin, ca_id: CAId, portfolio: Option, currency: Ticker, @@ -414,19 +414,23 @@ impl Module { ) } - fn base_claim(origin: T::Origin, ca_id: CAId) -> DispatchResult { + fn base_claim(origin: T::RuntimeOrigin, ca_id: CAId) -> DispatchResult { let did = >::ensure_perms(origin)?; Self::transfer_benefit(did.for_event(), did, ca_id)?; Ok(()) } - fn base_push_benefit(origin: T::Origin, ca_id: CAId, holder: IdentityId) -> DispatchResult { + fn base_push_benefit( + origin: T::RuntimeOrigin, + ca_id: CAId, + holder: IdentityId, + ) -> DispatchResult { let agent = >::ensure_perms(origin, ca_id.ticker)?.for_event(); Self::transfer_benefit(agent, holder, ca_id)?; Ok(()) } - fn base_reclaim(origin: T::Origin, ca_id: CAId) -> DispatchResult { + fn base_reclaim(origin: T::RuntimeOrigin, ca_id: CAId) -> DispatchResult { // Ensure distribution is created, they haven't reclaimed, and that expiry has passed. // CA must be authorized and be the custodian. let PermissionedCallOriginData { @@ -466,7 +470,7 @@ impl Module { Ok(()) } - fn base_remove_distribution(origin: T::Origin, ca_id: CAId) -> DispatchResult { + fn base_remove_distribution(origin: T::RuntimeOrigin, ca_id: CAId) -> DispatchResult { let agent = >::ensure_perms(origin, ca_id.ticker)?.for_event(); let dist = Self::ensure_distribution_exists(ca_id)?; Self::unverified_remove_distribution(agent, ca_id, &dist)?; diff --git a/pallets/corporate-actions/src/lib.rs b/pallets/corporate-actions/src/lib.rs index dd4de63ff5..63c29ab4d2 100644 --- a/pallets/corporate-actions/src/lib.rs +++ b/pallets/corporate-actions/src/lib.rs @@ -332,10 +332,10 @@ pub trait WeightInfo { /// The module's configuration trait. pub trait Config: frame_system::Config + BalancesConfig + IdentityConfig + asset::Config { /// The overarching event type. - type Event: From + type RuntimeEvent: From + From + From - + Into<::Event>; + + Into<::RuntimeEvent>; /// Max number of DID specified in `TargetIdentities`. type MaxTargetIds: Get; @@ -424,7 +424,7 @@ storage_migration_ver!(0); // Public interface for this runtime module. decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; /// initialize the default event for this module diff --git a/pallets/external-agents/Cargo.toml b/pallets/external-agents/Cargo.toml index a3d7d348a0..0f7859621a 100644 --- a/pallets/external-agents/Cargo.toml +++ b/pallets/external-agents/Cargo.toml @@ -24,7 +24,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = frame-system = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # Only in STD frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } diff --git a/pallets/external-agents/src/lib.rs b/pallets/external-agents/src/lib.rs index 35f08b4848..6eb75543c9 100644 --- a/pallets/external-agents/src/lib.rs +++ b/pallets/external-agents/src/lib.rs @@ -110,7 +110,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -279,7 +279,7 @@ decl_error! { } impl Module { - fn base_accept_become_agent(origin: T::Origin, auth_id: u64) -> DispatchResult { + fn base_accept_become_agent(origin: T::RuntimeOrigin, auth_id: u64) -> DispatchResult { let to = Identity::::ensure_perms(origin)?; Identity::::accept_auth_with(&to.into(), auth_id, |data, from| { let (ticker, group) = extract_auth!(data, BecomeAgent(t, ag)); @@ -297,7 +297,7 @@ impl Module { } fn base_create_group( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, perms: ExtrinsicPermissions, ) -> Result<(IdentityId, AGId), DispatchError> { @@ -312,7 +312,7 @@ impl Module { } fn base_create_group_and_add_auth( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, perms: ExtrinsicPermissions, target: IdentityId, @@ -329,7 +329,7 @@ impl Module { } fn base_set_group_permissions( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, id: AGId, perms: ExtrinsicPermissions, @@ -344,14 +344,18 @@ impl Module { Ok(()) } - fn base_remove_agent(origin: T::Origin, ticker: Ticker, agent: IdentityId) -> DispatchResult { + fn base_remove_agent( + origin: T::RuntimeOrigin, + ticker: Ticker, + agent: IdentityId, + ) -> DispatchResult { let did = Self::ensure_perms(origin, ticker)?.for_event(); Self::try_mutate_agents_group(ticker, agent, None)?; Self::deposit_event(Event::AgentRemoved(did, ticker, agent)); Ok(()) } - fn base_abdicate(origin: T::Origin, ticker: Ticker) -> DispatchResult { + fn base_abdicate(origin: T::RuntimeOrigin, ticker: Ticker) -> DispatchResult { let did = Self::ensure_asset_perms(origin, &ticker)?.primary_did; Self::try_mutate_agents_group(ticker, did, None)?; Self::deposit_event(Event::AgentRemoved(did.for_event(), ticker, did)); @@ -359,7 +363,7 @@ impl Module { } fn base_create_and_change_custom_group( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, perms: ExtrinsicPermissions, agent: IdentityId, @@ -369,7 +373,7 @@ impl Module { } fn base_change_group( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, agent: IdentityId, group: AgentGroup, @@ -468,13 +472,16 @@ impl Module { } /// Ensures that `origin` is a permissioned agent for `ticker`. - pub fn ensure_perms(origin: T::Origin, ticker: Ticker) -> Result { + pub fn ensure_perms( + origin: T::RuntimeOrigin, + ticker: Ticker, + ) -> Result { Self::ensure_agent_asset_perms(origin, ticker).map(|d| d.primary_did) } /// Ensures that `origin` is a permissioned agent for `ticker`. pub fn ensure_agent_asset_perms( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, ) -> Result, DispatchError> { let data = Self::ensure_asset_perms(origin, &ticker)?; @@ -485,7 +492,7 @@ impl Module { /// Ensure that `origin` is permissioned for this call /// and the secondary key has relevant asset permissions. pub fn ensure_asset_perms( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: &Ticker, ) -> Result, DispatchError> { let data = >::ensure_origin_call_permissions(origin)?; diff --git a/pallets/group/Cargo.toml b/pallets/group/Cargo.toml index b9effabc5b..6705a179fe 100644 --- a/pallets/group/Cargo.toml +++ b/pallets/group/Cargo.toml @@ -16,10 +16,10 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/group/rpc/Cargo.toml b/pallets/group/rpc/Cargo.toml index b78793d057..4b1ebe98a8 100644 --- a/pallets/group/rpc/Cargo.toml +++ b/pallets/group/rpc/Cargo.toml @@ -4,8 +4,23 @@ version = "2.0.0" authors = ["Anonymous"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0" } +jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } +sp-api = { version = "4.0.0-dev", default_features = false } +sp-blockchain = { version = "4.0.0-dev" } +sp-core = { version = "7.0.0", default_features = false } +sp-rpc = { version = "6.0.0" } +sp-runtime = { version = "7.0.0", default_features = false } +sp-std = {version = "5.0.0", default_features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } + # Common +node-rpc = { path = "../../../rpc" } polymesh-primitives = { package = "polymesh-primitives", path = "../../../primitives", default-features = false} # RPC @@ -14,17 +29,5 @@ pallet-group-rpc-runtime-api = { version = "2.0.0", path = "./runtime-api" } # Others serde = { version = "1.0.104", features = ["derive"] } -# Json RPC -jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-core-client = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-derive = "18.0.0" - -# Substrate -codec = { package = "parity-scale-codec", version = "3.0.0" } -sp-runtime = { version = "6.0.0", default-features = false } -sp-blockchain = { version = "4.0.0-dev", default_features = false} -sp-std = {version = "4.0.0", default_features = false } -sp-api = {version = "4.0.0-dev", default_features = false } - [dev-dependencies] -substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2"} +substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12"} diff --git a/pallets/group/rpc/runtime-api/Cargo.toml b/pallets/group/rpc/runtime-api/Cargo.toml index 8fbbf90556..3f27344368 100644 --- a/pallets/group/rpc/runtime-api/Cargo.toml +++ b/pallets/group/rpc/runtime-api/Cargo.toml @@ -4,6 +4,9 @@ version = "2.0.0" authors = ["Anonymous"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] # Common polymesh-primitives = { path = "../../../../primitives", default-features = false} @@ -15,11 +18,7 @@ serde = { version = "1.0.104", optional = true, features = ["derive"] } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default_features = false } -sp-std = { version = "4.0.0", default_features = false } -sp-runtime = { version = "6.0.0", default_features = false } - -[dev-dependencies] -serde_json = "1.0.41" +sp-std = { version = "5.0.0", default_features = false } [features] default = ["std"] @@ -28,7 +27,6 @@ std = [ "sp-api/std", "codec/std", "sp-std/std", - "sp-runtime/std", "polymesh-primitives/std", "polymesh-common-utilities/std" ] diff --git a/pallets/group/rpc/src/lib.rs b/pallets/group/rpc/src/lib.rs index f6bcf71939..c39ca7e5e3 100644 --- a/pallets/group/rpc/src/lib.rs +++ b/pallets/group/rpc/src/lib.rs @@ -3,23 +3,28 @@ pub use pallet_group_rpc_runtime_api::{GroupApi as GroupRuntimeApi, Member}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use std::{marker::PhantomData, sync::Arc}; + +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorObject}, +}; +use node_rpc::Error; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; use sp_std::prelude::*; -use std::{marker::PhantomData, sync::Arc}; /// Group RPC methods. -#[rpc] +#[rpc(client, server)] pub trait GroupApi { /// Valid members: active member and inactive who are not yet expired. - #[rpc(name = "group_getCDDValidMembers")] - fn get_cdd_valid_members(&self, at: Option) -> Result>; + #[method(name = "group_getCDDValidMembers")] + fn get_cdd_valid_members(&self, at: Option) -> RpcResult>; - #[rpc(name = "group_getGCValidMembers")] - fn get_gc_valid_members(&self, at: Option) -> Result>; + #[method(name = "group_getGCValidMembers")] + fn get_gc_valid_members(&self, at: Option) -> RpcResult>; } pub struct Group { @@ -36,39 +41,35 @@ impl From> for Group { } } -/// Error type of this RPC api. -pub enum Error { - /// The transaction was not decodable. - DecodeError, - /// The call to runtime failed. - RuntimeError, -} - -impl GroupApi<::Hash> for Group +impl GroupApiServer<::Hash> for Group where Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: GroupRuntimeApi, { - fn get_cdd_valid_members(&self, at: Option<::Hash>) -> Result> { + fn get_cdd_valid_members(&self, at: Option<::Hash>) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); - api.get_cdd_valid_members(&at).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch CDD providers.".into(), - data: Some(format!("{:?}", e).into()), + api.get_cdd_valid_members(&at).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch CDD providers.", + Some(e.to_string()), + )) + .into() }) } - fn get_gc_valid_members(&self, at: Option<::Hash>) -> Result> { + fn get_gc_valid_members(&self, at: Option<::Hash>) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); - api.get_gc_valid_members(&at).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch Governance Committee members.".into(), - data: Some(format!("{:?}", e).into()), + api.get_gc_valid_members(&at).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch Governance Committee members.", + Some(e.to_string()), + )) + .into() }) } } diff --git a/pallets/group/src/lib.rs b/pallets/group/src/lib.rs index 386c348526..6f168c752f 100644 --- a/pallets/group/src/lib.rs +++ b/pallets/group/src/lib.rs @@ -122,7 +122,7 @@ decl_storage! { decl_module! { pub struct Module, I: Instance=DefaultInstance> for enum Call - where origin: T::Origin + where origin: T::RuntimeOrigin { type Error = Error; diff --git a/pallets/identity/Cargo.toml b/pallets/identity/Cargo.toml index 15760225af..5e8796763e 100644 --- a/pallets/identity/Cargo.toml +++ b/pallets/identity/Cargo.toml @@ -18,7 +18,7 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false either = { version = "1.6.1", default-features = false } # Cryptography -confidential_identity_v2 = { version = "2.0.1", default-features = false } +confidential_identity_v2 = { version = "2.1.0", default-features = false } schnorrkel = { version = "0.10.1", default-features = false, optional = true } # Substrate @@ -28,10 +28,10 @@ scale-info = { version = "2.0", default-features = false, features = ["derive"] frame-system = { version = "4.0.0-dev", default-features = false } pallet-timestamp = { version = "4.0.0-dev", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } -sp-core = { version = "6.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } # Only Benchmarking diff --git a/pallets/identity/src/auth.rs b/pallets/identity/src/auth.rs index 7cca6c4a24..11ae907d52 100644 --- a/pallets/identity/src/auth.rs +++ b/pallets/identity/src/auth.rs @@ -30,7 +30,7 @@ use sp_std::vec::Vec; impl Module { /// Adds an authorization. pub(crate) fn base_add_authorization( - origin: T::Origin, + origin: T::RuntimeOrigin, target: Signatory, authorization_data: AuthorizationData, expiry: Option, @@ -80,7 +80,7 @@ impl Module { /// Removes an authorization. pub(crate) fn base_remove_authorization( - origin: T::Origin, + origin: T::RuntimeOrigin, target: Signatory, auth_id: u64, ) -> DispatchResult { diff --git a/pallets/identity/src/claims.rs b/pallets/identity/src/claims.rs index 216a440589..215d9db48b 100644 --- a/pallets/identity/src/claims.rs +++ b/pallets/identity/src/claims.rs @@ -337,7 +337,7 @@ impl Module { /// - 'InvalidCDDId' if you are not the owner of that CDD_ID. /// pub(crate) fn base_add_investor_uniqueness_claim( - origin: T::Origin, + origin: T::RuntimeOrigin, target: IdentityId, claim: Claim, scope_opt: Option, @@ -426,7 +426,7 @@ impl Module { /// Ensure that the origin is signed and that the given `target` is already in the system. pub(crate) fn ensure_signed_and_validate_claim_target( - origin: T::Origin, + origin: T::RuntimeOrigin, target: IdentityId, ) -> Result { let primary_did = Self::ensure_perms(origin)?; @@ -486,7 +486,7 @@ impl Module { /// one identity. /// - External secondary keys can be linked to just one identity. pub fn base_cdd_register_did( - origin: T::Origin, + origin: T::RuntimeOrigin, target_account: T::AccountId, secondary_keys: Vec>, ) -> Result<(IdentityId, IdentityId), DispatchError> { @@ -512,7 +512,7 @@ impl Module { /// Invalidates any claim generated by `cdd` from `disable_from` timestamps. pub(crate) fn base_invalidate_cdd_claims( - origin: T::Origin, + origin: T::RuntimeOrigin, cdd: IdentityId, disable_from: T::Moment, expiry: Option, @@ -551,7 +551,10 @@ impl Module { }); } - pub fn base_register_custom_claim_type(origin: T::Origin, ty: Vec) -> DispatchResult { + pub fn base_register_custom_claim_type( + origin: T::RuntimeOrigin, + ty: Vec, + ) -> DispatchResult { let did = Self::ensure_perms(origin)?; let id = Self::unsafe_register_custom_claim_type(ty.clone())?; Self::deposit_event(Event::::CustomClaimTypeAdded(did, id, ty)); diff --git a/pallets/identity/src/keys.rs b/pallets/identity/src/keys.rs index dd3c250968..9875ab1785 100644 --- a/pallets/identity/src/keys.rs +++ b/pallets/identity/src/keys.rs @@ -261,7 +261,7 @@ impl Module { /// Accepts a primary key rotation. pub(crate) fn accept_primary_key_rotation( - origin: T::Origin, + origin: T::RuntimeOrigin, rotation_auth_id: u64, optional_cdd_auth_id: Option, ) -> DispatchResult { @@ -372,7 +372,7 @@ impl Module { /// secondary key with the permissions specified in the corresponding RotatePrimaryKeyToSecondary authorization /// instead of unlinking the primary key. pub(crate) fn base_rotate_primary_key_to_secondary( - origin: T::Origin, + origin: T::RuntimeOrigin, rotation_auth_id: u64, optional_cdd_auth_id: Option, ) -> DispatchResult { @@ -397,7 +397,7 @@ impl Module { /// Set permissions for the specific `key`. /// Only the primary key of an identity is able to set secondary key permissions. pub(crate) fn base_set_secondary_key_permissions( - origin: T::Origin, + origin: T::RuntimeOrigin, key: T::AccountId, permissions: Permissions, ) -> DispatchResult { @@ -425,7 +425,7 @@ impl Module { /// Removes specified secondary keys of a DID if present. pub(crate) fn base_remove_secondary_keys( - origin: T::Origin, + origin: T::RuntimeOrigin, keys: Vec, ) -> DispatchResult { let (_, did) = Self::ensure_primary_key(origin)?; @@ -458,7 +458,7 @@ impl Module { /// Adds secondary keys to target identity `id`. /// Keys are directly added to identity because each of them has an authorization. pub(crate) fn base_add_secondary_keys_with_authorization( - origin: T::Origin, + origin: T::RuntimeOrigin, keys: Vec>, expires_at: T::Moment, ) -> DispatchResult { @@ -518,7 +518,7 @@ impl Module { } /// Accepts an auth to join an identity as a signer - pub fn join_identity(origin: T::Origin, auth_id: u64) -> DispatchResult { + pub fn join_identity(origin: T::RuntimeOrigin, auth_id: u64) -> DispatchResult { let key = ensure_signed(origin)?; let signer = Signatory::Account(key.clone()); Self::accept_auth_with(&signer, auth_id, |data, target_did| { @@ -559,7 +559,7 @@ impl Module { Self::deposit_event(RawEvent::SecondaryKeysAdded(target_did, vec![sk])); } - pub(crate) fn leave_identity(origin: T::Origin) -> DispatchResult { + pub(crate) fn leave_identity(origin: T::RuntimeOrigin) -> DispatchResult { let (key, did) = Self::ensure_did(origin)?; // Ensure that the caller is a secondary key. @@ -580,7 +580,7 @@ impl Module { /// # Errors /// Only primary key can freeze/unfreeze an identity. pub(crate) fn set_frozen_secondary_key_flags( - origin: T::Origin, + origin: T::RuntimeOrigin, freeze: bool, ) -> DispatchResult { let (_, did) = Self::ensure_primary_key(origin)?; @@ -660,7 +660,7 @@ impl Module { where T::AccountId: core::fmt::Display, { - let acc = issuer.as_pallet_id().into_account(); + let acc = issuer.as_pallet_id().into_account_truncating(); let id = issuer.as_id(); log::info!( "Register Systematic id {} with account {} as {}", @@ -697,7 +697,9 @@ impl Module { } /// Ensures that `origin`'s key is the primary key of a DID. - fn ensure_primary_key(origin: T::Origin) -> Result<(T::AccountId, IdentityId), DispatchError> { + fn ensure_primary_key( + origin: T::RuntimeOrigin, + ) -> Result<(T::AccountId, IdentityId), DispatchError> { let sender = ensure_signed(origin)?; let key_rec = Self::key_records(&sender).ok_or(pallet_permissions::Error::::UnauthorizedCaller)?; @@ -706,7 +708,9 @@ impl Module { } /// Ensures that `origin`'s key is linked to a DID and returns both. - pub fn ensure_did(origin: T::Origin) -> Result<(T::AccountId, IdentityId), DispatchError> { + pub fn ensure_did( + origin: T::RuntimeOrigin, + ) -> Result<(T::AccountId, IdentityId), DispatchError> { let sender = ensure_signed(origin)?; let did = Context::current_identity_or::(&sender)?; Ok((sender, did)) @@ -714,7 +718,7 @@ impl Module { /// Checks call permissions and, if successful, returns the caller's account, primary and secondary identities. pub fn ensure_origin_call_permissions( - origin: T::Origin, + origin: T::RuntimeOrigin, ) -> Result, DispatchError> { let sender = ensure_signed(origin)?; let AccountCallPermissionsData { @@ -729,7 +733,7 @@ impl Module { } /// Ensure `origin` is signed and permissioned for this call, returning its DID. - pub fn ensure_perms(origin: T::Origin) -> Result { + pub fn ensure_perms(origin: T::RuntimeOrigin) -> Result { Self::ensure_origin_call_permissions(origin).map(|x| x.primary_did) } diff --git a/pallets/identity/src/lib.rs b/pallets/identity/src/lib.rs index 7a94c810b9..3531142e45 100644 --- a/pallets/identity/src/lib.rs +++ b/pallets/identity/src/lib.rs @@ -95,12 +95,11 @@ use confidential_identity_v2::ScopeClaimProof; use core::convert::From; use frame_support::{ decl_error, decl_module, decl_storage, - dispatch::DispatchResult, - traits::{ChangeMembers, Currency, EnsureOrigin, Get, InitializeMembers}, - weights::{ + dispatch::{ DispatchClass::{Normal, Operational}, - Pays, + DispatchResult, Pays, }, + traits::{ChangeMembers, Currency, EnsureOrigin, Get, InitializeMembers}, }; use frame_system::ensure_root; pub use polymesh_common_utilities::traits::identity::WeightInfo; @@ -243,7 +242,7 @@ decl_storage! { decl_module! { /// The module declaration. - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; @@ -778,7 +777,7 @@ impl InitializeMembers for Module { /// A `revoke_claim` or `revoke_claim_by_index` TX is operational iff `claim_type` is a `Claim::CustomerDueDiligence`. /// Otherwise, it will be a normal transaction. -fn revoke_claim_class(claim_type: ClaimType) -> frame_support::weights::DispatchClass { +fn revoke_claim_class(claim_type: ClaimType) -> frame_support::dispatch::DispatchClass { match claim_type { ClaimType::CustomerDueDiligence => Operational, _ => Normal, diff --git a/pallets/multisig/Cargo.toml b/pallets/multisig/Cargo.toml index a9603d08a6..69e361ecdf 100644 --- a/pallets/multisig/Cargo.toml +++ b/pallets/multisig/Cargo.toml @@ -19,9 +19,9 @@ serde = { version = "1.0.104", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-core = { version = "6.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/multisig/src/benchmarking.rs b/pallets/multisig/src/benchmarking.rs index 88acc68148..d8d1869ab0 100644 --- a/pallets/multisig/src/benchmarking.rs +++ b/pallets/multisig/src/benchmarking.rs @@ -359,7 +359,7 @@ benchmarks! { execute_scheduled_proposal { let (alice, multisig, _, _, proposal_id, proposal, ephemeral_multisig) = generate_multisig_and_create_proposal::(1, 1, false).unwrap(); let ephemeral_proposal_id = proposal_id.clone(); - }: _(RawOrigin::Root, ephemeral_multisig, ephemeral_proposal_id, alice.did(), 0) + }: _(RawOrigin::Root, ephemeral_multisig, ephemeral_proposal_id, alice.did(), Weight::zero()) verify { assert!(>::get((&multisig, proposal_id)).status == ProposalStatus::ExecutionSuccessful); } diff --git a/pallets/multisig/src/lib.rs b/pallets/multisig/src/lib.rs index b8a4891b32..518bc5cdc7 100644 --- a/pallets/multisig/src/lib.rs +++ b/pallets/multisig/src/lib.rs @@ -87,13 +87,12 @@ use codec::{Decode, Encode, Error as CodecError}; use core::convert::From; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, - dispatch::{DispatchError, DispatchResult}, + dispatch::{DispatchError, DispatchResult, GetDispatchInfo, Weight}, ensure, traits::{ schedule::{DispatchTime, Named as ScheduleNamed}, Get, GetCallMetadata, }, - weights::{GetDispatchInfo, Weight}, StorageDoubleMap, StorageValue, }; use frame_system::{self as system, ensure_root, ensure_signed, RawOrigin}; @@ -127,7 +126,7 @@ pub type CreateProposalResult = sp_std::result::Result; /// The multisig trait. pub trait Config: frame_system::Config + IdentityConfig { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Scheduler of multisig proposals. type Scheduler: ScheduleNamed; /// A call type for identity-mapping the `Call` enum type. Used by the scheduler. @@ -244,7 +243,7 @@ decl_storage! { decl_module! { /// A multisig module. - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -257,13 +256,16 @@ decl_module! { let current_version = >::get().transaction_version; if TransactionVersion::get() < current_version { TransactionVersion::set(current_version); + // TODO: Replace this code with `Proposal*::remove*` calls. + // Doing so will provide compile-time checks. The current code + // will fail silently if storage names changes. for item in &["Proposals", "ProposalIds", "ProposalDetail", "Votes"] { kill_item(NAME, item.as_bytes()) } } //TODO placeholder weight - 1_000 + Weight::from_ref_time(1_000) } /// Creates a multisig @@ -683,13 +685,15 @@ decl_error! { } impl Module { - fn ensure_signed_acc(origin: T::Origin) -> Result, DispatchError> { + fn ensure_signed_acc( + origin: T::RuntimeOrigin, + ) -> Result, DispatchError> { let sender = ensure_signed(origin)?; Ok(Signatory::Account(sender)) } fn ensure_perms_signed_did( - origin: T::Origin, + origin: T::RuntimeOrigin, ) -> Result, DispatchError> { >::ensure_perms(origin).map(|d| d.into()) } @@ -703,7 +707,7 @@ impl Module { } fn ensure_ms_creator( - origin: T::Origin, + origin: T::RuntimeOrigin, multisig: &T::AccountId, ) -> Result { let (sender, did) = Identity::::ensure_did(origin)?; diff --git a/pallets/nft/Cargo.toml b/pallets/nft/Cargo.toml index a56c52a4d0..bad66c3761 100644 --- a/pallets/nft/Cargo.toml +++ b/pallets/nft/Cargo.toml @@ -18,7 +18,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # Only in STD frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } @@ -40,4 +40,4 @@ std = [ ] runtime-benchmarks = [ "frame-benchmarking", -] \ No newline at end of file +] diff --git a/pallets/nft/src/benchmarking.rs b/pallets/nft/src/benchmarking.rs index b7b4ec31b1..737f75e8d7 100644 --- a/pallets/nft/src/benchmarking.rs +++ b/pallets/nft/src/benchmarking.rs @@ -19,7 +19,7 @@ const MAX_COLLECTION_KEYS: u32 = 255; /// Creates an NFT collection with `n` global metadata keys. fn create_collection( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, nft_type: Option, n: u32, @@ -51,7 +51,7 @@ fn creates_keys_register_metadata_types(n: u32) -> NFTCollectionKeys /// Creates an NFT collection with `n_keys` global metadata keys and issues `n_nfts`. pub fn create_collection_issue_nfts( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, nft_type: Option, n_keys: u32, diff --git a/pallets/nft/src/lib.rs b/pallets/nft/src/lib.rs index fe3390ed91..534d0a10af 100644 --- a/pallets/nft/src/lib.rs +++ b/pallets/nft/src/lib.rs @@ -18,7 +18,7 @@ use polymesh_primitives::nft::{ use polymesh_primitives::{IdentityId, PortfolioId, PortfolioKind, Ticker}; use sp_std::collections::btree_map::BTreeMap; use sp_std::collections::btree_set::BTreeSet; -use sp_std::vec::Vec; +use sp_std::{vec, vec::Vec}; type Asset = pallet_asset::Module; type ExternalAgents = pallet_external_agents::Module; @@ -54,7 +54,7 @@ decl_storage!( ); decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; @@ -177,7 +177,7 @@ decl_error! { impl Module { fn base_create_nft_collection( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, nft_type: Option, collection_keys: NFTCollectionKeys, @@ -258,7 +258,7 @@ impl Module { } fn base_issue_nft( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, metadata_attributes: Vec, portfolio_kind: PortfolioKind, @@ -320,7 +320,7 @@ impl Module { } fn base_redeem_nft( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, nft_id: NFTId, portfolio_kind: PortfolioKind, @@ -345,6 +345,7 @@ impl Module { .ok_or(Error::::BalanceUnderflow)?; NumberOfNFTs::insert(&ticker, &caller_portfolio.did, new_balance); PortfolioNFT::remove(&caller_portfolio, (&ticker, &nft_id)); + #[allow(deprecated)] MetadataValue::remove_prefix((&collection_id, &nft_id), None); Self::deposit_event(Event::RedeemedNFT(caller_portfolio.did, ticker, nft_id)); @@ -451,7 +452,7 @@ impl Module { } } -impl NFTTrait for Module { +impl NFTTrait for Module { fn is_collection_key(ticker: &Ticker, metadata_key: &AssetMetadataKey) -> bool { match CollectionTicker::try_get(ticker) { Ok(collection_id) => { @@ -464,7 +465,7 @@ impl NFTTrait for Module { #[cfg(feature = "runtime-benchmarks")] fn create_nft_collection( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, nft_type: Option, collection_keys: NFTCollectionKeys, diff --git a/pallets/permissions/Cargo.toml b/pallets/permissions/Cargo.toml index f2ab4cde79..4656005bf1 100644 --- a/pallets/permissions/Cargo.toml +++ b/pallets/permissions/Cargo.toml @@ -17,8 +17,8 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = frame-system = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # Only for benchmarking frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } diff --git a/pallets/permissions/src/lib.rs b/pallets/permissions/src/lib.rs index 11ebfce4d3..e575f14f08 100644 --- a/pallets/permissions/src/lib.rs +++ b/pallets/permissions/src/lib.rs @@ -37,7 +37,7 @@ use sp_runtime::{ traits::{DispatchInfoOf, PostDispatchInfoOf, SignedExtension}, transaction_validity::{TransactionValidity, TransactionValidityError, ValidTransaction}, }; -use sp_std::{fmt, marker::PhantomData, result::Result}; +use sp_std::{fmt, marker::PhantomData, result::Result, vec}; pub use polymesh_common_utilities::traits::permissions::Config; @@ -51,7 +51,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { // This definition is needed because the construct_runtime! macro uses it to generate metadata. // Without this definition, the metadata won't have details about the errors of this module. // That will lead to UIs either throwing fits or showing incorrect error messages. @@ -120,11 +120,11 @@ impl StoreCallMetadata { impl SignedExtension for StoreCallMetadata where T: Config + Send + Sync, - ::Call: GetCallMetadata, + ::RuntimeCall: GetCallMetadata, { const IDENTIFIER: &'static str = "StoreCallMetadata"; type AccountId = T::AccountId; - type Call = ::Call; + type Call = ::RuntimeCall; type AdditionalSigned = (); type Pre = (); diff --git a/pallets/pips/Cargo.toml b/pallets/pips/Cargo.toml index d1f497421e..fcd676b995 100644 --- a/pallets/pips/Cargo.toml +++ b/pallets/pips/Cargo.toml @@ -25,10 +25,10 @@ log = "0.4.8" # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/pips/src/lib.rs b/pallets/pips/src/lib.rs index d192441856..e27ee1b788 100644 --- a/pallets/pips/src/lib.rs +++ b/pallets/pips/src/lib.rs @@ -91,14 +91,13 @@ use codec::{Decode, Encode, FullCodec}; use core::{cmp::Ordering, mem}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, - dispatch::{DispatchResult, DispatchResultWithPostInfo}, + dispatch::{DispatchClass::Operational, DispatchResult, DispatchResultWithPostInfo, Weight}, ensure, storage::IterableStorageMap, traits::{ schedule::{DispatchTime, Named as ScheduleNamed, Priority, HARD_DEADLINE}, Currency, EnsureOrigin, Get, LockIdentifier, WithdrawReasons, }, - weights::{DispatchClass::Operational, Weight}, StorageValue, }; use frame_system::{self as system, ensure_root, ensure_signed, RawOrigin}; @@ -411,19 +410,19 @@ pub trait Config: type Currency: LockableCurrencyExt; /// Origin for enacting results for PIPs (reject, approve, skip, etc.). - type VotingMajorityOrigin: EnsureOrigin; + type VotingMajorityOrigin: EnsureOrigin; /// Committee type GovernanceCommittee: GovernanceGroupTrait<::Moment>; /// Voting majority origin for Technical Committee. - type TechnicalCommitteeVMO: EnsureOrigin; + type TechnicalCommitteeVMO: EnsureOrigin; /// Voting majority origin for Upgrade Committee. - type UpgradeCommitteeVMO: EnsureOrigin; + type UpgradeCommitteeVMO: EnsureOrigin; /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Weight calaculation. type WeightInfo: WeightInfo; @@ -645,7 +644,7 @@ decl_error! { // The module's dispatchable functions. decl_module! { /// The module declaration. - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -1137,7 +1136,7 @@ decl_module! { } impl Module { - fn config(origin: T::Origin, new: X, event: E) -> DispatchResult + fn config(origin: T::RuntimeOrigin, new: X, event: E) -> DispatchResult where SV: StorageValue, X: FullCodec + Clone, @@ -1159,7 +1158,7 @@ impl Module { /// # Errors /// * `BadOrigin` if not a signed extrinsic. fn ensure_infer_proposer( - origin: T::Origin, + origin: T::RuntimeOrigin, ) -> Result<(Proposer, IdentityId), DispatchError> { match ensure_signed(origin.clone()) { Ok(sender) => { @@ -1190,11 +1189,13 @@ impl Module { /// This operation is idempotent wrt. chain state, /// i.e., once run, refunding again will refund nothing. fn refund_proposal(did: IdentityId, id: PipId) { + // TODO: use `drain_prefix` instead, to avoid the `remove_prefix` call. let total_refund = >::iter_prefix_values(id).fold(0u32.into(), |acc, depo_info| { Self::reduce_lock(&depo_info.owner, depo_info.amount).unwrap(); depo_info.amount.saturating_add(acc) }); + #[allow(deprecated)] >::remove_prefix(id, None); Self::deposit_event(RawEvent::ProposalRefund(did, id, total_refund)); } @@ -1238,6 +1239,7 @@ impl Module { Self::decrement_count_if_active(state); if prune { ProposalResult::remove(id); + #[allow(deprecated)] ProposalVotes::::remove_prefix(id, None); >::remove(id); if let Some(Proposer::Committee(_)) = Self::proposals(id).map(|p| p.proposer) { @@ -1324,7 +1326,7 @@ impl Module { let weight = res.unwrap_or_else(|e| e.post_info).actual_weight; let new_state = res.map_or(ProposalState::Failed, |_| ProposalState::Executed); Self::maybe_prune(GC_DID, id, new_state); - Ok(Some(weight.unwrap_or(0)).into()) + Ok(Some(weight.unwrap_or(Weight::zero())).into()) } /// Update the proposal state of `did` setting it to `new_state`. diff --git a/pallets/portfolio/Cargo.toml b/pallets/portfolio/Cargo.toml index 458c6b9862..b20ea7f5d6 100644 --- a/pallets/portfolio/Cargo.toml +++ b/pallets/portfolio/Cargo.toml @@ -23,8 +23,8 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-arithmetic = { version = "5.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # Only in STD frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } diff --git a/pallets/portfolio/src/lib.rs b/pallets/portfolio/src/lib.rs index 3ac5512aa3..e50e518365 100644 --- a/pallets/portfolio/src/lib.rs +++ b/pallets/portfolio/src/lib.rs @@ -67,7 +67,7 @@ use polymesh_primitives::{ use scale_info::TypeInfo; use sp_arithmetic::traits::Zero; use sp_std::collections::btree_set::BTreeSet; -use sp_std::prelude::Vec; +use sp_std::prelude::*; type Identity = identity::Module; @@ -177,7 +177,7 @@ decl_error! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; /// The event logger. @@ -227,7 +227,9 @@ decl_module! { Portfolios::remove(&primary_did, &num); NameToNumber::remove(&primary_did, &portfolio); PortfolioAssetCount::remove(&pid); + #[allow(deprecated)] PortfolioAssetBalances::remove_prefix(&pid, None); + #[allow(deprecated)] PortfolioLockedAssets::remove_prefix(&pid, None); PortfoliosInCustody::remove(&Self::custodian(&pid), &pid); PortfolioCustodian::remove(&pid); @@ -408,7 +410,7 @@ decl_module! { ); }); - 0 + Weight::zero() } } } @@ -638,7 +640,7 @@ impl Module { PortfolioLockedAssets::mutate(portfolio, ticker, |l| *l = l.saturating_add(amount)); } - fn base_accept_portfolio_custody(origin: T::Origin, auth_id: u64) -> DispatchResult { + fn base_accept_portfolio_custody(origin: T::RuntimeOrigin, auth_id: u64) -> DispatchResult { let to = Identity::::ensure_perms(origin)?; Identity::::accept_auth_with(&to.into(), auth_id, |data, from| { let pid = extract_auth!(data, PortfolioCustody(p)); @@ -664,7 +666,7 @@ impl Module { /// Verifies if the portfolios are different, if the move is between the same identity, if the receiving portfolio exists, /// and if the user has access to both portfolios. fn ensure_portfolios_validity_and_permissions( - origin: T::Origin, + origin: T::RuntimeOrigin, from: PortfolioId, to: PortfolioId, ) -> Result { diff --git a/pallets/protocol-fee/Cargo.toml b/pallets/protocol-fee/Cargo.toml index 9146023d48..adfcb60f7c 100644 --- a/pallets/protocol-fee/Cargo.toml +++ b/pallets/protocol-fee/Cargo.toml @@ -17,10 +17,10 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # benchmark-only frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } diff --git a/pallets/protocol-fee/rpc/Cargo.toml b/pallets/protocol-fee/rpc/Cargo.toml index 8a63d6f63c..10749bf6a1 100644 --- a/pallets/protocol-fee/rpc/Cargo.toml +++ b/pallets/protocol-fee/rpc/Cargo.toml @@ -4,18 +4,24 @@ version = "0.1.0" authors = ["Polymath"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0" } +jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } +sp-api = { version = "4.0.0-dev", default_features = false } +sp-blockchain = { version = "4.0.0-dev" } +sp-core = { version = "7.0.0", default_features = false } +sp-rpc = { version = "6.0.0" } +sp-runtime = { version = "7.0.0", default_features = false } +sp-std = {version = "5.0.0", default_features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } + +node-rpc = { path = "../../../rpc" } polymesh-common-utilities = { path = "../../common", default-features = false } pallet-protocol-fee-rpc-runtime-api = { path = "./runtime-api" } # General serde = { version = "1.0.104", features = ["derive"] } -jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-core-client = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-derive = "18.0.0" - -# Substrate -codec = { package = "parity-scale-codec", version = "3.0.0" } -sp-runtime = { version = "6.0.0", default_features = false } -sp-blockchain = { version = "4.0.0-dev", default_features = false} -sp-api = { version = "4.0.0-dev", default_features = false} diff --git a/pallets/protocol-fee/rpc/runtime-api/Cargo.toml b/pallets/protocol-fee/rpc/runtime-api/Cargo.toml index 090e077f40..c1aff3ea13 100644 --- a/pallets/protocol-fee/rpc/runtime-api/Cargo.toml +++ b/pallets/protocol-fee/rpc/runtime-api/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" authors = ["Polymath"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] polymesh-common-utilities = { path = "../../../common", default-features = false } @@ -13,11 +16,7 @@ serde = { version = "1.0.104", optional = true, features = ["derive"] } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default_features = false} -sp-runtime = { version = "6.0.0", default_features = false} -frame-support = { version = "4.0.0-dev", default-features = false } - -[dev-dependencies] -serde_json = "1.0.48" +sp-runtime = { version = "7.0.0", default_features = false} [features] default = ["std"] @@ -26,6 +25,5 @@ std = [ "sp-api/std", "codec/std", "sp-runtime/std", - "frame-support/std", "polymesh-common-utilities/std" ] diff --git a/pallets/protocol-fee/rpc/src/lib.rs b/pallets/protocol-fee/rpc/src/lib.rs index 30c207d77a..b3ddfcfee9 100644 --- a/pallets/protocol-fee/rpc/src/lib.rs +++ b/pallets/protocol-fee/rpc/src/lib.rs @@ -13,8 +13,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorObject}, +}; +use node_rpc::Error; pub use pallet_protocol_fee_rpc_runtime_api::{CappedFee, ProtocolFeeApi as ProtocolFeeRuntimeApi}; use polymesh_common_utilities::protocol_fee::ProtocolOp; use sp_api::ProvideRuntimeApi; @@ -22,10 +26,10 @@ use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; use std::sync::Arc; -#[rpc] +#[rpc(client, server)] pub trait ProtocolFeeApi { - #[rpc(name = "protocolFee_computeFee")] - fn compute_fee(&self, op: ProtocolOp, at: Option) -> Result; + #[method(name = "protocolFee_computeFee")] + fn compute_fee(&self, op: ProtocolOp, at: Option) -> RpcResult; } /// A struct that implements the [`ProtocolFeeApi`]. @@ -44,36 +48,29 @@ impl ProtocolFee { } } -/// Error type of this RPC API. -pub enum Error { - /// The transaction was not decodable. - DecodeError = 1, - /// The call to runtime failed. - RuntimeError = 2, -} - -impl ProtocolFeeApi<::Hash> for ProtocolFee +impl ProtocolFeeApiServer<::Hash> for ProtocolFee where Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: ProtocolFeeRuntimeApi, { fn compute_fee( &self, op: ProtocolOp, at: Option<::Hash>, - ) -> Result { + ) -> RpcResult { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| // If the block hash is not supplied assume the best block. self.client.info().best_hash)); - api.compute_fee(&at, op).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to query dispatch info.".into(), - data: Some(format!("{:?}", e).into()), + api.compute_fee(&at, op).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to query dispatch info.", + Some(e.to_string()), + )) + .into() }) } } diff --git a/pallets/protocol-fee/src/lib.rs b/pallets/protocol-fee/src/lib.rs index e188de7993..c2f5c146d3 100644 --- a/pallets/protocol-fee/src/lib.rs +++ b/pallets/protocol-fee/src/lib.rs @@ -54,6 +54,7 @@ use polymesh_common_utilities::{ }; use polymesh_primitives::{Balance, IdentityId, PosRatio}; use sp_runtime::{traits::Zero, Perbill}; +use sp_std::vec; type NegativeImbalanceOf = <::Currency as Currency< ::AccountId, @@ -67,7 +68,7 @@ pub trait WeightInfo { } pub trait Config: frame_system::Config + IdentityConfig { - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// The currency type in which fees will be paid. type Currency: Currency + Send + Sync; /// Handler for the unbalanced reduction when taking protocol fees. @@ -119,7 +120,7 @@ decl_event! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; diff --git a/pallets/relayer/Cargo.toml b/pallets/relayer/Cargo.toml index 2f45344ab8..0dd394e4ad 100644 --- a/pallets/relayer/Cargo.toml +++ b/pallets/relayer/Cargo.toml @@ -11,11 +11,11 @@ polymesh-primitives = { path = "../../primitives", default-features = false} # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "6.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # Only Benchmarking frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } diff --git a/pallets/relayer/src/lib.rs b/pallets/relayer/src/lib.rs index c7d759fcab..59082d500a 100644 --- a/pallets/relayer/src/lib.rs +++ b/pallets/relayer/src/lib.rs @@ -59,6 +59,7 @@ use polymesh_primitives::{ }; use scale_info::TypeInfo; use sp_runtime::transaction_validity::InvalidTransaction; +use sp_std::vec; type Identity = pallet_identity::Module; @@ -99,7 +100,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -222,7 +223,7 @@ decl_error! { impl Module { fn base_set_paying_key( - origin: T::Origin, + origin: T::RuntimeOrigin, user_key: T::AccountId, polyx_limit: Balance, ) -> DispatchResult { @@ -237,7 +238,7 @@ impl Module { Ok(()) } - fn base_accept_paying_key(origin: T::Origin, auth_id: u64) -> DispatchResult { + fn base_accept_paying_key(origin: T::RuntimeOrigin, auth_id: u64) -> DispatchResult { let caller_key = ensure_signed(origin)?; let user_did = >::get_identity(&caller_key).ok_or(Error::::UserKeyCddMissing)?; @@ -269,7 +270,7 @@ impl Module { } fn base_remove_paying_key( - origin: T::Origin, + origin: T::RuntimeOrigin, user_key: T::AccountId, paying_key: T::AccountId, ) -> DispatchResult { @@ -308,7 +309,7 @@ impl Module { } fn base_update_polyx_limit( - origin: T::Origin, + origin: T::RuntimeOrigin, user_key: T::AccountId, action: UpdateAction, amount: Balance, diff --git a/pallets/rewards/Cargo.toml b/pallets/rewards/Cargo.toml index 4379b2f8cf..a95bd7f9d0 100644 --- a/pallets/rewards/Cargo.toml +++ b/pallets/rewards/Cargo.toml @@ -14,9 +14,9 @@ pallet-staking = { path = "../staking", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/rewards/src/lib.rs b/pallets/rewards/src/lib.rs index 437d42555b..0d9b6c24f8 100644 --- a/pallets/rewards/src/lib.rs +++ b/pallets/rewards/src/lib.rs @@ -46,7 +46,7 @@ use sp_std::{convert::TryInto, prelude::*}; pub trait Config: frame_system::Config + IdentityConfig + staking::Config { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Weight information for extrinsic of the sto pallet. type WeightInfo: WeightInfo; } @@ -101,7 +101,7 @@ decl_event! { } decl_module! { - pub struct Module for enum Call where origin: ::Origin { + pub struct Module for enum Call where origin: ::RuntimeOrigin { type Error = Error; fn deposit_event() = default; diff --git a/pallets/runtime/common/Cargo.toml b/pallets/runtime/common/Cargo.toml index 82ccd539d5..7f0dca3a1b 100644 --- a/pallets/runtime/common/Cargo.toml +++ b/pallets/runtime/common/Cargo.toml @@ -31,10 +31,10 @@ smallvec = "1.4.0" # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/runtime/common/src/lib.rs b/pallets/runtime/common/src/lib.rs index 5b884c38fe..0be76e8793 100644 --- a/pallets/runtime/common/src/lib.rs +++ b/pallets/runtime/common/src/lib.rs @@ -26,12 +26,12 @@ pub use cdd_check::CddChecker; pub use sp_runtime::{Perbill, Permill}; pub use frame_support::{ + dispatch::{DispatchClass, GetDispatchInfo, Weight}, parameter_types, traits::Currency, weights::{ constants::{WEIGHT_PER_MICROS, WEIGHT_PER_MILLIS, WEIGHT_PER_NANOS, WEIGHT_PER_SECOND}, - DispatchClass, GetDispatchInfo, RuntimeDbWeight, Weight, WeightToFeeCoefficient, - WeightToFeeCoefficients, WeightToFeePolynomial, + RuntimeDbWeight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, }; use frame_system::limits::{BlockLength, BlockWeights}; @@ -56,7 +56,7 @@ pub const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10); /// by Operational extrinsics. const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// We allow for 2 seconds of compute with a 6 second average block time. -const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND; +const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.saturating_mul(2).set_proof_size(u64::MAX); // TODO (miguel) Remove unused constants. parameter_types! { @@ -72,16 +72,16 @@ parameter_types! { /// Blocks can be of upto 10 MB in size. pub const MaximumBlockLength: u32 = 10 * 1024 * 1024; /// 20 ms is needed to create a block. - pub const BlockExecutionWeight: Weight = 20 * WEIGHT_PER_MILLIS; + pub const BlockExecutionWeight: Weight = WEIGHT_PER_MILLIS.saturating_mul(20); /// 0.65 ms is needed to process an empty extrinsic. - pub const ExtrinsicBaseWeight: Weight = 650 * WEIGHT_PER_MICROS; + pub const ExtrinsicBaseWeight: Weight = WEIGHT_PER_MICROS.saturating_mul(650); /// When the read/writes are cached/buffered, they take 25/100 microseconds on NVMe disks. /// When they are uncached, they take 250/450 microseconds on NVMe disks. /// Most read will be cached and writes will be buffered in production. /// We are taking a number slightly higher than what cached suggest to allow for some extra breathing room. pub const RocksDbWeight: RuntimeDbWeight = RuntimeDbWeight { - read: 50 * WEIGHT_PER_MICROS, // ~50 µs @ 100,000 items - write: 200 * WEIGHT_PER_MICROS, // ~200 µs @ 100,000 items + read: 50 * WEIGHT_PER_MICROS.ref_time(), // ~50 µs @ 100,000 items + write: 200 * WEIGHT_PER_MICROS.ref_time(), // ~200 µs @ 100,000 items }; /// This implies a 100 POLYX fee per MB of transaction length pub const TransactionByteFee: Balance = 10 * MILLICENTS; @@ -91,7 +91,7 @@ parameter_types! { pub const MultiSigBalanceLimit: Balance = POLY; /// The maximum weight of the pips extrinsic `enact_snapshot_results` which equals to /// `MaximumBlockWeight * AvailableBlockRatio`. - pub const PipsEnactSnapshotMaximumWeight: Weight = MAXIMUM_BLOCK_WEIGHT * 75 / 100; + pub const PipsEnactSnapshotMaximumWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_mul(75).saturating_div(100); /// Number of block delay an extrinsic claim surcharge has. pub const SignedClaimHandicap: u32 = 2; /// The balance every contract needs to deposit to stay alive indefinitely. @@ -148,7 +148,7 @@ impl WeightToFeePolynomial for WeightToFee { degree: 1, coeff_frac: Perbill::from_rational( PolyXBaseFee::get(), - ExtrinsicBaseWeight::get() as u128 + ExtrinsicBaseWeight::get().ref_time() as u128 ), coeff_integer: 0u128, // Coefficient is zero. negative: false, diff --git a/pallets/runtime/common/src/runtime.rs b/pallets/runtime/common/src/runtime.rs index 8be36f77e9..c435eafa08 100644 --- a/pallets/runtime/common/src/runtime.rs +++ b/pallets/runtime/common/src/runtime.rs @@ -48,7 +48,7 @@ macro_rules! misc_pallet_impls { /// The identifier used to distinguish between accounts. type AccountId = polymesh_primitives::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 = Indices; /// The index type for storing how many extrinsics an account has signed. @@ -63,9 +63,9 @@ macro_rules! misc_pallet_impls { type Header = sp_runtime::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 = polymesh_runtime_common::BlockHashCount; /// The weight of database operations that the runtime can invoke. @@ -82,18 +82,18 @@ macro_rules! misc_pallet_impls { type OnKilledAccount = (); /// The data to be stored in an account. type AccountData = polymesh_common_utilities::traits::balances::AccountData; - type SystemWeightInfo = polymesh_weights::frame_system::WeightInfo; + type SystemWeightInfo = polymesh_weights::frame_system::SubstrateWeight; type OnSetCode = (); type MaxConsumers = frame_support::traits::ConstU32<16>; } impl pallet_base::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type MaxLen = MaxLen; } impl pallet_babe::Config for Runtime { - type WeightInfo = polymesh_weights::pallet_babe::WeightInfo; + type WeightInfo = polymesh_weights::pallet_babe::SubstrateWeight; type EpochDuration = EpochDuration; type ExpectedBlockTime = ExpectedBlockTime; type EpochChangeTrigger = pallet_babe::ExternalTrigger; @@ -123,27 +123,28 @@ macro_rules! misc_pallet_impls { type AccountIndex = polymesh_primitives::AccountIndex; type Currency = Balances; type Deposit = IndexDeposit; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_indices::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_indices::SubstrateWeight; } - impl<'a> core::convert::TryFrom<&'a Call> + impl<'a> core::convert::TryFrom<&'a RuntimeCall> for polymesh_runtime_common::fee_details::Call<'a, Runtime> { type Error = (); - fn try_from(call: &'a Call) -> Result { + fn try_from(call: &'a RuntimeCall) -> Result { use polymesh_runtime_common::fee_details::Call::*; Ok(match call { - Call::Identity(x) => Identity(x), - Call::Bridge(x) => Bridge(x), - Call::MultiSig(x) => MultiSig(x), - Call::Relayer(x) => Relayer(x), + RuntimeCall::Identity(x) => Identity(x), + RuntimeCall::Bridge(x) => Bridge(x), + RuntimeCall::MultiSig(x) => MultiSig(x), + RuntimeCall::Relayer(x) => Relayer(x), _ => return Err(()), }) } } impl pallet_transaction_payment::Config for Runtime { + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; @@ -165,18 +166,18 @@ macro_rules! misc_pallet_impls { impl pallet_balances::Config for Runtime { type MaxLocks = MaxLocks; type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type AccountStore = frame_system::Pallet; type CddChecker = polymesh_runtime_common::cdd_check::CddChecker; - type WeightInfo = polymesh_weights::pallet_balances::WeightInfo; + type WeightInfo = polymesh_weights::pallet_balances::SubstrateWeight; } impl pallet_protocol_fee::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type OnProtocolFeePayment = DealWithFees; - type WeightInfo = polymesh_weights::pallet_protocol_fee::WeightInfo; + type WeightInfo = polymesh_weights::pallet_protocol_fee::SubstrateWeight; type Subsidiser = Relayer; } @@ -184,7 +185,7 @@ macro_rules! misc_pallet_impls { type Moment = polymesh_primitives::Moment; type OnTimestampSet = Babe; type MinimumPeriod = MinimumPeriod; - type WeightInfo = polymesh_weights::pallet_timestamp::WeightInfo; + type WeightInfo = polymesh_weights::pallet_timestamp::SubstrateWeight; } impl pallet_authorship::Config for Runtime { @@ -204,7 +205,7 @@ macro_rules! misc_pallet_impls { } impl pallet_session::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ValidatorId = polymesh_primitives::AccountId; type ValidatorIdOf = pallet_staking::StashOf; type ShouldEndSession = Babe; @@ -213,7 +214,7 @@ macro_rules! misc_pallet_impls { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; - type WeightInfo = polymesh_weights::pallet_session::WeightInfo; + type WeightInfo = polymesh_weights::pallet_session::SubstrateWeight; } impl pallet_session::historical::Config for Runtime { @@ -230,7 +231,7 @@ macro_rules! misc_pallet_impls { type UnixTime = Timestamp; type CurrencyToVote = frame_support::traits::U128CurrencyToVote; type RewardRemainder = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Slash = Treasury; // send the slashed funds to the treasury. type Reward = (); // rewards are minted from the void type SessionsPerEra = SessionsPerEra; @@ -241,7 +242,7 @@ macro_rules! misc_pallet_impls { type RewardCurve = RewardCurve; type NextNewSession = Session; type ElectionLookahead = ElectionLookahead; - type Call = Call; + type Call = RuntimeCall; type MaxIterations = MaxIterations; type MinSolutionScoreBump = MinSolutionScoreBump; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; @@ -259,7 +260,7 @@ macro_rules! misc_pallet_impls { // The unsigned solution weight targeted by the OCW. We set it to the maximum possible value of // a single extrinsic. type OffchainSolutionWeightLimit = polymesh_runtime_common::OffchainSolutionWeightLimit; - type WeightInfo = polymesh_weights::pallet_staking::WeightInfo; + type WeightInfo = polymesh_weights::pallet_staking::SubstrateWeight; } impl pallet_authority_discovery::Config for Runtime { @@ -267,48 +268,48 @@ macro_rules! misc_pallet_impls { } impl pallet_sudo::Config for Runtime { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; } impl pallet_multisig::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Scheduler = Scheduler; - type SchedulerCall = Call; - type WeightInfo = polymesh_weights::pallet_multisig::WeightInfo; + type SchedulerCall = RuntimeCall; + type WeightInfo = polymesh_weights::pallet_multisig::SubstrateWeight; } impl pallet_bridge::Config for Runtime { - type Event = Event; - type Proposal = Call; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; type Scheduler = Scheduler; } impl pallet_portfolio::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Asset = Asset; - type WeightInfo = polymesh_weights::pallet_portfolio::WeightInfo; + type WeightInfo = polymesh_weights::pallet_portfolio::SubstrateWeight; type MaxNumberOfFungibleMoves = MaxNumberOfFungibleMoves; type MaxNumberOfNFTsMoves = MaxNumberOfNFTsMoves; } impl pallet_external_agents::Config for Runtime { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_external_agents::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_external_agents::SubstrateWeight; } impl pallet_relayer::Config for Runtime { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_relayer::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_relayer::SubstrateWeight; } impl pallet_rewards::Config for Runtime { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_rewards::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_rewards::SubstrateWeight; } impl pallet_asset::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type ComplianceManager = pallet_compliance_manager::Module; type UnixTime = pallet_timestamp::Pallet; @@ -318,23 +319,23 @@ macro_rules! misc_pallet_impls { type AssetMetadataValueMaxLength = AssetMetadataValueMaxLength; type AssetMetadataTypeDefMaxLength = AssetMetadataTypeDefMaxLength; type AssetFn = Asset; - type WeightInfo = polymesh_weights::pallet_asset::WeightInfo; - type CPWeightInfo = polymesh_weights::pallet_checkpoint::WeightInfo; + type WeightInfo = polymesh_weights::pallet_asset::SubstrateWeight; + type CPWeightInfo = polymesh_weights::pallet_checkpoint::SubstrateWeight; type NFTFn = pallet_nft::Module; } impl polymesh_contracts::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type MaxInLen = MaxInLen; type MaxOutLen = MaxOutLen; - type WeightInfo = polymesh_weights::polymesh_contracts::WeightInfo; + type WeightInfo = polymesh_weights::polymesh_contracts::SubstrateWeight; } impl pallet_contracts::Config for Runtime { type Time = Timestamp; type Randomness = RandomnessCollectiveFlip; type Currency = Balances; - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; // The `CallFilter` ends up being used in `ext.call_runtime()`, // via the `seal_call_runtime` feature, // which won't swap the current identity, @@ -345,56 +346,58 @@ macro_rules! misc_pallet_impls { type CallStack = [pallet_contracts::Frame; 31]; type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = pallet_contracts::weights::SubstrateWeight; - type ChainExtension = polymesh_contracts::Pallet; + type ChainExtension = polymesh_contracts::PolymeshExtension; type Schedule = Schedule; type DeletionQueueDepth = DeletionQueueDepth; type DeletionWeightLimit = DeletionWeightLimit; type AddressGenerator = pallet_contracts::DefaultAddressGenerator; type PolymeshHooks = polymesh_contracts::ContractPolymeshHooks; + type MaxCodeLen = frame_support::traits::ConstU32<{ 128 * 1024 }>; + type MaxStorageKeyLen = frame_support::traits::ConstU32<128>; + type UnsafeUnstableInterface = frame_support::traits::ConstBool; } impl pallet_compliance_manager::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Asset = Asset; - type WeightInfo = polymesh_weights::pallet_compliance_manager::WeightInfo; + type WeightInfo = polymesh_weights::pallet_compliance_manager::SubstrateWeight; type MaxConditionComplexity = MaxConditionComplexity; } impl pallet_corporate_actions::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type MaxTargetIds = MaxTargetIds; type MaxDidWhts = MaxDidWhts; - type WeightInfo = polymesh_weights::pallet_corporate_actions::WeightInfo; - type BallotWeightInfo = polymesh_weights::pallet_corporate_ballot::WeightInfo; - type DistWeightInfo = polymesh_weights::pallet_capital_distribution::WeightInfo; + type WeightInfo = polymesh_weights::pallet_corporate_actions::SubstrateWeight; + type BallotWeightInfo = polymesh_weights::pallet_corporate_ballot::SubstrateWeight; + type DistWeightInfo = polymesh_weights::pallet_capital_distribution::SubstrateWeight; } impl pallet_statistics::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Asset = Asset; type MaxStatsPerAsset = MaxStatsPerAsset; type MaxTransferConditionsPerAsset = MaxTransferConditionsPerAsset; - type WeightInfo = polymesh_weights::pallet_statistics::WeightInfo; + type WeightInfo = polymesh_weights::pallet_statistics::SubstrateWeight; } impl pallet_utility::Config for Runtime { - type Event = Event; - type Call = Call; - type WeightInfo = polymesh_weights::pallet_utility::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type Call = RuntimeCall; + type WeightInfo = polymesh_weights::pallet_utility::SubstrateWeight; } impl pallet_scheduler::Config for Runtime { - type Event = Event; - type Origin = Origin; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type PalletsOrigin = OriginCaller; - type Call = Call; + type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = polymesh_primitives::EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = polymesh_weights::pallet_scheduler::WeightInfo; + type WeightInfo = polymesh_weights::pallet_scheduler::SubstrateWeight; type OriginPrivilegeCmp = frame_support::traits::EqualPrivilegeOnly; - type PreimageProvider = Preimage; - type NoPreimagePostponement = NoPreimagePostponement; + type Preimages = Preimage; } parameter_types! { @@ -404,17 +407,16 @@ macro_rules! misc_pallet_impls { } impl pallet_preimage::Config for Runtime { - type WeightInfo = polymesh_weights::pallet_preimage::WeightInfo; - type Event = Event; + type WeightInfo = polymesh_weights::pallet_preimage::SubstrateWeight; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type ManagerOrigin = polymesh_primitives::EnsureRoot; - type MaxSize = PreimageMaxSize; type BaseDeposit = PreimageBaseDeposit; type ByteDeposit = PreimageByteDeposit; } impl pallet_offences::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type IdentificationTuple = pallet_session::historical::IdentificationTuple; type OnOffenceHandler = Staking; } @@ -423,21 +425,19 @@ macro_rules! misc_pallet_impls { impl pallet_im_online::Config for Runtime { type AuthorityId = pallet_im_online::sr25519::AuthorityId; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type NextSessionRotation = Babe; type ValidatorSet = Historical; type UnsignedPriority = ImOnlineUnsignedPriority; type ReportUnresponsiveness = Offences; - type WeightInfo = polymesh_weights::pallet_im_online::WeightInfo; + type WeightInfo = polymesh_weights::pallet_im_online::SubstrateWeight; type MaxKeys = MaxKeys; type MaxPeerInHeartbeats = MaxPeerInHeartbeats; type MaxPeerDataEncodingSize = MaxPeerDataEncodingSize; } impl pallet_grandpa::Config for Runtime { - type WeightInfo = polymesh_weights::pallet_grandpa::WeightInfo; - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; type KeyOwnerProofSystem = Historical; @@ -452,30 +452,32 @@ macro_rules! misc_pallet_impls { Offences, ReportLongevity, >; + + type WeightInfo = (); type MaxAuthorities = MaxAuthorities; } impl pallet_randomness_collective_flip::Config for Runtime {} impl pallet_treasury::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; - type WeightInfo = polymesh_weights::pallet_treasury::WeightInfo; + type WeightInfo = polymesh_weights::pallet_treasury::SubstrateWeight; } impl pallet_settlement::Config for Runtime { - type Event = Event; - type Proposal = Call; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; type Scheduler = Scheduler; - type WeightInfo = polymesh_weights::pallet_settlement::WeightInfo; + type WeightInfo = polymesh_weights::pallet_settlement::SubstrateWeight; type MaxNumberOfFungibleAssets = MaxNumberOfFungibleAssets; type MaxNumberOfNFTsPerLeg = MaxNumberOfNFTsPerLeg; type MaxNumberOfNFTs = MaxNumberOfNFTs; } impl pallet_sto::Config for Runtime { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_sto::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_sto::SubstrateWeight; } impl polymesh_common_utilities::traits::permissions::Config for Runtime { @@ -484,16 +486,19 @@ macro_rules! misc_pallet_impls { impl frame_system::offchain::CreateSignedTransaction for Runtime where - Call: From, + RuntimeCall: From, { fn create_transaction< C: frame_system::offchain::AppCrypto, >( - call: Call, + call: RuntimeCall, public: ::Signer, account: polymesh_primitives::AccountId, nonce: polymesh_primitives::Index, - ) -> Option<(Call, ::SignaturePayload)> { + ) -> Option<( + RuntimeCall, + ::SignaturePayload, + )> { // take the biggest period possible. let period = polymesh_runtime_common::BlockHashCount::get() .checked_next_power_of_two() @@ -534,15 +539,15 @@ macro_rules! misc_pallet_impls { impl frame_system::offchain::SendTransactionTypes for Runtime where - Call: From, + RuntimeCall: From, { type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = Call; + type OverarchingCall = RuntimeCall; } impl pallet_nft::Config for Runtime { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_nft::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_nft::SubstrateWeight; type Compliance = pallet_compliance_manager::Module; type MaxNumberOfCollectionKeys = MaxNumberOfCollectionKeys; type MaxNumberOfNFTsCount = MaxNumberOfNFTsPerLeg; @@ -584,11 +589,11 @@ macro_rules! runtime_apis { pallet_permissions::StoreCallMetadata, ); /// Unchecked extrinsic type as expected by this runtime. - pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; + pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// The payload being signed in transactions. - pub type SignedPayload = generic::SignedPayload; + pub type SignedPayload = generic::SignedPayload; /// 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 = pallet_executive::Executive< Runtime, @@ -596,44 +601,13 @@ macro_rules! runtime_apis { frame_system::ChainContext, Runtime, AllPalletsWithSystem, - MigrationV4toV5, + ( + pallet_preimage::migration::v1::Migration, + pallet_scheduler::migration::v3::MigrateToV4, + pallet_contracts::Migration, + ) >; - // Trait needed for frame-system migration. - impl frame_system::migrations::V2ToV3 for Runtime { - type Pallet = frame_system::Pallet; - type AccountId = polymesh_primitives::AccountId; - type Index = polymesh_primitives::Index; - type AccountData = polymesh_common_utilities::traits::balances::AccountData; - } - - // This is needed because `UpgradedToTripleRefCount` is private. - frame_support::generate_storage_alias!( - System, UpgradedToTripleRefCount => Value< - bool, - frame_support::pallet_prelude::ValueQuery - > - ); - - // Polymesh V4 -> V5 runtime migrations. - pub struct MigrationV4toV5; - impl frame_support::traits::OnRuntimeUpgrade for MigrationV4toV5 { - fn on_runtime_upgrade() -> Weight { - let mut weight = 0; - // System migration. - if !UpgradedToTripleRefCount::get() { - weight = weight.saturating_add(frame_system::migrations::migrate_from_dual_to_triple_ref_count::()); - } - - // Scheduler migration. - if Scheduler::current_storage_version() < 3 { - weight = weight.saturating_add(Scheduler::migrate_v2_to_v3()); - } - - weight - } - } - sp_api::impl_runtime_apis! { impl sp_api::Core for Runtime { fn version() -> RuntimeVersion { @@ -726,17 +700,17 @@ macro_rules! runtime_apis { } impl sp_consensus_babe::BabeApi for Runtime { - fn configuration() -> sp_consensus_babe::BabeGenesisConfiguration { + fn configuration() -> sp_consensus_babe::BabeConfiguration { // The choice of `c` parameter (where `1 - c` represents the // probability of a slot being empty), is done in accordance to the // slot duration and expected target block time, for safely // resisting network delays of maximum two seconds. // - sp_consensus_babe::BabeGenesisConfiguration { + sp_consensus_babe::BabeConfiguration { slot_duration: Babe::slot_duration(), epoch_length: EpochDuration::get(), c: PRIMARY_PROBABILITY, - genesis_authorities: Babe::authorities().to_vec(), + authorities: Babe::authorities().to_vec(), randomness: Babe::randomness(), allowed_slots: sp_consensus_babe::AllowedSlots::PrimaryAndSecondaryPlainSlots, } @@ -790,7 +764,7 @@ macro_rules! runtime_apis { } } - impl pallet_contracts_rpc_runtime_api::ContractsApi< + impl pallet_contracts::ContractsApi< Block, polymesh_primitives::AccountId, Balance, @@ -801,22 +775,24 @@ macro_rules! runtime_apis { origin: polymesh_primitives::AccountId, dest: polymesh_primitives::AccountId, value: Balance, - gas_limit: u64, + gas_limit: Option, storage_deposit_limit: Option, input_data: Vec, ) -> pallet_contracts_primitives::ContractExecResult { - Contracts::bare_call(origin, dest, value, gas_limit, storage_deposit_limit, input_data, true) + let gas_limit = gas_limit.unwrap_or(polymesh_runtime_common::RuntimeBlockWeights::get().max_block); + Contracts::bare_call(origin, dest, value, gas_limit, storage_deposit_limit, input_data, true, pallet_contracts::Determinism::Deterministic) } fn instantiate( origin: polymesh_primitives::AccountId, value: Balance, - gas_limit: u64, + gas_limit: Option, storage_deposit_limit: Option, code: pallet_contracts_primitives::Code, data: Vec, salt: Vec, ) -> pallet_contracts_primitives::ContractInstantiateResult { + let gas_limit = gas_limit.unwrap_or(polymesh_runtime_common::RuntimeBlockWeights::get().max_block); Contracts::bare_instantiate(origin, value, gas_limit, storage_deposit_limit, code, data, salt, true) } @@ -824,13 +800,14 @@ macro_rules! runtime_apis { origin: polymesh_primitives::AccountId, code: Vec, storage_deposit_limit: Option, + determinism: pallet_contracts::Determinism, ) -> pallet_contracts_primitives::CodeUploadResult { - Contracts::bare_upload_code(origin, code, storage_deposit_limit) + Contracts::bare_upload_code(origin, code, storage_deposit_limit, determinism) } fn get_storage( address: polymesh_primitives::AccountId, - key: [u8; 32], + key: Vec, ) -> pallet_contracts_primitives::GetStorageResult { Contracts::get_storage(address, key) } @@ -848,6 +825,17 @@ macro_rules! runtime_apis { } } + impl node_rpc_runtime_api::transaction_payment::TransactionPaymentCallApi + for Runtime + { + fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo { + TransactionPayment::query_call_info(call, len) + } + fn query_call_fee_details(call: RuntimeCall, len: u32) -> pallet_transaction_payment::FeeDetails { + TransactionPayment::query_call_fee_details(call, len) + } + } + impl sp_session::SessionKeys for Runtime { fn generate_session_keys(seed: Option>) -> Vec { SessionKeys::generate(seed) diff --git a/pallets/runtime/develop/Cargo.toml b/pallets/runtime/develop/Cargo.toml index dfd42e00c1..45fd9410b0 100644 --- a/pallets/runtime/develop/Cargo.toml +++ b/pallets/runtime/develop/Cargo.toml @@ -53,10 +53,10 @@ log = "0.4.8" # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } sp-inherents = { version = "4.0.0-dev", default-features = false } @@ -67,11 +67,11 @@ sp-session = { version = "4.0.0-dev", default-features = false } sp-authority-discovery = { version = "4.0.0-dev", default-features = false } sp-transaction-pool = { version = "4.0.0-dev", default-features = false } sp-block-builder = { version = "4.0.0-dev", default-features = false } -sp-arithmetic = { version = "5.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } # pallet-authorship = { version = "4.0.0-dev", default-features = false } pallet-contracts = { version = "4.0.0-dev", default-features = false } -pallet-contracts-primitives = { version = "6.0.0", default-features = false } +pallet-contracts-primitives = { version = "7.0.0", default-features = false } pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } pallet-grandpa = { version = "4.0.0-dev", default-features = false } pallet-im-online = { version = "4.0.0-dev", default-features = false } @@ -89,13 +89,12 @@ frame-system = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } # Crypto -confidential_identity_core = { version = "1.0.1", default-features = false } +confidential_identity_core = { version = "1.1.0", default-features = false } # RPC frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } pallet-group-rpc-runtime-api = { path = "../../group/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { path = "../../protocol-fee/rpc/runtime-api", default-features = false } -pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } pallet-staking-rpc-runtime-api = { path = "../../staking/rpc/runtime-api", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } @@ -127,9 +126,10 @@ no_std = [ std = [ "u64_backend", "codec/std", - "frame-benchmarking/std", + "frame-benchmarking?/std", "frame-support/std", "frame-system-rpc-runtime-api/std", + "frame-system-benchmarking?/std", "frame-system/std", "node-rpc-runtime-api/std", "confidential_identity_core/std", @@ -143,7 +143,6 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - "pallet-contracts-rpc-runtime-api/std", "pallet-contracts/std", "pallet-corporate-actions/std", "pallet-executive/std", @@ -205,7 +204,7 @@ runtime-benchmarks = [ "getrandom/js", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", - "frame-system-benchmarking", + "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-babe/runtime-benchmarks", "pallet-indices/runtime-benchmarks", diff --git a/pallets/runtime/develop/src/lib.rs b/pallets/runtime/develop/src/lib.rs index 693f26b38b..d99bc60544 100644 --- a/pallets/runtime/develop/src/lib.rs +++ b/pallets/runtime/develop/src/lib.rs @@ -2,6 +2,10 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] +#[cfg(feature = "runtime-benchmarks")] +#[macro_use] +extern crate frame_benchmarking; + pub mod constants; pub mod runtime; @@ -15,9 +19,9 @@ pub use pallet_staking::StakerStatus; pub use runtime::{native_version, WASM_BINARY}; pub use runtime::{ - api, Asset, Authorship, Balances, BalancesCall, Bridge, Call, CheckedExtrinsic, MinimumPeriod, - ProtocolFee, Runtime, RuntimeApi, SessionKeys, System, SystemCall, TransactionPayment, - UncheckedExtrinsic, + api, Asset, Authorship, Balances, BalancesCall, Bridge, CheckedExtrinsic, MinimumPeriod, + ProtocolFee, Runtime, RuntimeApi, RuntimeCall, SessionKeys, System, SystemCall, + TransactionPayment, UncheckedExtrinsic, }; pub use sp_runtime::{Perbill, Permill}; diff --git a/pallets/runtime/develop/src/runtime.rs b/pallets/runtime/develop/src/runtime.rs index 126a7649cb..70aad8b450 100644 --- a/pallets/runtime/develop/src/runtime.rs +++ b/pallets/runtime/develop/src/runtime.rs @@ -56,7 +56,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 5_003_000, + spec_version: 5_004_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 3, @@ -124,14 +124,13 @@ parameter_types! { // Scheduler: pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; - pub const NoPreimagePostponement: Option = Some(10); // Identity: pub const InitialPOLYX: Balance = 0; // Contracts: pub Schedule: pallet_contracts::Schedule = Default::default(); - pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionWeightLimit: Weight = Weight::from_ref_time(500_000_000_000); pub DeletionQueueDepth: u32 = 1024; pub MaxInLen: u32 = 8 * 1024; pub MaxOutLen: u32 = 8 * 1024; @@ -191,19 +190,19 @@ polymesh_runtime_common::misc_pallet_impls!(); pub type CddHandler = polymesh_runtime_common::fee_details::DevCddHandler; -impl<'a> TryFrom<&'a Call> for &'a pallet_test_utils::Call { +impl<'a> TryFrom<&'a RuntimeCall> for &'a pallet_test_utils::Call { type Error = (); - fn try_from(call: &'a Call) -> Result<&'a pallet_test_utils::Call, ()> { + fn try_from(call: &'a RuntimeCall) -> Result<&'a pallet_test_utils::Call, ()> { match call { - Call::TestUtils(x) => Ok(x), + RuntimeCall::TestUtils(x) => Ok(x), _ => Err(()), } } } impl polymesh_common_utilities::traits::identity::Config for Runtime { - type Event = Event; - type Proposal = Call; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; type MultiSig = MultiSig; type Portfolio = Portfolio; type CddServiceProviders = CddServiceProviders; @@ -214,7 +213,7 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { type OffChainSignature = MultiSignature; type ProtocolFee = pallet_protocol_fee::Module; type GCVotingMajorityOrigin = VMO; - type WeightInfo = polymesh_weights::pallet_identity::WeightInfo; + type WeightInfo = polymesh_weights::pallet_identity::SubstrateWeight; type IdentityFn = pallet_identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; @@ -222,17 +221,17 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { } impl pallet_committee::Config for Runtime { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; type CommitteeOrigin = VMO; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } /// PolymeshCommittee as an instance of group impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = polymesh_primitives::EnsureRoot; type AddOrigin = Self::LimitOrigin; type RemoveOrigin = Self::LimitOrigin; @@ -240,22 +239,22 @@ impl pallet_group::Config for Runtime { type ResetOrigin = Self::LimitOrigin; type MembershipInitialized = PolymeshCommittee; type MembershipChanged = PolymeshCommittee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } macro_rules! committee_config { ($committee:ident, $instance:ident) => { impl pallet_committee::Config for Runtime { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; // Can act upon itself. type CommitteeOrigin = VMO; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; // Committee cannot alter its own active membership limit. type LimitOrigin = polymesh_primitives::EnsureRoot; // Can manage its own addition, deletion, and swapping of membership... @@ -266,7 +265,7 @@ macro_rules! committee_config { type ResetOrigin = VMO; type MembershipInitialized = $committee; type MembershipChanged = $committee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } }; } @@ -280,15 +279,15 @@ impl pallet_pips::Config for Runtime { type GovernanceCommittee = PolymeshCommittee; type TechnicalCommitteeVMO = VMO; type UpgradeCommitteeVMO = VMO; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_pips::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_pips::SubstrateWeight; type Scheduler = Scheduler; - type SchedulerCall = Call; + type SchedulerCall = RuntimeCall; } /// CddProviders instance of group impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; // Cannot alter its own active membership limit. type LimitOrigin = polymesh_primitives::EnsureRoot; type AddOrigin = polymesh_primitives::EnsureRoot; @@ -297,12 +296,12 @@ impl pallet_group::Config for Runtime { type ResetOrigin = polymesh_primitives::EnsureRoot; type MembershipInitialized = Identity; type MembershipChanged = Identity; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } impl pallet_test_utils::Config for Runtime { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_test_utils::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_test_utils::SubstrateWeight; } /// NB It is needed by benchmarks, in order to use `UserBuilder`. @@ -316,6 +315,49 @@ impl TestUtilsFn for Runtime { } } +#[cfg(feature = "runtime-benchmarks")] +#[macro_use] +mod benches { + define_benchmarks!( + [frame_benchmarking, BaselineBench::] + [pallet_asset, Asset] + [pallet_balances, Balances] + [pallet_identity, Identity] + [pallet_pips, Pips] + [pallet_multisig, MultiSig] + [pallet_portfolio, Portfolio] + [pallet_protocol_fee, ProtocolFee] + [frame_system, SystemBench::] + [pallet_timestamp, Timestamp] + [pallet_settlement, Settlement] + [pallet_sto, Sto] + [pallet_checkpoint, Checkpoint] + [pallet_compliance_manager, ComplianceManager] + [pallet_corporate_actions, CorporateAction] + [pallet_corporate_ballot, CorporateBallot] + [pallet_capital_distribution, CapitalDistribution] + [pallet_external_agents, ExternalAgents] + [pallet_relayer, Relayer] + [pallet_committee, PolymeshCommittee] + [pallet_utility, Utility] + [pallet_treasury, Treasury] + [pallet_im_online, ImOnline] + [pallet_group, CddServiceProviders] + [pallet_statistics, Statistics] + [pallet_permissions, Permissions] + [pallet_preimage, Preimage] + [pallet_babe, Babe] + [pallet_indices, Indices] + [pallet_session, SessionBench::] + [pallet_grandpa, Grandpa] + [pallet_scheduler, Scheduler] + [pallet_staking, Staking] + [pallet_test_utils, TestUtils] + [polymesh_contracts, PolymeshContracts] + [pallet_nft, Nft] + ); +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -332,7 +374,7 @@ construct_runtime!( Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, + TransactionPayment: pallet_transaction_payment::{Pallet, Event, Storage}, // Identity: Genesis config deps: Timestamp. Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, @@ -417,12 +459,14 @@ polymesh_runtime_common::runtime_apis! { fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; + use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey}; - type SystemBench = frame_system_benchmarking::Pallet; - type SessionBench = crate::benchmarks::pallet_session::Pallet; + use crate::benchmarks::pallet_session::Pallet as SessionBench; + use frame_system_benchmarking::Pallet as SystemBench; + use baseline::Pallet as BaselineBench; impl frame_system_benchmarking::Config for Runtime {} + impl baseline::Config for Runtime {} impl crate::benchmarks::pallet_session::Config for Runtime {} let whitelist: Vec = vec![ @@ -442,44 +486,7 @@ polymesh_runtime_common::runtime_apis! { let mut batches = Vec::::new(); let params = (&config, &whitelist); - - add_benchmark!(params, batches, pallet_asset, Asset); - add_benchmark!(params, batches, pallet_balances, Balances); - add_benchmark!(params, batches, pallet_identity, Identity); - add_benchmark!(params, batches, pallet_pips, Pips); - add_benchmark!(params, batches, pallet_multisig, MultiSig); - add_benchmark!(params, batches, pallet_portfolio, Portfolio); - add_benchmark!(params, batches, pallet_protocol_fee, ProtocolFee); - add_benchmark!(params, batches, frame_system, SystemBench); - add_benchmark!(params, batches, pallet_timestamp, Timestamp); - add_benchmark!(params, batches, pallet_settlement, Settlement); - add_benchmark!(params, batches, pallet_sto, Sto); - add_benchmark!(params, batches, pallet_checkpoint, Checkpoint); - add_benchmark!(params, batches, pallet_compliance_manager, ComplianceManager); - add_benchmark!(params, batches, pallet_corporate_actions, CorporateAction); - add_benchmark!(params, batches, pallet_corporate_ballot, CorporateBallot); - add_benchmark!(params, batches, pallet_capital_distribution, CapitalDistribution); - add_benchmark!(params, batches, pallet_external_agents, ExternalAgents); - add_benchmark!(params, batches, pallet_relayer, Relayer); - add_benchmark!(params, batches, pallet_committee, PolymeshCommittee); - add_benchmark!(params, batches, pallet_utility, Utility); - add_benchmark!(params, batches, pallet_treasury, Treasury); - add_benchmark!(params, batches, pallet_im_online, ImOnline); - add_benchmark!(params, batches, pallet_group, CddServiceProviders); - add_benchmark!(params, batches, pallet_statistics, Statistics); - add_benchmark!(params, batches, pallet_permissions, Permissions); - add_benchmark!(params, batches, pallet_preimage, Preimage); - add_benchmark!(params, batches, pallet_babe, Babe); - add_benchmark!(params, batches, pallet_indices, Indices); - add_benchmark!(params, batches, pallet_session, SessionBench); - add_benchmark!(params, batches, pallet_grandpa, Grandpa); - add_benchmark!(params, batches, pallet_scheduler, Scheduler); - add_benchmark!(params, batches, pallet_staking, Staking); - add_benchmark!(params, batches, pallet_test_utils, TestUtils); - add_benchmark!(params, batches, polymesh_contracts, PolymeshContracts); - add_benchmark!(params, batches, pallet_nft, Nft); - - if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + add_benchmarks!(params, batches); Ok(batches) } @@ -487,48 +494,15 @@ polymesh_runtime_common::runtime_apis! { Vec, Vec, ) { + use frame_benchmarking::{baseline, Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; - use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList}; - type SystemBench = frame_system_benchmarking::Pallet; + use crate::benchmarks::pallet_session::Pallet as SessionBench; + use frame_system_benchmarking::Pallet as SystemBench; + use baseline::Pallet as BaselineBench; let mut list = Vec::::new(); - - list_benchmark!(list, extra, pallet_asset, Asset); - list_benchmark!(list, extra, pallet_balances, Balances); - list_benchmark!(list, extra, pallet_identity, Identity); - list_benchmark!(list, extra, pallet_pips, Pips); - list_benchmark!(list, extra, pallet_multisig, MultiSig); - list_benchmark!(list, extra, pallet_portfolio, Portfolio); - list_benchmark!(list, extra, pallet_protocol_fee, ProtocolFee); - list_benchmark!(list, extra, frame_system, SystemBench); - list_benchmark!(list, extra, pallet_timestamp, Timestamp); - list_benchmark!(list, extra, pallet_settlement, Settlement); - list_benchmark!(list, extra, pallet_sto, Sto); - list_benchmark!(list, extra, pallet_checkpoint, Checkpoint); - list_benchmark!(list, extra, pallet_compliance_manager, ComplianceManager); - list_benchmark!(list, extra, pallet_corporate_actions, CorporateAction); - list_benchmark!(list, extra, pallet_corporate_ballot, CorporateBallot); - list_benchmark!(list, extra, pallet_capital_distribution, CapitalDistribution); - list_benchmark!(list, extra, pallet_external_agents, ExternalAgents); - list_benchmark!(list, extra, pallet_relayer, Relayer); - list_benchmark!(list, extra, pallet_committee, PolymeshCommittee); - list_benchmark!(list, extra, pallet_utility, Utility); - list_benchmark!(list, extra, pallet_treasury, Treasury); - list_benchmark!(list, extra, pallet_im_online, ImOnline); - list_benchmark!(list, extra, pallet_group, CddServiceProviders); - list_benchmark!(list, extra, pallet_statistics, Statistics); - list_benchmark!(list, extra, pallet_permissions, Permissions); - list_benchmark!(list, extra, pallet_preimage, Preimage); - list_benchmark!(list, extra, pallet_babe, Babe); - list_benchmark!(list, extra, pallet_indices, Indices); - list_benchmark!(list, extra, pallet_session, SessionBench::); - list_benchmark!(list, extra, pallet_grandpa, Grandpa); - list_benchmark!(list, extra, pallet_scheduler, Scheduler); - list_benchmark!(list, extra, pallet_staking, Staking); - list_benchmark!(list, extra, pallet_test_utils, TestUtils); - list_benchmark!(list, extra, polymesh_contracts, PolymeshContracts); - list_benchmark!(list, extra, pallet_nft, Nft); + list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); diff --git a/pallets/runtime/extensions/Cargo.toml b/pallets/runtime/extensions/Cargo.toml index 2f7efaec35..19d67fbca7 100644 --- a/pallets/runtime/extensions/Cargo.toml +++ b/pallets/runtime/extensions/Cargo.toml @@ -18,8 +18,8 @@ frame-system = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } [features] default = ["std"] diff --git a/pallets/runtime/extensions/src/check_weight.rs b/pallets/runtime/extensions/src/check_weight.rs index 9eeaf6be27..732441a93f 100644 --- a/pallets/runtime/extensions/src/check_weight.rs +++ b/pallets/runtime/extensions/src/check_weight.rs @@ -19,7 +19,7 @@ // - Priority of a transaction is always zero. use codec::{Decode, Encode}; -use frame_support::weights::{DispatchClass, DispatchInfo, PostDispatchInfo}; +use frame_support::dispatch::{DispatchClass, DispatchInfo, PostDispatchInfo}; use frame_system::{CheckWeight as CW, Config}; use scale_info::TypeInfo; use sp_runtime::{ @@ -35,7 +35,7 @@ pub struct CheckWeight(CW); impl CheckWeight where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { /// Creates new `SignedExtension` to check weight of the extrinsic. pub fn new() -> Self { @@ -45,7 +45,7 @@ where /// Do the validate checks. This can be applied to both signed and unsigned. /// /// It only checks that the block weight and length limit will not exceed. - fn do_validate(info: &DispatchInfoOf, len: usize) -> TransactionValidity { + fn do_validate(info: &DispatchInfoOf, len: usize) -> TransactionValidity { let tv = CW::::do_validate(info, len)?; Ok(tv) } @@ -53,10 +53,10 @@ where impl SignedExtension for CheckWeight where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { type AccountId = T::AccountId; - type Call = T::Call; + type Call = T::RuntimeCall; type AdditionalSigned = (); type Pre = (); const IDENTIFIER: &'static str = "CheckWeight"; diff --git a/pallets/runtime/mainnet/Cargo.toml b/pallets/runtime/mainnet/Cargo.toml index 0f8628dd7e..65b75e6ebf 100644 --- a/pallets/runtime/mainnet/Cargo.toml +++ b/pallets/runtime/mainnet/Cargo.toml @@ -49,7 +49,6 @@ polymesh-contracts = { path = "../../contracts", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-staking-rpc-runtime-api = { package = "pallet-staking-rpc-runtime-api", path = "../../staking/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { package = "pallet-protocol-fee-rpc-runtime-api", path = "../../protocol-fee/rpc/runtime-api", default-features = false } -pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } # Others log = "0.4.8" @@ -67,7 +66,7 @@ pallet-authority-discovery = { version = "4.0.0-dev", default-features = false } pallet-authorship = { version = "4.0.0-dev", default-features = false } pallet-babe = { version = "4.0.0-dev", default-features = false } pallet-contracts = { version = "4.0.0-dev", default-features = false } -pallet-contracts-primitives = { version = "6.0.0", default-features = false} +pallet-contracts-primitives = { version = "7.0.0", default-features = false} pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } pallet-grandpa = { version = "4.0.0-dev", default-features = false } pallet-im-online = { version = "4.0.0-dev", default-features = false } @@ -81,23 +80,23 @@ pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false pallet-timestamp = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false } -sp-arithmetic = { version = "5.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } sp-authority-discovery = { version = "4.0.0-dev", default-features = false } sp-block-builder = { version = "4.0.0-dev", default-features = false } sp-consensus-babe = { version = "0.10.0-dev", default-features = false } -sp-core = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } sp-inherents = { version = "4.0.0-dev", default-features = false } -sp-io = { version = "6.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } sp-offchain = { version = "4.0.0-dev", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-session = { version = "4.0.0-dev", default-features = false } sp-staking = { version = "4.0.0-dev", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } sp-transaction-pool = { version = "4.0.0-dev", default-features = false } sp-version = { version = "5.0.0", default-features = false } # Crypto -confidential_identity_core = { version = "1.0.1", default-features = false } +confidential_identity_core = { version = "1.1.0", default-features = false } [build-dependencies] polymesh-build-tool = { path = "../build_tool", default-features = false } @@ -130,7 +129,6 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - "pallet-contracts-rpc-runtime-api/std", "pallet-contracts/std", "pallet-executive/std", "pallet-external-agents/std", diff --git a/pallets/runtime/mainnet/src/lib.rs b/pallets/runtime/mainnet/src/lib.rs index 4633c8acb0..10e1162613 100644 --- a/pallets/runtime/mainnet/src/lib.rs +++ b/pallets/runtime/mainnet/src/lib.rs @@ -11,8 +11,8 @@ pub use pallet_staking::StakerStatus; pub use runtime::{native_version, WASM_BINARY}; pub use runtime::{ - api, Asset, Authorship, Balances, BalancesCall, Bridge, Call, CheckedExtrinsic, MinimumPeriod, - ProtocolFee, Runtime, RuntimeApi, SessionKeys, SignedExtra, System, SystemCall, + api, Asset, Authorship, Balances, BalancesCall, Bridge, CheckedExtrinsic, MinimumPeriod, + ProtocolFee, Runtime, RuntimeApi, RuntimeCall, SessionKeys, SignedExtra, System, SystemCall, TransactionPayment, UncheckedExtrinsic, }; diff --git a/pallets/runtime/mainnet/src/runtime.rs b/pallets/runtime/mainnet/src/runtime.rs index 244e265eec..a9d37b6010 100644 --- a/pallets/runtime/mainnet/src/runtime.rs +++ b/pallets/runtime/mainnet/src/runtime.rs @@ -53,7 +53,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 5_003_000, + spec_version: 5_004_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 3, @@ -121,14 +121,13 @@ parameter_types! { // Scheduler: pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; - pub const NoPreimagePostponement: Option = Some(10); // Identity: pub const InitialPOLYX: Balance = 0; // Contracts: pub Schedule: pallet_contracts::Schedule = Default::default(); - pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionWeightLimit: Weight = Weight::from_ref_time(500_000_000_000); pub DeletionQueueDepth: u32 = 1024; pub MaxInLen: u32 = 8 * 1024; pub MaxOutLen: u32 = 8 * 1024; @@ -192,8 +191,8 @@ type CddHandler = polymesh_runtime_common::fee_details::CddHandler< >; impl polymesh_common_utilities::traits::identity::Config for Runtime { - type Event = Event; - type Proposal = Call; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; type MultiSig = MultiSig; type Portfolio = Portfolio; type CddServiceProviders = CddServiceProviders; @@ -204,7 +203,7 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { type OffChainSignature = MultiSignature; type ProtocolFee = pallet_protocol_fee::Module; type GCVotingMajorityOrigin = VMO; - type WeightInfo = polymesh_weights::pallet_identity::WeightInfo; + type WeightInfo = polymesh_weights::pallet_identity::SubstrateWeight; type IdentityFn = pallet_identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; @@ -212,17 +211,17 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { } impl pallet_committee::Config for Runtime { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; type CommitteeOrigin = VMO; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } /// PolymeshCommittee as an instance of group impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = polymesh_primitives::EnsureRoot; type AddOrigin = Self::LimitOrigin; type RemoveOrigin = Self::LimitOrigin; @@ -230,22 +229,22 @@ impl pallet_group::Config for Runtime { type ResetOrigin = Self::LimitOrigin; type MembershipInitialized = PolymeshCommittee; type MembershipChanged = PolymeshCommittee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } macro_rules! committee_config { ($committee:ident, $instance:ident) => { impl pallet_committee::Config for Runtime { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; // Can act upon itself. type CommitteeOrigin = VMO; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; // Committee cannot alter its own active membership limit. type LimitOrigin = polymesh_primitives::EnsureRoot; // Can manage its own addition, deletion, and swapping of membership... @@ -256,7 +255,7 @@ macro_rules! committee_config { type ResetOrigin = VMO; type MembershipInitialized = $committee; type MembershipChanged = $committee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } }; } @@ -270,15 +269,15 @@ impl pallet_pips::Config for Runtime { type GovernanceCommittee = PolymeshCommittee; type TechnicalCommitteeVMO = VMO; type UpgradeCommitteeVMO = VMO; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_pips::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_pips::SubstrateWeight; type Scheduler = Scheduler; - type SchedulerCall = Call; + type SchedulerCall = RuntimeCall; } /// CddProviders instance of group impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = polymesh_primitives::EnsureRoot; type AddOrigin = polymesh_primitives::EnsureRoot; type RemoveOrigin = polymesh_primitives::EnsureRoot; @@ -286,7 +285,7 @@ impl pallet_group::Config for Runtime { type ResetOrigin = polymesh_primitives::EnsureRoot; type MembershipInitialized = Identity; type MembershipChanged = Identity; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } construct_runtime!( @@ -305,7 +304,7 @@ construct_runtime!( Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, + TransactionPayment: pallet_transaction_payment::{Pallet, Event, Storage}, // Identity: Genesis config deps: Timestamp. Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, diff --git a/pallets/runtime/testnet/Cargo.toml b/pallets/runtime/testnet/Cargo.toml index 3a8a39cdde..f45d9ca3cc 100644 --- a/pallets/runtime/testnet/Cargo.toml +++ b/pallets/runtime/testnet/Cargo.toml @@ -50,10 +50,9 @@ polymesh-contracts = { path = "../../contracts", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-staking-rpc-runtime-api = { package = "pallet-staking-rpc-runtime-api", path = "../../staking/rpc/runtime-api", default-features = false } pallet-protocol-fee-rpc-runtime-api = { package = "pallet-protocol-fee-rpc-runtime-api", path = "../../protocol-fee/rpc/runtime-api", default-features = false } -pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } # Crypto -confidential_identity_core = { version = "1.0.1", default-features = false } +confidential_identity_core = { version = "1.1.0", default-features = false } # Others lazy_static = { version = "1.4.0", default-features = false } @@ -64,10 +63,10 @@ serde_derive = { version = "1.0.104", optional = true } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } sp-inherents = { version = "4.0.0-dev", default-features = false } @@ -78,11 +77,11 @@ sp-session = { version = "4.0.0-dev", default-features = false } sp-authority-discovery = { version = "4.0.0-dev", default-features = false } sp-transaction-pool = { version = "4.0.0-dev", default-features = false } sp-block-builder = { version = "4.0.0-dev", default-features = false } -sp-arithmetic = { version = "5.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } pallet-authorship = { version = "4.0.0-dev", default-features = false } pallet-contracts = { version = "4.0.0-dev", default-features = false } -pallet-contracts-primitives = { version = "6.0.0", default-features = false} +pallet-contracts-primitives = { version = "7.0.0", default-features = false} pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } pallet-grandpa = { version = "4.0.0-dev", default-features = false } pallet-im-online = { version = "4.0.0-dev", default-features = false } @@ -131,7 +130,6 @@ std = [ "pallet-bridge/std", "pallet-committee/std", "pallet-compliance-manager/std", - "pallet-contracts-rpc-runtime-api/std", "pallet-contracts/std", "pallet-executive/std", "pallet-external-agents/std", diff --git a/pallets/runtime/testnet/src/lib.rs b/pallets/runtime/testnet/src/lib.rs index f069b153b4..d07b455184 100644 --- a/pallets/runtime/testnet/src/lib.rs +++ b/pallets/runtime/testnet/src/lib.rs @@ -14,9 +14,9 @@ pub use runtime::{native_version, WASM_BINARY}; pub use runtime::DryRunRuntimeUpgrade; pub use runtime::{ - api, Asset, Authorship, Balances, BalancesCall, Bridge, Call, CheckedExtrinsic, MinimumPeriod, - ProtocolFee, Runtime, RuntimeApi, SessionKeys, System, SystemCall, TransactionPayment, - UncheckedExtrinsic, + api, Asset, Authorship, Balances, BalancesCall, Bridge, CheckedExtrinsic, MinimumPeriod, + ProtocolFee, Runtime, RuntimeApi, RuntimeCall, SessionKeys, System, SystemCall, + TransactionPayment, UncheckedExtrinsic, }; pub use sp_runtime::{Perbill, Permill}; diff --git a/pallets/runtime/testnet/src/runtime.rs b/pallets/runtime/testnet/src/runtime.rs index f319be115d..78293076a0 100644 --- a/pallets/runtime/testnet/src/runtime.rs +++ b/pallets/runtime/testnet/src/runtime.rs @@ -58,7 +58,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { authoring_version: 1, // `spec_version: aaa_bbb_ccd` should match node version v`aaa.bbb.cc` // N.B. `d` is unpinned from the binary version - spec_version: 5_003_000, + spec_version: 5_004_000, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 3, @@ -127,14 +127,13 @@ parameter_types! { // Scheduler: pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; - pub const NoPreimagePostponement: Option = Some(10); // Identity: pub const InitialPOLYX: Balance = 100_000 * ONE_POLY; // Contracts: pub Schedule: pallet_contracts::Schedule = Default::default(); - pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionWeightLimit: Weight = Weight::from_ref_time(500_000_000_000); pub DeletionQueueDepth: u32 = 1024; pub MaxInLen: u32 = 8 * 1024; pub MaxOutLen: u32 = 8 * 1024; @@ -194,19 +193,19 @@ polymesh_runtime_common::misc_pallet_impls!(); type CddHandler = polymesh_runtime_common::fee_details::DevCddHandler; -impl<'a> TryFrom<&'a Call> for &'a pallet_test_utils::Call { +impl<'a> TryFrom<&'a RuntimeCall> for &'a pallet_test_utils::Call { type Error = (); - fn try_from(call: &'a Call) -> Result<&'a pallet_test_utils::Call, ()> { + fn try_from(call: &'a RuntimeCall) -> Result<&'a pallet_test_utils::Call, ()> { match call { - Call::TestUtils(x) => Ok(x), + RuntimeCall::TestUtils(x) => Ok(x), _ => Err(()), } } } impl polymesh_common_utilities::traits::identity::Config for Runtime { - type Event = Event; - type Proposal = Call; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; type MultiSig = MultiSig; type Portfolio = Portfolio; type CddServiceProviders = CddServiceProviders; @@ -217,7 +216,7 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { type OffChainSignature = MultiSignature; type ProtocolFee = pallet_protocol_fee::Module; type GCVotingMajorityOrigin = VMO; - type WeightInfo = polymesh_weights::pallet_identity::WeightInfo; + type WeightInfo = polymesh_weights::pallet_identity::SubstrateWeight; type IdentityFn = pallet_identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; @@ -225,17 +224,17 @@ impl polymesh_common_utilities::traits::identity::Config for Runtime { } impl pallet_committee::Config for Runtime { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; type CommitteeOrigin = VMO; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } /// PolymeshCommittee as an instance of group impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = polymesh_primitives::EnsureRoot; type AddOrigin = Self::LimitOrigin; type RemoveOrigin = Self::LimitOrigin; @@ -243,22 +242,22 @@ impl pallet_group::Config for Runtime { type ResetOrigin = Self::LimitOrigin; type MembershipInitialized = PolymeshCommittee; type MembershipChanged = PolymeshCommittee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } macro_rules! committee_config { ($committee:ident, $instance:ident) => { impl pallet_committee::Config for Runtime { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; // Can act upon itself. type CommitteeOrigin = VMO; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; // Committee cannot alter its own active membership limit. type LimitOrigin = polymesh_primitives::EnsureRoot; // Can manage its own addition, deletion, and swapping of membership... @@ -269,7 +268,7 @@ macro_rules! committee_config { type ResetOrigin = VMO; type MembershipInitialized = $committee; type MembershipChanged = $committee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } }; } @@ -283,15 +282,15 @@ impl pallet_pips::Config for Runtime { type GovernanceCommittee = PolymeshCommittee; type TechnicalCommitteeVMO = VMO; type UpgradeCommitteeVMO = VMO; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_pips::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_pips::SubstrateWeight; type Scheduler = Scheduler; - type SchedulerCall = Call; + type SchedulerCall = RuntimeCall; } /// CddProviders instance of group impl pallet_group::Config for Runtime { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = polymesh_primitives::EnsureRoot; type AddOrigin = polymesh_primitives::EnsureRoot; type RemoveOrigin = polymesh_primitives::EnsureRoot; @@ -299,12 +298,12 @@ impl pallet_group::Config for Runtime { type ResetOrigin = polymesh_primitives::EnsureRoot; type MembershipInitialized = Identity; type MembershipChanged = Identity; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } impl pallet_test_utils::Config for Runtime { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_test_utils::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_test_utils::SubstrateWeight; } pub type AllModulesExported = AllPalletsWithSystem; @@ -326,7 +325,7 @@ construct_runtime!( Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Pallet, Storage}, + TransactionPayment: pallet_transaction_payment::{Pallet, Event, Storage}, // Identity: Genesis config deps: Timestamp. Identity: pallet_identity::{Pallet, Call, Storage, Event, Config}, diff --git a/pallets/runtime/tests/Cargo.toml b/pallets/runtime/tests/Cargo.toml index d6a2f48b13..47cff15777 100644 --- a/pallets/runtime/tests/Cargo.toml +++ b/pallets/runtime/tests/Cargo.toml @@ -5,8 +5,8 @@ authors = ["Polymath"] edition = "2021" [dependencies] -confidential_identity_v1 = { version = "1.0.1", default-features = false } -confidential_identity_core = { version = "1.0.1", default-features = false } +confidential_identity_v1 = { version = "1.1.0", default-features = false } +confidential_identity_core = { version = "1.1.0", default-features = false } node-rpc-runtime-api = { path = "../../../rpc/runtime-api", default-features = false } pallet-asset = { path = "../../asset", default-features = false } pallet-balances = { path = "../../balances", default-features = false } @@ -71,8 +71,7 @@ pallet-authority-discovery = { version = "4.0.0-dev", default-features = false } pallet-authorship = { version = "4.0.0-dev", default-features = false } pallet-babe = { version = "4.0.0-dev", default-features = false } pallet-contracts = { version = "4.0.0-dev", default-features = false } -pallet-contracts-primitives = { version = "6.0.0", default-features = false } -pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false } +pallet-contracts-primitives = { version = "7.0.0", default-features = false } pallet-executive = { package = "frame-executive", version = "4.0.0-dev", default-features = false } pallet-grandpa = { version = "4.0.0-dev", default-features = false } pallet-im-online = { version = "4.0.0-dev", default-features = false } @@ -86,23 +85,23 @@ pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false pallet-timestamp = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } sp-api = { version = "4.0.0-dev", default-features = false } -sp-arithmetic = { version = "5.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } sp-authority-discovery = { version = "4.0.0-dev", default-features = false } sp-block-builder = { version = "4.0.0-dev", default-features = false } sp-consensus-babe = { version = "0.10.0-dev", default-features = false } -sp-core = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } sp-inherents = { version = "4.0.0-dev", default-features = false } -sp-io = { version = "6.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } sp-npos-elections = { version = "4.0.0-dev", default-features = false } sp-offchain = { version = "4.0.0-dev", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-session = { version = "4.0.0-dev", default-features = false } sp-staking = { version = "4.0.0-dev", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } sp-transaction-pool = { version = "4.0.0-dev", default-features = false } sp-version = { version = "5.0.0", default-features = false } -test_client = { package = "substrate-test-runtime-client", git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2", optional = true } +test_client = { package = "substrate-test-runtime-client", git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12", optional = true } substrate-test-utils = { version = "4.0.0-dev", optional = true } [dev-dependencies] diff --git a/pallets/runtime/tests/exec_macro/src/lib.rs b/pallets/runtime/tests/exec_macro/src/lib.rs index c06c40ce02..53ed65e811 100644 --- a/pallets/runtime/tests/exec_macro/src/lib.rs +++ b/pallets/runtime/tests/exec_macro/src/lib.rs @@ -61,7 +61,7 @@ pub fn exec(item: TokenStream) -> TokenStream { if *crate::storage::INTEGRATION_TEST { crate::storage::exec( #origin, - >::Call::#call_variant( + >::RuntimeCall::#call_variant( #params ) ) diff --git a/pallets/runtime/tests/src/asset_metadata_test.rs b/pallets/runtime/tests/src/asset_metadata_test.rs index 5babc7d85f..caf1a7b46f 100644 --- a/pallets/runtime/tests/src/asset_metadata_test.rs +++ b/pallets/runtime/tests/src/asset_metadata_test.rs @@ -14,7 +14,7 @@ use polymesh_primitives::{ }; use test_client::AccountKeyring; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Moment = ::Moment; type Timestamp = pallet_timestamp::Pallet; diff --git a/pallets/runtime/tests/src/asset_test.rs b/pallets/runtime/tests/src/asset_test.rs index 3c7c3835f8..49ef28d437 100644 --- a/pallets/runtime/tests/src/asset_test.rs +++ b/pallets/runtime/tests/src/asset_test.rs @@ -72,7 +72,7 @@ type ComplianceManager = compliance_manager::Module; type Portfolio = pallet_portfolio::Module; type AssetError = asset::Error; type OffChainSignature = AnySignature; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type DidRecords = identity::DidRecords; type Statistics = statistics::Module; type AssetGenesis = asset::GenesisConfig; diff --git a/pallets/runtime/tests/src/balances_test.rs b/pallets/runtime/tests/src/balances_test.rs index 9a3c20b4fb..5dbb9b6d85 100644 --- a/pallets/runtime/tests/src/balances_test.rs +++ b/pallets/runtime/tests/src/balances_test.rs @@ -10,8 +10,8 @@ use polymesh_runtime_develop::{runtime, Runtime}; use frame_support::{ assert_noop, assert_ok, + dispatch::{DispatchInfo, Weight}, traits::Currency, - weights::{DispatchInfo, Weight}, }; use frame_system::{EventRecord, Phase}; use pallet_transaction_payment::ChargeTransactionPayment; @@ -22,13 +22,13 @@ use test_client::AccountKeyring; pub type Balances = balances::Module; pub type System = frame_system::Pallet; type Identity = identity::Module; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Error = balances::Error; /// create a transaction info struct from weight. Handy to avoid building the whole struct. -pub fn info_from_weight(w: Weight) -> DispatchInfo { +pub fn info_from_weight(w: u64) -> DispatchInfo { DispatchInfo { - weight: w, + weight: Weight::from_ref_time(w), ..Default::default() } } @@ -46,7 +46,7 @@ fn signed_extension_charge_transaction_payment_work() { let alice_pub = AccountKeyring::Alice.to_account_id(); let alice_id = AccountKeyring::Alice.to_account_id(); - let call = runtime::Call::TestUtils(test_utils::Call::register_did { + let call = runtime::RuntimeCall::TestUtils(test_utils::Call::register_did { uid: InvestorUid::default(), secondary_keys: vec![], }); @@ -84,7 +84,7 @@ fn tipping_fails() { .monied(true) .build() .execute_with(|| { - let call = runtime::Call::TestUtils(test_utils::Call::register_did { + let call = runtime::RuntimeCall::TestUtils(test_utils::Call::register_did { uid: InvestorUid::default(), secondary_keys: vec![], }); diff --git a/pallets/runtime/tests/src/bridge.rs b/pallets/runtime/tests/src/bridge.rs index 331587e6ab..3a13460901 100644 --- a/pallets/runtime/tests/src/bridge.rs +++ b/pallets/runtime/tests/src/bridge.rs @@ -1,6 +1,6 @@ use super::{ fast_forward_blocks, next_block, - storage::{Call, TestStorage, User}, + storage::{RuntimeCall, TestStorage, User}, ExtBuilder, }; @@ -19,7 +19,7 @@ type Error = bridge::Error; type Identity = pallet_identity::Module; type Balances = pallet_balances::Module; type MultiSig = pallet_multisig::Module; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type System = frame_system::Pallet; type Scheduler = pallet_scheduler::Pallet; @@ -29,8 +29,8 @@ type BridgeTxDetail = GBridgeTxDetail; const AMOUNT: u128 = 1_000_000_000; const AMOUNT_OVER_LIMIT: u128 = 1_000_000_000_000_000_000_000; // Note: Need to update these weights after running benchmarks. -const WEIGHT_EXPECTED_1: u64 = 832478000; -const WEIGHT_EXPECTED_2: u64 = 1790018000; +const WEIGHT_EXPECTED_1: Weight = Weight::from_ref_time(1_033_932_994); +const WEIGHT_EXPECTED_2: Weight = Weight::from_ref_time(2_578_448_374); const MIN_SIGNS_REQUIRED: u64 = 2; fn test_with_controller(test: &dyn Fn(&[AccountId])) { @@ -75,8 +75,8 @@ fn alice_bridge_tx(amount: u128) -> BridgeTx { make_bridge_tx(Alice.to_account_id(), amount) } -fn bridge_tx_to_proposal(tx: &BridgeTx) -> Call { - Call::Bridge(bridge::Call::handle_bridge_tx { +fn bridge_tx_to_proposal(tx: &BridgeTx) -> RuntimeCall { + RuntimeCall::Bridge(bridge::Call::handle_bridge_tx { bridge_tx: tx.clone(), }) } @@ -125,12 +125,10 @@ fn signers_approve_bridge_tx(tx: BridgeTx, signers: &[AccountId]) -> BridgeTx { } fn advance_block_and_verify_alice_balance(offset: u32, expected_balance: u128) -> Weight { - (0..=offset) - .map(|_| { - assert_eq!(alice_balance(), expected_balance); - next_block() - }) - .sum() + (0..=offset).fold(Weight::zero(), |total, _| { + assert_eq!(alice_balance(), expected_balance); + total.saturating_add(next_block()) + }) } fn next_unlock_block_number() -> u32 { diff --git a/pallets/runtime/tests/src/committee_test.rs b/pallets/runtime/tests/src/committee_test.rs index 3eacea696a..a2022a321c 100644 --- a/pallets/runtime/tests/src/committee_test.rs +++ b/pallets/runtime/tests/src/committee_test.rs @@ -1,8 +1,8 @@ use super::{ ext_builder::{ExtBuilder, COOL_OFF_PERIOD}, storage::{ - fast_forward_blocks, get_identity_id, register_keyring_account, root, Call, EventTest, - TestStorage, + fast_forward_blocks, get_identity_id, register_keyring_account, root, EventTest, + RuntimeCall, TestStorage, }, }; use frame_support::{ @@ -26,7 +26,7 @@ type CommitteeGroup = group::Module; type System = frame_system::Pallet; type Identity = identity::Module; type Pips = pallet_pips::Module; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; #[test] fn motions_basic_environment_works() { @@ -53,8 +53,8 @@ fn motions_basic_environment_works_we() { assert_eq!(Committee::proposals(), vec![]); } -fn make_proposal(value: u64) -> Call { - Call::Identity(identity::Call::accept_primary_key { +fn make_proposal(value: u64) -> RuntimeCall { + RuntimeCall::Identity(identity::Call::accept_primary_key { rotation_auth_id: value, optional_cdd_auth_id: Some(value), }) @@ -99,8 +99,8 @@ fn check_scheduled(id: PipId) { assert_eq!(Pips::proposal_state(id).unwrap(), ProposalState::Scheduled); } -fn enact_snapshot_results_call() -> Call { - Call::Pips(pallet_pips::Call::enact_snapshot_results { +fn enact_snapshot_results_call() -> RuntimeCall { + RuntimeCall::Pips(pallet_pips::Call::enact_snapshot_results { results: APPROVE_0.into(), }) } @@ -301,7 +301,7 @@ fn changing_vote_threshold_works_we() { assert_eq!(Committee::vote_threshold(), (1, 1)); - let call_svt = Box::new(Call::PolymeshCommittee( + let call_svt = Box::new(RuntimeCall::PolymeshCommittee( pallet_committee::Call::set_vote_threshold { n: 4, d: 17 }, )); assert_ok!(Committee::vote_or_propose( @@ -512,8 +512,9 @@ fn release_coordinator_majority_we() { ); // Vote to change RC => bob. - let call = - Call::PolymeshCommittee(pallet_committee::Call::set_release_coordinator { id: bob_id }); + let call = RuntimeCall::PolymeshCommittee(pallet_committee::Call::set_release_coordinator { + id: bob_id, + }); assert_ok!(Committee::vote_or_propose( alice.clone(), true, diff --git a/pallets/runtime/tests/src/compliance_manager_test.rs b/pallets/runtime/tests/src/compliance_manager_test.rs index 73ae702aec..ab3dec6d55 100644 --- a/pallets/runtime/tests/src/compliance_manager_test.rs +++ b/pallets/runtime/tests/src/compliance_manager_test.rs @@ -35,7 +35,7 @@ type Asset = pallet_asset::Module; type ComplianceManager = compliance_manager::Module; type CDDGroup = group::Module; type Moment = u64; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type ExternalAgents = pallet_external_agents::Module; type EAError = pallet_external_agents::Error; diff --git a/pallets/runtime/tests/src/contracts_test.rs b/pallets/runtime/tests/src/contracts_test.rs index 16b919be86..e92cf9bacf 100644 --- a/pallets/runtime/tests/src/contracts_test.rs +++ b/pallets/runtime/tests/src/contracts_test.rs @@ -3,7 +3,9 @@ use crate::{ storage::{TestStorage, User}, }; use codec::Encode; -use frame_support::{assert_err_ignore_postinfo, assert_noop, assert_ok, assert_storage_noop}; +use frame_support::{ + assert_err_ignore_postinfo, assert_noop, assert_ok, assert_storage_noop, dispatch::Weight, +}; use polymesh_common_utilities::constants::currency::POLY; use polymesh_primitives::{AccountId, Gas, Permissions, PortfolioPermissions, Ticker}; use polymesh_runtime_common::Currency; @@ -15,7 +17,7 @@ use test_client::AccountKeyring; // and instead focus on the particulars of our contracts pallet. // This includes testing CDD, permissions, and what the chain extension does. -const GAS_LIMIT: Gas = 10_000_000_000; +const GAS_LIMIT: Gas = Weight::from_ref_time(100_000_000_000).set_proof_size(256 * 1024); type Asset = pallet_asset::Module; type FrameContracts = pallet_contracts::Pallet; diff --git a/pallets/runtime/tests/src/corporate_actions_test.rs b/pallets/runtime/tests/src/corporate_actions_test.rs index c4346bdcb3..41803b0556 100644 --- a/pallets/runtime/tests/src/corporate_actions_test.rs +++ b/pallets/runtime/tests/src/corporate_actions_test.rs @@ -37,7 +37,7 @@ use std::convert::TryInto; use test_client::AccountKeyring; type System = frame_system::Pallet; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Asset = pallet_asset::Module; type AssetError = pallet_asset::Error; type ExternalAgents = pallet_external_agents::Module; diff --git a/pallets/runtime/tests/src/ext_builder.rs b/pallets/runtime/tests/src/ext_builder.rs index fb8c2445e7..373e5405a3 100644 --- a/pallets/runtime/tests/src/ext_builder.rs +++ b/pallets/runtime/tests/src/ext_builder.rs @@ -1,5 +1,6 @@ use crate::TestStorage; use confidential_identity_v1::mocked::make_investor_uid; +use frame_support::dispatch::Weight; use pallet_asset::{self as asset, TickerRegistrationConfig}; use pallet_balances as balances; use pallet_bridge::BridgeTx; @@ -104,7 +105,7 @@ struct BridgeConfig { #[derive(Default)] pub struct ExtBuilder { /// Minimum weight for the extrinsic (see `weight_to_fee` below). - extrinsic_base_weight: u64, + extrinsic_base_weight: Weight, /// The transaction fee per byte. /// Transactions with bigger payloads will have a bigger `len_fee`. /// This is calculated as `transaction_byte_fee * tx.len()`. @@ -135,7 +136,7 @@ pub struct ExtBuilder { } thread_local! { - pub static EXTRINSIC_BASE_WEIGHT: RefCell = RefCell::new(0); + pub static EXTRINSIC_BASE_WEIGHT: RefCell = RefCell::new(Weight::zero()); pub static TRANSACTION_BYTE_FEE: RefCell = RefCell::new(0); pub static WEIGHT_TO_FEE: RefCell = RefCell::new(0); } @@ -143,7 +144,7 @@ thread_local! { impl ExtBuilder { /// Sets the minimum weight for the extrinsic (see also `weight_fee`). pub fn base_weight(mut self, extrinsic_base_weight: u64) -> Self { - self.extrinsic_base_weight = extrinsic_base_weight; + self.extrinsic_base_weight = Weight::from_ref_time(extrinsic_base_weight); self } diff --git a/pallets/runtime/tests/src/fee_details.rs b/pallets/runtime/tests/src/fee_details.rs index 4a02a2a7d2..4e6f6a6f28 100644 --- a/pallets/runtime/tests/src/fee_details.rs +++ b/pallets/runtime/tests/src/fee_details.rs @@ -10,14 +10,14 @@ use pallet_test_utils as test_utils; use polymesh_common_utilities::traits::transaction_payment::CddAndFeeDetails; use polymesh_common_utilities::Context; use polymesh_primitives::{InvestorUid, Signatory, TransactionError}; -use polymesh_runtime_develop::runtime::{Call, CddHandler}; +use polymesh_runtime_develop::runtime::{CddHandler, RuntimeCall}; use sp_runtime::transaction_validity::InvalidTransaction; use test_client::AccountKeyring; type MultiSig = multisig::Module; type Balances = balances::Module; type Identity = identity::Module; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; #[test] fn cdd_checks() { @@ -43,7 +43,7 @@ fn cdd_checks() { // register did bypasses cdd checks assert_eq!( CddHandler::get_valid_payer( - &Call::TestUtils(test_utils::Call::register_did { + &RuntimeCall::TestUtils(test_utils::Call::register_did { uid: InvestorUid::default(), secondary_keys: Default::default() }), @@ -58,7 +58,9 @@ fn cdd_checks() { // normal tx without cdd should fail assert_noop!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::change_sigs_required { sigs_required: 1 }), + &RuntimeCall::MultiSig(multisig::Call::change_sigs_required { + sigs_required: 1 + }), &alice_account ), InvalidTransaction::Custom(TransactionError::CddRequired as u8) @@ -70,7 +72,9 @@ fn cdd_checks() { // call to accept being a multisig signer should fail when invalid auth assert_noop!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key { auth_id: 0 }), + &RuntimeCall::MultiSig(multisig::Call::accept_multisig_signer_as_key { + auth_id: 0 + }), &alice_account ), InvalidTransaction::Custom(TransactionError::InvalidAuthorization as u8) @@ -86,7 +90,7 @@ fn cdd_checks() { let alice_auth_id = get_last_auth_id(&alice_key_signatory); assert_noop!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key { + &RuntimeCall::MultiSig(multisig::Call::accept_multisig_signer_as_key { auth_id: alice_auth_id }), &alice_account @@ -100,7 +104,7 @@ fn cdd_checks() { // call to remove authorisation with issuer paying should fail if issuer does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization { + &RuntimeCall::Identity(identity::Call::remove_authorization { target: alice_account_signatory.clone(), auth_id: alice_auth_id, _auth_issuer_pays: true @@ -113,7 +117,7 @@ fn cdd_checks() { // call to remove authorisation with caller paying should fail if caller does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization { + &RuntimeCall::Identity(identity::Call::remove_authorization { target: alice_account_signatory.clone(), auth_id: alice_auth_id, _auth_issuer_pays: false @@ -134,7 +138,7 @@ fn cdd_checks() { // call to remove authorisation with caller paying should fail if caller does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization { + &RuntimeCall::Identity(identity::Call::remove_authorization { target: alice_account_signatory.clone(), auth_id: alice_auth_id, _auth_issuer_pays: false @@ -147,7 +151,7 @@ fn cdd_checks() { // call to remove authorisation with issuer paying should succeed as issuer has CDD assert_eq!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization { + &RuntimeCall::Identity(identity::Call::remove_authorization { target: alice_account_signatory, auth_id: alice_auth_id, _auth_issuer_pays: true @@ -171,7 +175,7 @@ fn cdd_checks() { // call to remove authorisation with issuer paying should fail if issuer does not have a valid cdd assert_noop!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization { + &RuntimeCall::Identity(identity::Call::remove_authorization { target: charlie_account_signatory.clone(), auth_id: charlie_auth_id, _auth_issuer_pays: true @@ -184,7 +188,7 @@ fn cdd_checks() { // call to remove authorisation with caller paying should succeed as caller has CDD assert_eq!( CddHandler::get_valid_payer( - &Call::Identity(identity::Call::remove_authorization { + &RuntimeCall::Identity(identity::Call::remove_authorization { target: charlie_account_signatory, auth_id: charlie_auth_id, _auth_issuer_pays: false @@ -208,7 +212,7 @@ fn cdd_checks() { assert_eq!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::accept_multisig_signer_as_key { + &RuntimeCall::MultiSig(multisig::Call::accept_multisig_signer_as_key { auth_id: alice_auth_id }), &alice_account @@ -219,7 +223,9 @@ fn cdd_checks() { // normal tx with cdd should succeed assert_eq!( CddHandler::get_valid_payer( - &Call::MultiSig(multisig::Call::change_sigs_required { sigs_required: 1 }), + &RuntimeCall::MultiSig(multisig::Call::change_sigs_required { + sigs_required: 1 + }), &charlie_account ), Ok(Some(AccountKeyring::Charlie.to_account_id())) diff --git a/pallets/runtime/tests/src/group_test.rs b/pallets/runtime/tests/src/group_test.rs index e9ba448e42..da684b0a62 100644 --- a/pallets/runtime/tests/src/group_test.rs +++ b/pallets/runtime/tests/src/group_test.rs @@ -11,7 +11,7 @@ use frame_support::{assert_noop, assert_ok, dispatch::DispatchError}; use test_client::AccountKeyring; type CommitteeGroup = group::Module; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Identity = identity::Module; #[test] diff --git a/pallets/runtime/tests/src/identity_test.rs b/pallets/runtime/tests/src/identity_test.rs index 70bc9b1e84..009efd2cf2 100644 --- a/pallets/runtime/tests/src/identity_test.rs +++ b/pallets/runtime/tests/src/identity_test.rs @@ -39,7 +39,7 @@ use polymesh_primitives::{ PortfolioId, PortfolioNumber, Scope, SecondaryKey, Signatory, SubsetRestriction, Ticker, TransactionError, }; -use polymesh_runtime_develop::runtime::{Call, CddHandler}; +use polymesh_runtime_develop::runtime::{CddHandler, RuntimeCall}; use sp_core::H512; use sp_runtime::transaction_validity::InvalidTransaction; use std::convert::From; @@ -54,7 +54,7 @@ type MultiSig = pallet_multisig::Module; type System = frame_system::Pallet; type Timestamp = pallet_timestamp::Pallet; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type CddServiceProviders = ::CddServiceProviders; type Error = pallet_identity::Error; type PError = pallet_permissions::Error; @@ -476,7 +476,7 @@ fn frozen_secondary_keys_cdd_verification_test_we() { // 4. Bob should NOT transfer any amount. SE is simulated. // Balances::transfer_with_memo(Origin::signed(bob), charlie, 1_000, None), let payer = CddHandler::get_valid_payer( - &Call::Balances(balances::Call::transfer_with_memo { + &RuntimeCall::Balances(balances::Call::transfer_with_memo { dest: AccountKeyring::Charlie.to_account_id().into(), value: 1_000, memo: None, diff --git a/pallets/runtime/tests/src/multisig.rs b/pallets/runtime/tests/src/multisig.rs index 6338bc152b..0b7b91e565 100644 --- a/pallets/runtime/tests/src/multisig.rs +++ b/pallets/runtime/tests/src/multisig.rs @@ -3,7 +3,7 @@ use super::{ next_block, storage::{ add_secondary_key, get_last_auth_id, get_primary_key, get_secondary_keys, - register_keyring_account, set_curr_did, Call, TestStorage, User, + register_keyring_account, set_curr_did, RuntimeCall, TestStorage, User, }, ExtBuilder, }; @@ -17,7 +17,7 @@ type Balances = pallet_balances::Module; type Identity = pallet_identity::Module; type MultiSig = pallet_multisig::Module; type Timestamp = pallet_timestamp::Pallet; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type IdError = pallet_identity::Error; type Error = pallet_multisig::Error; type System = frame_system::Pallet; @@ -185,9 +185,9 @@ fn change_multisig_sigs_required() { assert_eq!(MultiSig::ms_signers(ms_address.clone(), bob_signer), true); - let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { - sigs_required: 1, - })); + let call = Box::new(RuntimeCall::MultiSig( + multisig::Call::change_sigs_required { sigs_required: 1 }, + )); set_curr_did(Some(alice_did)); assert_ok!(MultiSig::create_proposal_as_key( @@ -248,9 +248,9 @@ fn create_or_approve_change_multisig_sigs_required() { true ); assert_eq!(MultiSig::ms_signers(ms_address.clone(), bob_signer), true); - let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { - sigs_required: 1, - })); + let call = Box::new(RuntimeCall::MultiSig( + multisig::Call::change_sigs_required { sigs_required: 1 }, + )); assert_ok!(MultiSig::create_or_approve_proposal_as_key( bob.clone(), ms_address.clone(), @@ -328,9 +328,11 @@ fn remove_multisig_signer() { // No identity as multisig has not been set as a secondary / primary key assert_eq!(Identity::get_identity(&ms_address), None); - let call = Box::new(Call::MultiSig(multisig::Call::remove_multisig_signer { - signer: bob_signer.clone(), - })); + let call = Box::new(RuntimeCall::MultiSig( + multisig::Call::remove_multisig_signer { + signer: bob_signer.clone(), + }, + )); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), @@ -358,9 +360,11 @@ fn remove_multisig_signer() { set_curr_did(None); - let remove_alice = Box::new(Call::MultiSig(multisig::Call::remove_multisig_signer { - signer: alice_signer.clone(), - })); + let remove_alice = Box::new(RuntimeCall::MultiSig( + multisig::Call::remove_multisig_signer { + signer: alice_signer.clone(), + }, + )); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), @@ -412,7 +416,7 @@ fn add_multisig_signer() { false ); - let call = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer { + let call = Box::new(RuntimeCall::MultiSig(multisig::Call::add_multisig_signer { signer: bob_signer.clone(), })); @@ -426,7 +430,7 @@ fn add_multisig_signer() { next_block(); - let call2 = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer { + let call2 = Box::new(RuntimeCall::MultiSig(multisig::Call::add_multisig_signer { signer: charlie_signer.clone(), })); @@ -816,7 +820,7 @@ fn check_for_approval_closure() { false ); - let call = Box::new(Call::MultiSig(multisig::Call::add_multisig_signer { + let call = Box::new(RuntimeCall::MultiSig(multisig::Call::add_multisig_signer { signer: bob_signer.clone(), })); set_curr_did(Some(alice_did)); @@ -887,12 +891,12 @@ fn reject_proposals() { ], ); - let call1 = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { - sigs_required: 4, - })); - let call2 = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { - sigs_required: 5, - })); + let call1 = Box::new(RuntimeCall::MultiSig( + multisig::Call::change_sigs_required { sigs_required: 4 }, + )); + let call2 = Box::new(RuntimeCall::MultiSig( + multisig::Call::change_sigs_required { sigs_required: 5 }, + )); set_curr_did(Some(alice_did)); assert_ok!(MultiSig::create_proposal_as_identity( alice.clone(), @@ -1001,9 +1005,9 @@ fn expired_proposals() { ); let expires_at = 100u64; - let call = Box::new(Call::MultiSig(multisig::Call::change_sigs_required { - sigs_required: 2, - })); + let call = Box::new(RuntimeCall::MultiSig( + multisig::Call::change_sigs_required { sigs_required: 2 }, + )); set_curr_did(Some(alice_did)); assert_ok!(MultiSig::create_proposal_as_identity( diff --git a/pallets/runtime/tests/src/nft.rs b/pallets/runtime/tests/src/nft.rs index b6b6ffbebf..692ad51368 100644 --- a/pallets/runtime/tests/src/nft.rs +++ b/pallets/runtime/tests/src/nft.rs @@ -15,6 +15,7 @@ use polymesh_primitives::{ }; use test_client::AccountKeyring; +use super::asset_test::set_timestamp; use crate::ext_builder::ExtBuilder; use crate::storage::{TestStorage, User}; @@ -25,13 +26,12 @@ type NFT = pallet_nft::Module; type NFTError = pallet_nft::Error; type Portfolio = pallet_portfolio::Module; type PortfolioError = pallet_portfolio::Error; -type Timestamp = pallet_timestamp::Pallet; /// Successfully creates an NFT collection and an Asset. #[test] fn create_collection_unregistered_ticker() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -56,7 +56,7 @@ fn create_collection_unregistered_ticker() { #[test] fn create_collection_invalid_asset_type() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -85,7 +85,7 @@ fn create_collection_invalid_asset_type() { #[test] fn create_collection_already_registered() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -109,7 +109,7 @@ fn create_collection_already_registered() { #[test] fn create_collection_max_keys_exceeded() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -133,7 +133,7 @@ fn create_collection_max_keys_exceeded() { #[test] fn create_collection_duplicate_key() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -160,7 +160,7 @@ fn create_collection_duplicate_key() { #[test] fn create_collection_unregistered_key() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -221,7 +221,7 @@ pub(crate) fn create_nft_collection( #[test] fn mint_nft_collection_not_found() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -244,7 +244,7 @@ fn mint_nft_collection_not_found() { #[test] fn mint_nft_duplicate_key() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -285,7 +285,7 @@ fn mint_nft_duplicate_key() { #[test] fn mint_nft_wrong_number_of_keys() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -327,7 +327,7 @@ fn mint_nft_wrong_number_of_keys() { #[test] fn mint_nft_wrong_key() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -359,7 +359,7 @@ fn mint_nft_wrong_key() { #[test] fn mint_nft_portfolio_not_found() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -390,7 +390,7 @@ fn mint_nft_portfolio_not_found() { #[test] fn mint_nft_successfully() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -448,7 +448,7 @@ pub(crate) fn mint_nft( #[test] fn burn_nft_collection_not_found() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -464,7 +464,7 @@ fn burn_nft_collection_not_found() { #[test] fn burn_nft_not_found() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -488,7 +488,7 @@ fn burn_nft_not_found() { #[test] fn burn_nft() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let ticker: Ticker = Ticker::from_slice_truncated(b"TICKER".as_ref()); @@ -533,7 +533,7 @@ fn burn_nft() { #[test] fn transfer_nft_without_collection() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); let alice: User = User::new(AccountKeyring::Alice); let bob: User = User::new(AccountKeyring::Bob); @@ -561,7 +561,7 @@ fn transfer_nft_without_collection() { #[test] fn transfer_nft_same_portfolio() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); // Creates a collection let alice: User = User::new(AccountKeyring::Alice); @@ -598,7 +598,7 @@ fn transfer_nft_same_portfolio() { #[test] fn transfer_nft_invalid_count() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); // First we need to create a collection and mint one NFT let alice: User = User::new(AccountKeyring::Alice); @@ -646,7 +646,7 @@ fn transfer_nft_invalid_count() { #[test] fn transfer_nft_not_owned() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); // First we need to create a collection and mint one NFT let alice: User = User::new(AccountKeyring::Alice); @@ -694,7 +694,7 @@ fn transfer_nft_not_owned() { #[test] fn transfer_nft_failing_compliance() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); // First we need to create a collection and mint one NFT let alice: User = User::new(AccountKeyring::Alice); @@ -742,7 +742,7 @@ fn transfer_nft_failing_compliance() { #[test] fn transfer_nft() { ExtBuilder::default().build().execute_with(|| { - Timestamp::set_timestamp(Utc::now().timestamp() as _); + set_timestamp(Utc::now().timestamp() as _); // First we need to create a collection and mint one NFT let alice: User = User::new(AccountKeyring::Alice); diff --git a/pallets/runtime/tests/src/pips_test.rs b/pallets/runtime/tests/src/pips_test.rs index 8563586301..953e7d997d 100644 --- a/pallets/runtime/tests/src/pips_test.rs +++ b/pallets/runtime/tests/src/pips_test.rs @@ -3,7 +3,7 @@ use super::{ asset_test::max_len_bytes, committee_test::{gc_vmo, set_members}, storage::{ - fast_forward_blocks, make_remark_proposal, root, Call, EventTest, TestStorage, User, + fast_forward_blocks, make_remark_proposal, root, EventTest, RuntimeCall, TestStorage, User, }, ExtBuilder, }; @@ -22,6 +22,7 @@ use pallet_pips::{ use pallet_treasury as treasury; use polymesh_common_utilities::{MaybeBlock, GC_DID}; use polymesh_primitives::{AccountId, BlockNumber, Url}; +use std::ops::Deref; use test_client::AccountKeyring; type System = frame_system::Pallet; @@ -36,7 +37,7 @@ type Votes = pallet_pips::ProposalVotes; type Scheduler = pallet_scheduler::Pallet; type Agenda = pallet_scheduler::Agenda; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; macro_rules! assert_last_event { ($event:pat) => { @@ -79,8 +80,8 @@ fn spip(id: u32, dir: bool, power: u128) -> SnapshottedPip { } } -fn make_proposal(value: u64) -> Call { - Call::Pips(pallet_pips::Call::set_min_proposal_deposit { +fn make_proposal(value: u64) -> RuntimeCall { + RuntimeCall::Pips(pallet_pips::Call::set_min_proposal_deposit { deposit: value.into(), }) } @@ -88,7 +89,7 @@ fn make_proposal(value: u64) -> Call { fn proposal( signer: &Origin, proposer: &Proposer, - proposal: Call, + proposal: RuntimeCall, deposit: u128, url: Option, desc: Option, @@ -148,7 +149,7 @@ fn community_proposal(user: User, deposit: u128) -> DispatchResult { } fn consensus_call(call: pallet_pips::Call, signers: &[&Origin]) { - let call = Box::new(Call::Pips(call)); + let call = Box::new(RuntimeCall::Pips(call)); for signer in signers.iter().copied().cloned() { assert_ok!(Committee::vote_or_propose(signer, true, call.clone())); } @@ -1031,7 +1032,7 @@ fn failed_community_proposal(proposer: User, member: User, bad_id: PipId) -> Pip assert_ok!(proposal( &proposer.origin(), &Proposer::Community(proposer.acc()), - Call::Pips(pallet_pips::Call::reject_proposal { id: bad_id }), + RuntimeCall::Pips(pallet_pips::Call::reject_proposal { id: bad_id }), deposit, None, None @@ -1163,7 +1164,7 @@ fn can_prune_states_that_cannot_be_rejected() { assert_ok!(proposal( &proposer.origin(), &Proposer::Community(proposer.acc()), - Call::Pips(pallet_pips::Call::reject_proposal { id: PipId(1337) }), + RuntimeCall::Pips(pallet_pips::Call::reject_proposal { id: PipId(1337) }), 300, None, None @@ -1493,7 +1494,7 @@ fn reschedule_execution_works() { let id = scheduled_proposal(proposer, rc, 0); assert_eq!(Pips::active_pip_count(), 1); let scheduled_at = Pips::pip_to_schedule(id).unwrap(); - assert!(matches!(&*Agenda::get(scheduled_at), [Some(_)])); + assert!(matches!(Agenda::get(scheduled_at).deref()[..], [Some(_)])); // Reschedule execution for next block. let next = System::block_number() + 1; @@ -1506,15 +1507,15 @@ fn reschedule_execution_works() { )); assert_eq!(Pips::pip_to_schedule(id).unwrap(), next); assert_eq!(Agenda::get(scheduled_at), vec![None]); - assert!(matches!(&*Agenda::get(next), [Some(_)])); + assert!(matches!(Agenda::get(next).deref()[..], [Some(_)])); // Reschedule execution for 50 blocks ahead. assert_ok!(Pips::reschedule_execution(rc.origin(), id, Some(next + 50))); assert_eq!(Pips::active_pip_count(), 1); assert_eq!(Pips::pip_to_schedule(id).unwrap(), next + 50); - assert_eq!(vec![None], Agenda::get(scheduled_at)); - assert_eq!(vec![None], Agenda::get(next)); - assert!(matches!(&*Agenda::get(next + 50), [Some(_)])); + assert_eq!(&vec![None], Agenda::get(scheduled_at).deref()); + assert_eq!(&vec![None], Agenda::get(next).deref()); + assert!(matches!(Agenda::get(next + 50).deref()[..], [Some(_)])); }); } diff --git a/pallets/runtime/tests/src/portfolio.rs b/pallets/runtime/tests/src/portfolio.rs index 48800888aa..8834f12816 100644 --- a/pallets/runtime/tests/src/portfolio.rs +++ b/pallets/runtime/tests/src/portfolio.rs @@ -29,7 +29,7 @@ use test_client::AccountKeyring; type Asset = pallet_asset::Module; type Error = pallet_portfolio::Error; type Identity = pallet_identity::Module; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Portfolio = pallet_portfolio::Module; type Settlement = pallet_settlement::Module; diff --git a/pallets/runtime/tests/src/relayer_test.rs b/pallets/runtime/tests/src/relayer_test.rs index f19c28d527..59c8e1378c 100644 --- a/pallets/runtime/tests/src/relayer_test.rs +++ b/pallets/runtime/tests/src/relayer_test.rs @@ -1,10 +1,10 @@ use super::{ - storage::{get_last_auth_id, make_account_without_cdd, Call, TestStorage, User}, + storage::{get_last_auth_id, make_account_without_cdd, RuntimeCall, TestStorage, User}, ExtBuilder, }; use frame_support::{ assert_noop, assert_ok, - weights::{DispatchInfo, Pays, PostDispatchInfo, Weight}, + dispatch::{DispatchInfo, Pays, PostDispatchInfo, Weight}, StorageMap, }; use frame_system; @@ -14,7 +14,7 @@ use polymesh_common_utilities::{ traits::transaction_payment::CddAndFeeDetails, }; use polymesh_primitives::{AccountId, Balance, Signatory, Ticker, TransactionError}; -use polymesh_runtime_develop::runtime::{Call as DevCall, CddHandler}; +use polymesh_runtime_develop::runtime::{CddHandler, RuntimeCall as DevRuntimeCall}; use sp_runtime::{ traits::{Dispatchable, SignedExtension}, transaction_validity::{InvalidTransaction, TransactionValidityError}, @@ -35,45 +35,45 @@ type Error = pallet_relayer::Error; // Relayer Test Helper functions // ======================================= -fn call_balance_transfer(val: Balance) -> ::Call { - Call::Balances(pallet_balances::Call::transfer { +fn call_balance_transfer(val: Balance) -> ::RuntimeCall { + RuntimeCall::Balances(pallet_balances::Call::transfer { dest: MultiAddress::Id(AccountKeyring::Alice.to_account_id()), value: val, }) } -fn call_system_remark(size: usize) -> ::Call { - Call::System(frame_system::Call::remark { +fn call_system_remark(size: usize) -> ::RuntimeCall { + RuntimeCall::System(frame_system::Call::remark { remark: vec![0; size], }) } -fn call_asset_register_ticker(name: &[u8]) -> ::Call { +fn call_asset_register_ticker(name: &[u8]) -> ::RuntimeCall { let ticker = Ticker::from_slice_truncated(name); - Call::Asset(pallet_asset::Call::register_ticker { ticker }) + RuntimeCall::Asset(pallet_asset::Call::register_ticker { ticker }) } fn call_relayer_remove_paying_key( user_key: AccountId, paying_key: AccountId, -) -> ::Call { - Call::Relayer(pallet_relayer::Call::remove_paying_key { +) -> ::RuntimeCall { + RuntimeCall::Relayer(pallet_relayer::Call::remove_paying_key { user_key, paying_key, }) } /// create a transaction info struct from weight. Handy to avoid building the whole struct. -pub fn info_from_weight(w: Weight) -> DispatchInfo { +pub fn info_from_weight(w: u64) -> DispatchInfo { DispatchInfo { - weight: w, + weight: Weight::from_ref_time(w), ..Default::default() } } -fn post_info_from_weight(w: Weight) -> PostDispatchInfo { +fn post_info_from_weight(w: u64) -> PostDispatchInfo { PostDispatchInfo { - actual_weight: Some(w), + actual_weight: Some(Weight::from_ref_time(w)), pays_fee: Pays::Yes, } } @@ -562,7 +562,7 @@ fn do_relayer_accept_cdd_and_fees_test() { // Check that Bob can accept the subsidy with Alice paying for the transaction. assert_eq!( CddHandler::get_valid_payer( - &DevCall::Relayer(pallet_relayer::Call::accept_paying_key { auth_id }), + &DevRuntimeCall::Relayer(pallet_relayer::Call::accept_paying_key { auth_id }), &bob.acc() ), Ok(Some(alice.acc())) diff --git a/pallets/runtime/tests/src/settlement_test.rs b/pallets/runtime/tests/src/settlement_test.rs index cdb71b5f58..606eb93b89 100644 --- a/pallets/runtime/tests/src/settlement_test.rs +++ b/pallets/runtime/tests/src/settlement_test.rs @@ -47,7 +47,7 @@ type Timestamp = pallet_timestamp::Pallet; type ComplianceManager = compliance_manager::Module; type AssetError = asset::Error; type OffChainSignature = AnySignature; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Moment = ::Moment; type BlockNumber = ::BlockNumber; type Settlement = pallet_settlement::Module; diff --git a/pallets/runtime/tests/src/signed_extra.rs b/pallets/runtime/tests/src/signed_extra.rs index ec56ae0c97..16c5395eef 100644 --- a/pallets/runtime/tests/src/signed_extra.rs +++ b/pallets/runtime/tests/src/signed_extra.rs @@ -4,11 +4,11 @@ use polymesh_primitives::{ identity_id::GenesisIdentityRecord, AccountId, IdentityId, Index, InvestorUid, }; use polymesh_runtime_develop::{ - runtime::{Call, SignedExtra}, + runtime::{RuntimeCall, SignedExtra}, Runtime, }; -use frame_support::weights::{DispatchClass, DispatchInfo}; +use frame_support::dispatch::{DispatchClass, DispatchInfo, Weight}; use frame_system::{CheckEra, CheckGenesis, CheckNonce, CheckSpecVersion, CheckTxVersion}; use sp_io::TestExternalities; use sp_runtime::{generic, traits::SignedExtension}; @@ -16,9 +16,9 @@ use sp_std::convert::From; use test_client::AccountKeyring; -pub fn make_call() -> (::Call, usize) { +pub fn make_call() -> (::RuntimeCall, usize) { ( - Call::System(frame_system::Call::remark { remark: vec![] }), + RuntimeCall::System(frame_system::Call::remark { remark: vec![] }), 10, ) } @@ -123,7 +123,7 @@ fn normal_tx() -> Result<(), String> { let user = AccountKeyring::Alice.to_account_id(); let (call, len) = make_call(); let info = DispatchInfo { - weight: 100, + weight: Weight::from_ref_time(100), ..Default::default() }; @@ -153,7 +153,7 @@ fn operational_tx() -> Result<(), String> { let user: AccountId = AccountKeyring::Alice.public().into(); let (call, len) = make_call(); let info = DispatchInfo { - weight: 100, + weight: Weight::from_ref_time(100), class: DispatchClass::Operational, ..Default::default() }; diff --git a/pallets/runtime/tests/src/staking/mock.rs b/pallets/runtime/tests/src/staking/mock.rs index d2c07956fc..0ce2742579 100644 --- a/pallets/runtime/tests/src/staking/mock.rs +++ b/pallets/runtime/tests/src/staking/mock.rs @@ -23,13 +23,13 @@ use chrono::prelude::Utc; use frame_election_provider_support::NposSolution; use frame_support::{ assert_ok, - dispatch::DispatchResult, + dispatch::{DispatchInfo, DispatchResult, Weight}, parameter_types, traits::{ Contains, Currency, FindAuthor, GenesisBuild as _, Get, Imbalance, KeyOwnerProofSystem, OnFinalize, OnInitialize, OnUnbalanced, OneSessionHandler, SortedMembers, }, - weights::{constants::RocksDbWeight, DispatchInfo, Weight}, + weights::constants::RocksDbWeight, IterableStorageMap, StorageDoubleMap, StorageMap, StorageValue, }; use frame_system::{EnsureRoot, EnsureSignedBy}; @@ -118,6 +118,8 @@ pub fn is_disabled(controller: AccountId) -> bool { type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; +pub type Origin = ::RuntimeOrigin; +pub type Call = RuntimeCall; frame_support::construct_runtime!( pub enum Test where @@ -161,7 +163,7 @@ parameter_types! { pub const BlockHashCount: u64 = 250; pub const MaxLen: u32 = 256; pub const MaxLocks: u32 = 1024; - pub const MaximumBlockWeight: Weight = 1024; + pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights::simple_max( frame_support::weights::constants::WEIGHT_PER_SECOND * 2 @@ -180,16 +182,16 @@ impl frame_system::Config for Test { type BlockWeights = (); type BlockLength = (); type DbWeight = RocksDbWeight; - type Origin = Origin; + type RuntimeOrigin = RuntimeOrigin; type Index = AccountIndex; type BlockNumber = BlockNumber; - type Call = Call; + type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = ::sp_runtime::traits::BlakeTwo256; type AccountId = AccountId; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type Version = (); type PalletInfo = PalletInfo; @@ -203,7 +205,7 @@ impl frame_system::Config for Test { } impl pallet_base::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type MaxLen = MaxLen; } @@ -214,11 +216,11 @@ impl CommonConfig for Test { impl pallet_balances::Config for Test { type DustRemoval = (); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; type CddChecker = Test; - type WeightInfo = polymesh_weights::pallet_balances::WeightInfo; + type WeightInfo = polymesh_weights::pallet_balances::SubstrateWeight; type MaxLocks = MaxLocks; } @@ -235,7 +237,7 @@ impl pallet_session::Config for Test { type Keys = SessionKeys; type ShouldEndSession = pallet_session::PeriodicSessions; type SessionHandler = (OtherSessionHandler,); - type Event = Event; + type RuntimeEvent = RuntimeEvent; type ValidatorId = AccountId; type ValidatorIdOf = StashOf; type NextSessionRotation = pallet_session::PeriodicSessions; @@ -243,12 +245,12 @@ impl pallet_session::Config for Test { } impl pallet_committee::Config for Test { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; type CommitteeOrigin = frame_system::EnsureRoot; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } impl pallet_session::historical::Config for Test { @@ -262,16 +264,16 @@ impl pallet_pips::Config for Test { type GovernanceCommittee = crate::storage::Committee; type TechnicalCommitteeVMO = frame_system::EnsureRoot; type UpgradeCommitteeVMO = frame_system::EnsureRoot; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_pips::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_pips::SubstrateWeight; type Scheduler = Scheduler; - type SchedulerCall = Call; + type SchedulerCall = RuntimeCall; } impl pallet_treasury::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = pallet_balances::Module; - type WeightInfo = polymesh_weights::pallet_treasury::WeightInfo; + type WeightInfo = polymesh_weights::pallet_treasury::SubstrateWeight; } impl pallet_authorship::Config for Test { @@ -291,7 +293,7 @@ impl pallet_timestamp::Config for Test { } impl group::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = frame_system::EnsureRoot; type AddOrigin = frame_system::EnsureRoot; type RemoveOrigin = frame_system::EnsureRoot; @@ -299,20 +301,20 @@ impl group::Config for Test { type ResetOrigin = frame_system::EnsureRoot; type MembershipInitialized = (); type MembershipChanged = (); - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } impl protocol_fee::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type OnProtocolFeePayment = (); - type WeightInfo = polymesh_weights::pallet_protocol_fee::WeightInfo; + type WeightInfo = polymesh_weights::pallet_protocol_fee::SubstrateWeight; type Subsidiser = Test; } impl polymesh_common_utilities::traits::identity::Config for Test { - type Event = Event; - type Proposal = Call; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; type MultiSig = Test; type Portfolio = Test; type CddServiceProviders = group::Module; @@ -323,7 +325,7 @@ impl polymesh_common_utilities::traits::identity::Config for Test { type OffChainSignature = TestSignature; type ProtocolFee = protocol_fee::Module; type GCVotingMajorityOrigin = frame_system::EnsureRoot; - type WeightInfo = polymesh_weights::pallet_identity::WeightInfo; + type WeightInfo = polymesh_weights::pallet_identity::SubstrateWeight; type IdentityFn = identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; @@ -334,21 +336,19 @@ parameter_types! { pub const InitialPOLYX: Balance = 0; pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; - pub const NoPreimagePostponement: Option = Some(10); } impl pallet_scheduler::Config for Test { - type Event = Event; - type Origin = Origin; + type RuntimeEvent = RuntimeEvent; + type RuntimeOrigin = RuntimeOrigin; type PalletsOrigin = OriginCaller; - type Call = Call; + type RuntimeCall = RuntimeCall; type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; type WeightInfo = (); type OriginPrivilegeCmp = frame_support::traits::EqualPrivilegeOnly; - type PreimageProvider = Preimage; - type NoPreimagePostponement = NoPreimagePostponement; + type Preimages = Preimage; } parameter_types! { @@ -358,18 +358,17 @@ parameter_types! { } impl pallet_preimage::Config for Test { - type WeightInfo = polymesh_weights::pallet_preimage::WeightInfo; - type Event = Event; + type WeightInfo = polymesh_weights::pallet_preimage::SubstrateWeight; + type RuntimeEvent = RuntimeEvent; type Currency = Balances; type ManagerOrigin = EnsureRoot; - type MaxSize = PreimageMaxSize; type BaseDeposit = PreimageBaseDeposit; type ByteDeposit = PreimageByteDeposit; } impl pallet_test_utils::Config for Test { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_test_utils::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_test_utils::SubstrateWeight; } impl CddAndFeeDetails for Test { @@ -609,7 +608,7 @@ impl Config for Test { type UnixTime = Timestamp; type CurrencyToVote = frame_support::traits::SaturatingCurrencyToVote; type RewardRemainder = RewardRemainderMock; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type Slash = (); type Reward = (); type SessionsPerEra = SessionsPerEra; @@ -620,14 +619,14 @@ impl Config for Test { type RewardCurve = RewardCurve; type NextNewSession = Session; type ElectionLookahead = ElectionLookahead; - type Call = Call; + type Call = RuntimeCall; type MaxIterations = MaxIterations; type MinSolutionScoreBump = MinSolutionScoreBump; type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type OffendingValidatorsThreshold = OffendingValidatorsThreshold; type UnsignedPriority = UnsignedPriority; type OffchainSolutionWeightLimit = polymesh_runtime_common::OffchainSolutionWeightLimit; - type WeightInfo = polymesh_weights::pallet_staking::WeightInfo; + type WeightInfo = polymesh_weights::pallet_staking::SubstrateWeight; type RequiredAddOrigin = frame_system::EnsureRoot; type RequiredRemoveOrigin = EnsureSignedBy; type RequiredCommissionOrigin = frame_system::EnsureRoot; @@ -643,7 +642,7 @@ impl frame_system::offchain::SendTransactionTypes for Test where Call: From, { - type OverarchingCall = Call; + type OverarchingCall = RuntimeCall; type Extrinsic = Extrinsic; } @@ -1577,7 +1576,7 @@ pub(crate) fn staking_events() -> Vec> { .into_iter() .map(|r| r.event) .filter_map(|e| { - if let Event::Staking(inner) = e { + if let RuntimeEvent::Staking(inner) = e { Some(inner) } else { None @@ -1596,7 +1595,7 @@ fn get_primary_key(target: IdentityId) -> AccountId { pub fn make_account_with_uid( id: AccountId, -) -> Result<(::Origin, IdentityId), &'static str> { +) -> Result<(::RuntimeOrigin, IdentityId), &'static str> { make_account_with_balance(id, 1_000_000, None) } @@ -1605,7 +1604,7 @@ pub fn make_account_with_balance( id: AccountId, balance: Balance, expiry: Option, -) -> Result<(::Origin, IdentityId), &'static str> { +) -> Result<(::RuntimeOrigin, IdentityId), &'static str> { let signed_id = Origin::signed(id.clone()); Balances::make_free_balance_be(&id, balance); let uid = create_investor_uid(id); diff --git a/pallets/runtime/tests/src/staking/mod.rs b/pallets/runtime/tests/src/staking/mod.rs index 02f7992f2b..14512bd5e6 100644 --- a/pallets/runtime/tests/src/staking/mod.rs +++ b/pallets/runtime/tests/src/staking/mod.rs @@ -3803,7 +3803,7 @@ mod offchain_phragmen { let call = extrinsic.call; let inner = match call { - mock::Call::Staking(inner) => inner, + mock::RuntimeCall::Staking(inner) => inner, _ => panic!(), }; @@ -3847,7 +3847,7 @@ mod offchain_phragmen { let call = extrinsic.call; let inner = match call { - mock::Call::Staking(inner) => inner, + mock::RuntimeCall::Staking(inner) => inner, _ => panic!(), }; @@ -3890,7 +3890,7 @@ mod offchain_phragmen { let call = extrinsic.call; let inner = match call { - mock::Call::Staking(inner) => inner, + mock::RuntimeCall::Staking(inner) => inner, _ => panic!(), }; @@ -4400,6 +4400,7 @@ mod offchain_phragmen { target: entity_id, claim_type: ClaimType::CustomerDueDiligence, }; + #[allow(deprecated)] Claims::remove_prefix(claim_key, None); // Remove all CDD claims for the validator. // Ensure did no longer has valid cdd @@ -5417,7 +5418,7 @@ type PError = pallet_pips::Error; #[test] fn voting_for_pip_overlays_with_staking() { - use crate::staking::mock::Call; + use crate::staking::mock::RuntimeCall; ExtBuilder::default().build().execute_with(|| { System::set_block_number(1); @@ -5430,9 +5431,9 @@ fn voting_for_pip_overlays_with_staking() { let alice_proposal = |deposit: u128| { let signer = Origin::signed(alice_acc); - let proposal = Box::new(Call::Pips(pallet_pips::Call::set_min_proposal_deposit { - deposit: 0, - })); + let proposal = Box::new(RuntimeCall::Pips( + pallet_pips::Call::set_min_proposal_deposit { deposit: 0 }, + )); Pips::propose(signer, proposal, deposit, None, None) }; @@ -5454,14 +5455,14 @@ fn voting_for_pip_overlays_with_staking() { #[test] fn slashing_leaves_pips_untouched() { - use crate::staking::mock::Call; + use crate::staking::mock::RuntimeCall; use pallet_pips::PipId; ExtBuilder::default().build_and_execute(|| { let acc = 11; let propose = |deposit| { let signer = Origin::signed(acc); - let proposal = Box::new(Call::Pips(pallet_pips::Call::set_active_pip_limit { + let proposal = Box::new(RuntimeCall::Pips(pallet_pips::Call::set_active_pip_limit { limit: 0, })); Pips::propose(signer, proposal, deposit, None, None) diff --git a/pallets/runtime/tests/src/sto_test.rs b/pallets/runtime/tests/src/sto_test.rs index 56ba6fa73b..deca1ad010 100644 --- a/pallets/runtime/tests/src/sto_test.rs +++ b/pallets/runtime/tests/src/sto_test.rs @@ -18,7 +18,7 @@ use frame_support::{assert_noop, assert_ok}; use sp_runtime::DispatchError; use test_client::AccountKeyring; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Asset = asset::Module; type Sto = pallet_sto::Module; type Error = pallet_sto::Error; diff --git a/pallets/runtime/tests/src/storage.rs b/pallets/runtime/tests/src/storage.rs index 9aa82595b4..bf499cdeb3 100644 --- a/pallets/runtime/tests/src/storage.rs +++ b/pallets/runtime/tests/src/storage.rs @@ -2,12 +2,11 @@ use super::ext_builder::{EXTRINSIC_BASE_WEIGHT, TRANSACTION_BYTE_FEE, WEIGHT_TO_ use codec::Encode; use frame_support::{ assert_ok, - dispatch::DispatchResult, + dispatch::{DispatchInfo, DispatchResult, Weight}, parameter_types, traits::{Currency, Imbalance, KeyOwnerProofSystem, OnInitialize, OnUnbalanced}, weights::{ - DispatchInfo, RuntimeDbWeight, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, + RuntimeDbWeight, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, }, StorageDoubleMap, }; @@ -45,6 +44,7 @@ use polymesh_primitives::{ use polymesh_runtime_common::{ merge_active_and_inactive, runtime::{BENCHMARK_MAX_INCREASE, VMO}, + AvailableBlockRatio, MaximumBlockWeight, }; use polymesh_runtime_develop::constants::time::{EPOCH_DURATION_IN_BLOCKS, MILLISECS_PER_BLOCK}; use smallvec::smallvec; @@ -201,7 +201,7 @@ frame_support::construct_runtime!( Balances: pallet_balances::{Pallet, Call, Storage, Config, Event} = 5, // TransactionPayment: Genesis config dependencies: Balance. - TransactionPayment: pallet_transaction_payment::{Pallet, Storage} = 6, + TransactionPayment: pallet_transaction_payment::{Pallet, Event, Storage} = 6, // Identity: Genesis config deps: Timestamp. Identity: pallet_identity::{Pallet, Call, Storage, Event, Config} = 7, @@ -334,8 +334,8 @@ impl User { } /// Returns an `Origin` that can be used to execute extrinsics. - pub fn origin(&self) -> Origin { - Origin::signed(self.acc()) + pub fn origin(&self) -> RuntimeOrigin { + RuntimeOrigin::signed(self.acc()) } pub fn uid(&self) -> InvestorUid { @@ -365,7 +365,7 @@ impl User { } } -pub type EventTest = Event; +pub type EventTest = RuntimeEvent; type Hash = H256; type Hashing = BlakeTwo256; @@ -376,14 +376,11 @@ type AuthorityId = ::Signer; pub(crate) type Balance = u128; parameter_types! { - pub const BlockHashCount: u32 = 250; - pub const MaximumBlockWeight: u64 = 4096; - pub const MaximumBlockLength: u32 = 4096; - pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75); - pub const MaximumExtrinsicWeight: u64 = 2800; - pub const BlockExecutionWeight: u64 = 10; + pub MaximumExtrinsicWeight: Weight = AvailableBlockRatio::get() + .saturating_sub(Perbill::from_percent(10)) * MaximumBlockWeight::get(); + pub const BlockExecutionWeight: Weight = Weight::from_ref_time(10); pub TransactionByteFee: Balance = TRANSACTION_BYTE_FEE.with(|v| *v.borrow()); - pub ExtrinsicBaseWeight: u64 = EXTRINSIC_BASE_WEIGHT.with(|v| *v.borrow()); + pub ExtrinsicBaseWeight: Weight = EXTRINSIC_BASE_WEIGHT.with(|v| *v.borrow()); pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 10, write: 100, @@ -428,7 +425,6 @@ parameter_types! { pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * MaximumBlockWeight::get(); pub const MaxScheduledPerBlock: u32 = 50; - pub const NoPreimagePostponement: Option = Some(10); pub const InitialPOLYX: Balance = 41; pub const SignedClaimHandicap: u64 = 2; @@ -437,7 +433,7 @@ parameter_types! { pub const MaxValueSize: u32 = 16_384; pub Schedule: pallet_contracts::Schedule = Default::default(); - pub DeletionWeightLimit: Weight = 500_000_000_000; + pub DeletionWeightLimit: Weight = Weight::from_ref_time(500_000_000_000); pub DeletionQueueDepth: u32 = 1024; pub MaxInLen: u32 = 8 * 1024; pub MaxOutLen: u32 = 8 * 1024; @@ -458,9 +454,9 @@ impl ChargeTxFee for TestStorage { } type CddHandler = TestStorage; -impl CddAndFeeDetails for TestStorage { +impl CddAndFeeDetails for TestStorage { fn get_valid_payer( - _: &Call, + _: &RuntimeCall, caller: &AccountId, ) -> Result, InvalidTransaction> { let caller: AccountId = caller.clone(); @@ -497,7 +493,7 @@ impl WeightToFeePolynomial for WeightToFee { /// PolymeshCommittee as an instance of group impl group::Config for TestStorage { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = EnsureRoot; type AddOrigin = EnsureRoot; type RemoveOrigin = EnsureRoot; @@ -505,11 +501,11 @@ impl group::Config for TestStorage { type ResetOrigin = EnsureRoot; type MembershipInitialized = committee::Module; type MembershipChanged = committee::Module; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } impl group::Config for TestStorage { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = EnsureRoot; type AddOrigin = EnsureRoot; type RemoveOrigin = EnsureRoot; @@ -517,11 +513,11 @@ impl group::Config for TestStorage { type ResetOrigin = EnsureRoot; type MembershipInitialized = identity::Module; type MembershipChanged = identity::Module; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } impl group::Config for TestStorage { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = EnsureRoot; type AddOrigin = EnsureRoot; type RemoveOrigin = EnsureRoot; @@ -529,11 +525,11 @@ impl group::Config for TestStorage { type ResetOrigin = EnsureRoot; type MembershipInitialized = TechnicalCommittee; type MembershipChanged = TechnicalCommittee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } impl group::Config for TestStorage { - type Event = Event; + type RuntimeEvent = RuntimeEvent; type LimitOrigin = EnsureRoot; type AddOrigin = EnsureRoot; type RemoveOrigin = EnsureRoot; @@ -541,41 +537,41 @@ impl group::Config for TestStorage { type ResetOrigin = EnsureRoot; type MembershipInitialized = UpgradeCommittee; type MembershipChanged = UpgradeCommittee; - type WeightInfo = polymesh_weights::pallet_group::WeightInfo; + type WeightInfo = polymesh_weights::pallet_group::SubstrateWeight; } pub type CommitteeOrigin = committee::RawOrigin<::AccountId, I>; impl committee::Config for TestStorage { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; type CommitteeOrigin = VMO; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } impl committee::Config for TestStorage { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; type CommitteeOrigin = EnsureRoot; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } impl committee::Config for TestStorage { - type Origin = Origin; - type Proposal = Call; + type RuntimeOrigin = RuntimeOrigin; + type Proposal = RuntimeCall; type CommitteeOrigin = EnsureRoot; type VoteThresholdOrigin = Self::CommitteeOrigin; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_committee::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_committee::SubstrateWeight; } impl polymesh_common_utilities::traits::identity::Config for TestStorage { - type Event = Event; - type Proposal = Call; + type RuntimeEvent = RuntimeEvent; + type Proposal = RuntimeCall; type MultiSig = multisig::Module; type Portfolio = portfolio::Module; type CddServiceProviders = CddServiceProvider; @@ -586,7 +582,7 @@ impl polymesh_common_utilities::traits::identity::Config for TestStorage { type OffChainSignature = MultiSignature; type ProtocolFee = protocol_fee::Module; type GCVotingMajorityOrigin = VMO; - type WeightInfo = polymesh_weights::pallet_identity::WeightInfo; + type WeightInfo = polymesh_weights::pallet_identity::SubstrateWeight; type IdentityFn = identity::Module; type SchedulerOrigin = OriginCaller; type InitialPOLYX = InitialPOLYX; @@ -638,15 +634,15 @@ impl pips::Config for TestStorage { type GovernanceCommittee = Committee; type TechnicalCommitteeVMO = VMO; type UpgradeCommitteeVMO = VMO; - type Event = Event; - type WeightInfo = polymesh_weights::pallet_pips::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_pips::SubstrateWeight; type Scheduler = Scheduler; - type SchedulerCall = Call; + type SchedulerCall = RuntimeCall; } impl pallet_test_utils::Config for TestStorage { - type Event = Event; - type WeightInfo = polymesh_weights::pallet_test_utils::WeightInfo; + type RuntimeEvent = RuntimeEvent; + type WeightInfo = polymesh_weights::pallet_test_utils::SubstrateWeight; } polymesh_runtime_common::misc_pallet_impls!(); @@ -660,7 +656,13 @@ pub type CorporateActions = corporate_actions::Module; pub fn make_account( id: AccountId, -) -> Result<(::Origin, IdentityId), &'static str> { +) -> Result< + ( + ::RuntimeOrigin, + IdentityId, + ), + &'static str, +> { let uid = create_investor_uid(id.clone()); make_account_with_uid(id, uid) } @@ -677,7 +679,7 @@ pub fn make_account_with_scope( cdd_provider: AccountId, ) -> Result< ( - ::Origin, + ::RuntimeOrigin, IdentityId, ScopeId, ), @@ -692,7 +694,13 @@ pub fn make_account_with_scope( pub fn make_account_with_uid( id: AccountId, uid: InvestorUid, -) -> Result<(::Origin, IdentityId), &'static str> { +) -> Result< + ( + ::RuntimeOrigin, + IdentityId, + ), + &'static str, +> { make_account_with_balance(id, uid, 1_000_000) } @@ -701,8 +709,14 @@ pub fn make_account_with_balance( id: AccountId, uid: InvestorUid, balance: Balance, -) -> Result<(::Origin, IdentityId), &'static str> { - let signed_id = Origin::signed(id.clone()); +) -> Result< + ( + ::RuntimeOrigin, + IdentityId, + ), + &'static str, +> { + let signed_id = RuntimeOrigin::signed(id.clone()); Balances::make_free_balance_be(&id, balance); // If we have CDD providers, first of them executes the registration. @@ -710,14 +724,18 @@ pub fn make_account_with_balance( let did = match cdd_providers.into_iter().nth(0) { Some(cdd_provider) => { let cdd_acc = get_primary_key(cdd_provider); - let _ = Identity::cdd_register_did(Origin::signed(cdd_acc.clone()), id.clone(), vec![]) - .map_err(|_| "CDD register DID failed")?; + let _ = Identity::cdd_register_did( + RuntimeOrigin::signed(cdd_acc.clone()), + id.clone(), + vec![], + ) + .map_err(|_| "CDD register DID failed")?; // Add CDD Claim let did = Identity::get_identity(&id).unwrap(); let (cdd_id, _) = create_cdd_id(did, Ticker::default(), uid); let cdd_claim = Claim::CustomerDueDiligence(cdd_id); - Identity::add_claim(Origin::signed(cdd_acc), did, cdd_claim, None) + Identity::add_claim(RuntimeOrigin::signed(cdd_acc), did, cdd_claim, None) .map_err(|_| "CDD provider cannot add the CDD claim")?; did } @@ -733,8 +751,14 @@ pub fn make_account_with_balance( pub fn make_account_without_cdd( id: AccountId, -) -> Result<(::Origin, IdentityId), &'static str> { - let signed_id = Origin::signed(id.clone()); +) -> Result< + ( + ::RuntimeOrigin, + IdentityId, + ), + &'static str, +> { + let signed_id = RuntimeOrigin::signed(id.clone()); Balances::make_free_balance_be(&id, 10_000_000); let did = Identity::_register_did(id.clone(), vec![], None).expect("did"); Ok((signed_id, did)) @@ -772,7 +796,7 @@ pub fn add_secondary_key_with_perms(did: IdentityId, acc: AccountId, perms: Auth AuthorizationData::JoinIdentity(perms), None, ); - assert_ok!(Identity::join_identity(Origin::signed(acc), auth_id)); + assert_ok!(Identity::join_identity(RuntimeOrigin::signed(acc), auth_id)); } pub fn add_secondary_key(did: IdentityId, acc: AccountId) { @@ -807,12 +831,14 @@ pub fn next_block() -> Weight { pallet_scheduler::Pallet::::on_initialize(block_number) } -pub fn fast_forward_to_block(n: u32) -> Weight { +pub fn fast_forward_to_block(n: u32) { let i = System::block_number(); - (i..=n).map(|_| next_block()).sum() + for _ in i..=n { + next_block(); + } } -pub fn fast_forward_blocks(offset: u32) -> Weight { +pub fn fast_forward_blocks(offset: u32) { fast_forward_to_block(offset + System::block_number()) } @@ -876,7 +902,7 @@ pub fn add_cdd_claim( // Add cdd claim first assert_ok!(Identity::add_claim( - Origin::signed(cdd_provider), + RuntimeOrigin::signed(cdd_provider), claim_to, Claim::CustomerDueDiligence(cdd_id), cdd_claim_expiry, @@ -914,7 +940,7 @@ pub fn add_investor_uniqueness_claim( cdd_id: CddId, proof: InvestorZKProofData, ) -> DispatchResult { - let signed_claim_to = Origin::signed(get_primary_key(claim_to)); + let signed_claim_to = RuntimeOrigin::signed(get_primary_key(claim_to)); // Provide the InvestorUniqueness. Identity::add_investor_uniqueness_claim( @@ -937,8 +963,8 @@ pub fn provide_scope_claim_to_multiple_parties<'a>( }); } -pub fn root() -> Origin { - Origin::from(frame_system::RawOrigin::Root) +pub fn root() -> RuntimeOrigin { + RuntimeOrigin::from(frame_system::RawOrigin::Root) } pub fn create_cdd_id_and_investor_uid(identity_id: IdentityId) -> (CddId, InvestorUid) { @@ -947,8 +973,8 @@ pub fn create_cdd_id_and_investor_uid(identity_id: IdentityId) -> (CddId, Invest (cdd_id, uid) } -pub fn make_remark_proposal() -> Call { - Call::System(frame_system::Call::remark { +pub fn make_remark_proposal() -> RuntimeCall { + RuntimeCall::System(frame_system::Call::remark { remark: vec![b'X'; 100], }) .into() @@ -1013,8 +1039,8 @@ macro_rules! assert_event_doesnt_exist { }; } -pub fn exec>(origin: Origin, call: C) -> DispatchResult { - let origin: Result, Origin> = origin.into(); +pub fn exec>(origin: RuntimeOrigin, call: C) -> DispatchResult { + let origin: Result, RuntimeOrigin> = origin.into(); let signed = match origin.unwrap() { RawOrigin::Signed(acc) => { let info = frame_system::Account::::get(&acc); diff --git a/pallets/runtime/tests/src/transaction_payment_test.rs b/pallets/runtime/tests/src/transaction_payment_test.rs index f0dd219712..060634890e 100644 --- a/pallets/runtime/tests/src/transaction_payment_test.rs +++ b/pallets/runtime/tests/src/transaction_payment_test.rs @@ -1,12 +1,10 @@ use super::ext_builder::ExtBuilder; -use super::storage::{Call, TestStorage}; +use super::storage::{RuntimeCall, TestStorage}; use codec::Encode; use frame_support::{ + dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays, PostDispatchInfo, Weight}, traits::Currency, - weights::{ - DispatchClass, DispatchInfo, GetDispatchInfo, Pays, PostDispatchInfo, Weight, - WeightToFeePolynomial, - }, + weights::WeightToFee, }; use pallet_balances::Call as BalancesCall; use pallet_transaction_payment::{ChargeTransactionPayment, Multiplier, RuntimeDispatchInfo}; @@ -21,8 +19,8 @@ use sp_runtime::{ }; use test_client::AccountKeyring; -fn call() -> ::Call { - Call::Balances(BalancesCall::transfer { +fn call() -> ::RuntimeCall { + RuntimeCall::Balances(BalancesCall::transfer { dest: MultiAddress::Id(AccountKeyring::Alice.to_account_id()), value: 69, }) @@ -33,29 +31,29 @@ type System = frame_system::Pallet; type TransactionPayment = pallet_transaction_payment::Module; /// create a transaction info struct from weight. Handy to avoid building the whole struct. -pub fn info_from_weight(w: Weight) -> DispatchInfo { +pub fn info_from_weight(w: u64) -> DispatchInfo { // pays_fee: Pays::Yes -- class: DispatchClass::Normal DispatchInfo { - weight: w, + weight: Weight::from_ref_time(w), ..Default::default() } } fn weight_to_fee(weight: Weight) -> u128 { - ::WeightToFee::calc(&weight) + ::WeightToFee::weight_to_fee(&weight) } -fn operational_info_from_weight(w: Weight) -> DispatchInfo { +fn operational_info_from_weight(w: u64) -> DispatchInfo { DispatchInfo { - weight: w, + weight: Weight::from_ref_time(w), class: DispatchClass::Operational, ..Default::default() } } -fn post_info_from_weight(w: Weight) -> PostDispatchInfo { +fn post_info_from_weight(w: u64) -> PostDispatchInfo { PostDispatchInfo { - actual_weight: Some(w), + actual_weight: Some(Weight::from_ref_time(w)), pays_fee: Pays::Yes, } } @@ -164,7 +162,7 @@ fn signed_extension_transaction_payment_is_bounded() { // maximum weight possible ChargeTransactionPayment::::from(0) - .pre_dispatch(&user, &call(), &info_from_weight(Weight::max_value()), 10) + .pre_dispatch(&user, &call(), &info_from_weight(u64::MAX), 10) .unwrap(); // fee will be proportional to what is the actual maximum weight in the runtime. assert_eq!(Balances::free_balance(&user), (free_user - max_fee)); @@ -186,7 +184,7 @@ fn signed_extension_allows_free_transactions() { // This is a completely free (and thus wholly insecure/DoS-ridden) transaction. let operational_transaction = DispatchInfo { - weight: 0, + weight: Weight::from_ref_time(0), class: DispatchClass::Operational, pays_fee: Pays::No, }; @@ -196,7 +194,7 @@ fn signed_extension_allows_free_transactions() { // like a InsecureFreeNormal let free_transaction = DispatchInfo { - weight: 0, + weight: Weight::from_ref_time(0), class: DispatchClass::Normal, pays_fee: Pays::Yes, }; @@ -264,14 +262,14 @@ fn compute_fee_works_without_multiplier() { // Tip only, no fees works let dispatch_info = DispatchInfo { - weight: 0, + weight: Weight::from_ref_time(0), class: DispatchClass::Operational, pays_fee: Pays::No, }; assert_eq!(TransactionPayment::compute_fee(0, &dispatch_info, 10), 10); // No tip, only base fee works let dispatch_info = DispatchInfo { - weight: 0, + weight: Weight::from_ref_time(0), class: DispatchClass::Operational, pays_fee: Pays::Yes, }; @@ -288,7 +286,7 @@ fn compute_fee_works_without_multiplier() { ); // Weight fee + base fee works let dispatch_info = DispatchInfo { - weight: 1000, + weight: Weight::from_ref_time(1000), class: DispatchClass::Operational, pays_fee: Pays::Yes, }; @@ -307,7 +305,7 @@ fn compute_fee_works_with_multiplier() { TransactionPayment::put_next_fee_multiplier(Multiplier::saturating_from_rational(3, 2)); // Base fee is unaffected by multiplier let dispatch_info = DispatchInfo { - weight: 0, + weight: Weight::from_ref_time(0), class: DispatchClass::Operational, pays_fee: Pays::Yes, }; @@ -315,7 +313,7 @@ fn compute_fee_works_with_multiplier() { // Everything works together :) let dispatch_info = DispatchInfo { - weight: 123, + weight: Weight::from_ref_time(123), class: DispatchClass::Operational, pays_fee: Pays::Yes, }; @@ -339,7 +337,7 @@ fn compute_fee_works_with_negative_multiplier() { // Base fee is unaffected by multiplier. let dispatch_info = DispatchInfo { - weight: 0, + weight: Weight::from_ref_time(0), class: DispatchClass::Operational, pays_fee: Pays::Yes, }; @@ -347,7 +345,7 @@ fn compute_fee_works_with_negative_multiplier() { // Everything works together. let dispatch_info = DispatchInfo { - weight: 123, + weight: Weight::from_ref_time(123), class: DispatchClass::Operational, pays_fee: Pays::Yes, }; @@ -368,7 +366,7 @@ fn compute_fee_does_not_overflow() { .execute_with(|| { // Overflow is handled let dispatch_info = DispatchInfo { - weight: Weight::max_value(), + weight: Weight::MAX, class: DispatchClass::Operational, pays_fee: Pays::Yes, }; @@ -420,7 +418,7 @@ fn zero_transfer_on_free_transaction() { System::set_block_number(10); let len = 10; let dispatch_info = DispatchInfo { - weight: 100, + weight: Weight::from_ref_time(100), pays_fee: Pays::No, class: DispatchClass::Normal, }; @@ -439,8 +437,8 @@ fn zero_transfer_on_free_transaction() { ) .is_ok()); assert_eq!(Balances::total_balance(&user), bal_init); - // No events for such a scenario - assert_eq!(System::events().len(), 0); + // One event for tx fee payment `TransactionFeePaid`. + assert_eq!(System::events().len(), 1); }); } diff --git a/pallets/runtime/tests/src/transfer_compliance_test.rs b/pallets/runtime/tests/src/transfer_compliance_test.rs index da13bb86c2..80335bb4f4 100644 --- a/pallets/runtime/tests/src/transfer_compliance_test.rs +++ b/pallets/runtime/tests/src/transfer_compliance_test.rs @@ -17,7 +17,7 @@ use sp_arithmetic::Permill; use std::collections::{HashMap, HashSet}; use test_client::AccountKeyring; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; type Identity = pallet_identity::Module; type Asset = pallet_asset::Module; type Statistics = pallet_statistics::Module; diff --git a/pallets/runtime/tests/src/treasury_test.rs b/pallets/runtime/tests/src/treasury_test.rs index fcbfb6ea10..ac24a869e5 100644 --- a/pallets/runtime/tests/src/treasury_test.rs +++ b/pallets/runtime/tests/src/treasury_test.rs @@ -12,7 +12,7 @@ pub type Balances = pallet_balances::Module; pub type Treasury = pallet_treasury::Module; type TreasuryError = pallet_treasury::Error; type Identity = pallet_identity::Module; -type Origin = ::Origin; +type Origin = ::RuntimeOrigin; fn beneficiary(id: IdentityId, amount: Balance) -> Beneficiary { Beneficiary { id, amount } diff --git a/pallets/runtime/tests/src/utility_test.rs b/pallets/runtime/tests/src/utility_test.rs index b76e30b048..5bf96cd79d 100644 --- a/pallets/runtime/tests/src/utility_test.rs +++ b/pallets/runtime/tests/src/utility_test.rs @@ -2,8 +2,8 @@ use super::{ assert_event_doesnt_exist, assert_event_exists, assert_last_event, pips_test::assert_balance, storage::{ - add_secondary_key, get_secondary_keys, register_keyring_account_with_balance, Call, - EventTest, Identity, Origin, Portfolio, System, TestStorage, User, Utility, + add_secondary_key, get_secondary_keys, register_keyring_account_with_balance, EventTest, + Identity, Portfolio, RuntimeCall, RuntimeOrigin, System, TestStorage, User, Utility, }, ExtBuilder, }; @@ -22,8 +22,8 @@ use test_client::AccountKeyring; type Error = utility::Error; -fn transfer(to: AccountId, amount: u128) -> Call { - Call::Balances(BalancesCall::transfer { +fn transfer(to: AccountId, amount: u128) -> RuntimeCall { + RuntimeCall::Balances(BalancesCall::transfer { dest: to.into(), value: amount, }) @@ -65,7 +65,7 @@ fn batch_test(test: impl FnOnce(AccountId, AccountId)) { fn batch_with_signed_works() { batch_test(|alice, bob| { let calls = vec![transfer(bob.clone(), 400), transfer(bob.clone(), 400)]; - assert_ok!(Utility::batch(Origin::signed(alice.clone()), calls)); + assert_ok!(Utility::batch(RuntimeOrigin::signed(alice.clone()), calls)); assert_balance(alice, 200, 0); assert_balance(bob, 1000 + 400 + 400, 0); assert_event(Event::BatchCompleted(vec![1, 1])); @@ -80,7 +80,7 @@ fn batch_early_exit_works() { transfer(bob.clone(), 900), transfer(bob.clone(), 400), ]; - assert_ok!(Utility::batch(Origin::signed(alice.clone()), calls)); + assert_ok!(Utility::batch(RuntimeOrigin::signed(alice.clone()), calls)); assert_balance(alice, 600, 0); assert_balance(bob, 1000 + 400, 0); assert_event(Event::BatchInterrupted(vec![1, 0], (1, ERROR))); @@ -92,7 +92,7 @@ fn batch_optimistic_works() { batch_test(|alice, bob| { let calls = vec![transfer(bob.clone(), 401), transfer(bob.clone(), 402)]; assert_ok!(Utility::batch_optimistic( - Origin::signed(alice.clone()), + RuntimeOrigin::signed(alice.clone()), calls )); assert_event(Event::BatchCompleted(vec![1, 1])); @@ -105,7 +105,7 @@ fn batch_optimistic_works() { fn batch_optimistic_failures_listed() { batch_test(|alice, bob| { assert_ok!(Utility::batch_optimistic( - Origin::signed(alice.clone()), + RuntimeOrigin::signed(alice.clone()), vec![ transfer(bob.clone(), 401), // YAY. transfer(bob.clone(), 900), // NAY. @@ -127,7 +127,10 @@ fn batch_optimistic_failures_listed() { fn batch_atomic_works() { batch_test(|alice, bob| { let calls = vec![transfer(bob.clone(), 401), transfer(bob.clone(), 402)]; - assert_ok!(Utility::batch_atomic(Origin::signed(alice.clone()), calls)); + assert_ok!(Utility::batch_atomic( + RuntimeOrigin::signed(alice.clone()), + calls + )); assert_event(Event::BatchCompleted(vec![1, 1])); assert_balance(alice, 1000 - 401 - 402, 0); assert_balance(bob, 1000 + 401 + 402, 0); @@ -139,7 +142,10 @@ fn batch_atomic_early_exit_works() { batch_test(|alice, bob| { let trans = |x| transfer(bob.clone(), x); let calls = vec![trans(400), trans(900), trans(400)]; - assert_ok!(Utility::batch_atomic(Origin::signed(alice.clone()), calls)); + assert_ok!(Utility::batch_atomic( + RuntimeOrigin::signed(alice.clone()), + calls + )); assert_balance(alice, 1000, 0); assert_balance(bob, 1000, 0); assert_event(Event::BatchInterrupted(vec![1, 0], (1, ERROR))); @@ -167,10 +173,10 @@ fn _relay_happy_case() { assert_balance(bob.clone(), 1041, 0); assert_balance(charlie.clone(), 1041, 0); - let origin = Origin::signed(alice); + let origin = RuntimeOrigin::signed(alice); let transaction = UniqueCall::new( Utility::nonce(bob.clone()), - Call::Balances(BalancesCall::transfer { + RuntimeCall::Balances(BalancesCall::transfer { dest: charlie.clone().into(), value: 50, }), @@ -202,10 +208,10 @@ fn _relay_unhappy_cases() { let charlie = AccountKeyring::Charlie.to_account_id(); - let origin = Origin::signed(alice); + let origin = RuntimeOrigin::signed(alice); let transaction = UniqueCall::new( Utility::nonce(bob.clone()), - Call::Balances(BalancesCall::transfer { + RuntimeCall::Balances(BalancesCall::transfer { dest: charlie.clone().into(), value: 59, }), @@ -235,7 +241,7 @@ fn _relay_unhappy_cases() { let transaction = UniqueCall::new( Utility::nonce(bob.clone()) + 1, - Call::Balances(BalancesCall::transfer { + RuntimeCall::Balances(BalancesCall::transfer { dest: charlie.into(), value: 59, }), @@ -313,10 +319,10 @@ fn batch_secondary_with_permissions() { // Call one disallowed and one allowed extrinsic in a batch. let calls = vec![ - Call::Portfolio(PortfolioCall::create_portfolio { + RuntimeCall::Portfolio(PortfolioCall::create_portfolio { name: high_risk_name.clone(), }), - Call::Portfolio(PortfolioCall::rename_portfolio { + RuntimeCall::Portfolio(PortfolioCall::rename_portfolio { num: 1u64.into(), to_name: high_risk_name.clone(), }), diff --git a/pallets/settlement/Cargo.toml b/pallets/settlement/Cargo.toml index 425195faaa..f11a16eef4 100644 --- a/pallets/settlement/Cargo.toml +++ b/pallets/settlement/Cargo.toml @@ -26,10 +26,10 @@ hex-literal = "0.2.1" hex = { version = "0.4.2", optional = true } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/settlement/src/lib.rs b/pallets/settlement/src/lib.rs index 36660f5ab7..d1699011a4 100644 --- a/pallets/settlement/src/lib.rs +++ b/pallets/settlement/src/lib.rs @@ -98,7 +98,7 @@ pub trait Config: + pallet_nft::Config { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// A call type used by the scheduler. type Proposal: From> + Into<::Proposal>; @@ -687,7 +687,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: ::Origin { + pub struct Module for enum Call where origin: ::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -1273,7 +1273,7 @@ impl Module { /// Ensure origin call permission and the given instruction validity. fn ensure_origin_perm_and_instruction_validity( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, is_execute: bool, ) -> EnsureValidInstructionResult { @@ -1646,8 +1646,10 @@ impl Module { let legs: Vec<(LegId, LegV2)> = Self::drain_instruction_legs(&id); let details = >::take(id); VenueInstructions::remove(details.venue_id, id); + #[allow(deprecated)] >::remove_prefix(id, None); InstructionAffirmsPending::remove(id); + #[allow(deprecated)] AffirmsReceived::remove_prefix(id, None); // We remove duplicates in memory before triggering storage actions @@ -1772,7 +1774,7 @@ impl Module { } pub fn base_affirm_with_receipts( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, receipt_details: Vec>, portfolios: Vec, @@ -1897,7 +1899,7 @@ impl Module { } pub fn base_affirm_instruction( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, portfolios: impl Iterator, fungible_transfers: u32, @@ -1920,7 +1922,7 @@ impl Module { // It affirms the instruction and may schedule the instruction // depends on the settlement type. pub fn affirm_with_receipts_and_maybe_schedule_instruction( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, receipt_details: Vec>, portfolios: Vec, @@ -1941,7 +1943,7 @@ impl Module { /// Schedule settlement instruction execution in the next block, unless already scheduled. /// Used for general purpose settlement. pub fn affirm_and_maybe_schedule_instruction( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, portfolios: impl Iterator, fungible_transfers: u32, @@ -1963,7 +1965,7 @@ impl Module { /// /// NB - Use this function only in the STO pallet to support DVP settlements. pub fn affirm_and_execute_instruction( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, receipt: Option>, portfolios: Vec, @@ -2089,7 +2091,7 @@ impl Module { } fn base_reject_instruction( - origin: T::Origin, + origin: T::RuntimeOrigin, id: InstructionId, portfolio: PortfolioId, fungible_transfers: u32, diff --git a/pallets/staking/Cargo.toml b/pallets/staking/Cargo.toml index 12fb710dc5..1f94141cca 100644 --- a/pallets/staking/Cargo.toml +++ b/pallets/staking/Cargo.toml @@ -17,11 +17,11 @@ log = "0.4.8" # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false} -sp-runtime = { version = "6.0.0", default-features = false } -sp-arithmetic = { version = "5.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false} +sp-runtime = { version = "7.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } sp-staking = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/staking/rpc/Cargo.toml b/pallets/staking/rpc/Cargo.toml index 79ef2ed949..c92b3d995e 100644 --- a/pallets/staking/rpc/Cargo.toml +++ b/pallets/staking/rpc/Cargo.toml @@ -4,14 +4,23 @@ version = "2.0.0" authors = ["Anonymous"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0" } +jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } +sp-api = { version = "4.0.0-dev", default_features = false } +sp-blockchain = { version = "4.0.0-dev" } +sp-core = { version = "7.0.0", default_features = false } +sp-rpc = { version = "6.0.0" } +sp-runtime = { version = "7.0.0", default_features = false } +sp-std = {version = "5.0.0", default_features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } + +# General serde = { version = "1.0.104", features = ["derive"] } -jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-core-client = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-derive = "18.0.0" -sp-runtime = { version = "6.0.0", default_features = false } -sp-blockchain = { version = "4.0.0-dev", default_features = false} -sp-api = { version = "4.0.0-dev", default_features = false} +node-rpc = { path = "../../../rpc" } pallet-staking-rpc-runtime-api = { version = "2.0.0", path = "./runtime-api" } diff --git a/pallets/staking/rpc/runtime-api/Cargo.toml b/pallets/staking/rpc/runtime-api/Cargo.toml index 1d17e84b83..4dd8050989 100644 --- a/pallets/staking/rpc/runtime-api/Cargo.toml +++ b/pallets/staking/rpc/runtime-api/Cargo.toml @@ -4,14 +4,14 @@ version = "2.0.0" authors = ["Anonymous"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] sp-api = { version = "4.0.0-dev", default_features = false} -sp-runtime = { version = "6.0.0", default_features = false} +sp-runtime = { version = "7.0.0", default_features = false} frame-support = { version = "4.0.0-dev", default-features = false } -[dev-dependencies] -serde_json = "1.0.48" - [features] default = ["std"] std = [ diff --git a/pallets/staking/rpc/src/lib.rs b/pallets/staking/rpc/src/lib.rs index c0f7944a02..86b263a70d 100644 --- a/pallets/staking/rpc/src/lib.rs +++ b/pallets/staking/rpc/src/lib.rs @@ -1,15 +1,19 @@ -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorObject}, +}; +use node_rpc::Error; pub use pallet_staking_rpc_runtime_api::StakingApi as StakingRuntimeApi; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT, Perbill}; use std::sync::Arc; -#[rpc] +#[rpc(client, server)] pub trait StakingApi { - #[rpc(name = "staking_getCurve")] - fn get_curve(&self, at: Option) -> Result>; + #[method(name = "staking_getCurve")] + fn get_curve(&self, at: Option) -> RpcResult>; } /// A struct that implements the [`StakingApi`]. @@ -28,41 +32,25 @@ impl Staking { } } -/// Error type of this RPC api. -pub enum Error { - /// The transaction was not decodable. - DecodeError, - /// The call to runtime failed. - RuntimeError, -} - -impl From for i64 { - fn from(e: Error) -> i64 { - match e { - Error::RuntimeError => 1, - Error::DecodeError => 2, - } - } -} - -impl StakingApi<::Hash> for Staking +impl StakingApiServer<::Hash> for Staking where Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: StakingRuntimeApi, { - fn get_curve(&self, at: Option<::Hash>) -> Result> { + fn get_curve(&self, at: Option<::Hash>) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| // If the block hash is not supplied assume the best block. self.client.info().best_hash)); - api.get_curve(&at).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError.into()), - message: "Unable to query dispatch info.".into(), - data: Some(format!("{:?}", e).into()), + api.get_curve(&at).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to get curve.", + Some(e.to_string()), + )) + .into() }) } } diff --git a/pallets/staking/src/lib.rs b/pallets/staking/src/lib.rs index ebba6d8214..3fca4e9d53 100644 --- a/pallets/staking/src/lib.rs +++ b/pallets/staking/src/lib.rs @@ -174,7 +174,7 @@ //! pub trait Config: staking::Config {} //! //! decl_module! { -//! pub struct Module for enum Call where origin: T::Origin { +//! pub struct Module for enum Call where origin: T::RuntimeOrigin { //! /// Reward a validator. //! #[weight = 0] //! pub fn reward_myself(origin) -> dispatch::DispatchResult { @@ -302,6 +302,8 @@ use frame_support::{ decl_error, decl_event, decl_module, decl_storage, dispatch::{ DispatchErrorWithPostInfo, DispatchResult, DispatchResultWithPostInfo, WithPostDispatchInfo, + DispatchClass::Operational, + Pays, Weight, }, ensure, storage::IterableStorageMap, @@ -312,8 +314,6 @@ use frame_support::{ }, weights::{ constants::{WEIGHT_PER_MICROS, WEIGHT_PER_NANOS}, - DispatchClass::Operational, - Pays, Weight, }, Twox64Concat, }; @@ -331,7 +331,7 @@ use frame_election_provider_support::{ }; use sp_npos_elections::{ seq_phragmen, to_support_map, - Assignment, ElectionResult as PrimitiveElectionResult, ElectionScore, + Assignment, BalancingConfig, ElectionResult as PrimitiveElectionResult, ElectionScore, EvaluateSupport, ExtendedBalance, PerThing128, Supports, SupportMap, VoteWeight, }; @@ -887,7 +887,7 @@ pub trait Config: type RewardRemainder: OnUnbalanced>; /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Handler for the unbalanced reduction when slashing a staker. type Slash: OnUnbalanced>; @@ -908,7 +908,7 @@ pub trait Config: type SlashDeferDuration: Get; /// The origin which can cancel a deferred slash. Root can always do this. - type SlashCancelOrigin: EnsureOrigin; + type SlashCancelOrigin: EnsureOrigin; /// Interface for interacting with a session module. type SessionInterface: self::SessionInterface; @@ -967,13 +967,13 @@ pub trait Config: type WeightInfo: WeightInfo; /// Required origin for adding a potential validator (can always be Root). - type RequiredAddOrigin: EnsureOrigin; + type RequiredAddOrigin: EnsureOrigin; /// Required origin for removing a validator (can always be Root). - type RequiredRemoveOrigin: EnsureOrigin; + type RequiredRemoveOrigin: EnsureOrigin; /// Required origin for changing validator commission. - type RequiredCommissionOrigin: EnsureOrigin; + type RequiredCommissionOrigin: EnsureOrigin; /// To schedule the rewards for the stakers after the end of era. type RewardScheduler: Anon::Call, Self::PalletsOrigin>; @@ -1277,7 +1277,7 @@ decl_storage! { "Stash does not have enough balance to bond." ); let _ = >::bond( - T::Origin::from(Some(stash.clone()).into()), + T::RuntimeOrigin::from(Some(stash.clone()).into()), T::Lookup::unlookup(controller.clone()), balance, RewardDestination::Staked, @@ -1293,13 +1293,13 @@ decl_storage! { // Setting the cap value here. prefs.commission = config.validator_commission_cap; >::validate( - T::Origin::from(Some(controller.clone()).into()), + T::RuntimeOrigin::from(Some(controller.clone()).into()), prefs, ) }, StakerStatus::Nominator(votes) => { >::nominate( - T::Origin::from(Some(controller.clone()).into()), + T::RuntimeOrigin::from(Some(controller.clone()).into()), votes.iter().map(|l| T::Lookup::unlookup(l.clone())).collect(), ) }, _ => Ok(()) @@ -1481,7 +1481,7 @@ decl_error! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { /// Number of sessions per era. const SessionsPerEra: SessionIndex = T::SessionsPerEra::get(); @@ -1583,7 +1583,7 @@ decl_module! { >::iter().for_each(|(k,_)| >::add_account_key_ref_count(&k)); }); - 1_000 + Weight::from_ref_time(1_000) } /// sets `ElectionStatus` to `Open(now)` where `now` is the block number at which the @@ -1592,8 +1592,8 @@ decl_module! { /// worker, if applicable, will execute at the end of the current block, and solutions may /// be submitted. fn on_initialize(now: T::BlockNumber) -> Weight { - let mut consumed_weight = 0; - let mut add_weight = |reads, writes, weight| { + let mut consumed_weight = Weight::zero(); + let mut add_weight = |reads: u64, writes: u64, weight| { consumed_weight += T::DbWeight::get().reads_writes(reads, writes); consumed_weight += weight; }; @@ -1617,7 +1617,7 @@ decl_module! { >::put( ElectionStatus::::Open(now) ); - add_weight(0, 1, 0); + add_weight(0, 1, Weight::zero()); log!(info, "💸 Election window is Open({:?}). Snapshot created", now); } else { log!(warn, "💸 Failed to create snapshot at {:?}.", now); @@ -1630,9 +1630,9 @@ decl_module! { add_weight(0, 0, estimate_next_new_session_weight) } // For `era_election_status`, `is_current_session_final`, `will_era_be_forced` - add_weight(3, 0, 0); + add_weight(3, 0, Weight::zero()); // Additional read from `on_finalize` - add_weight(1, 0, 0); + add_weight(1, 0, Weight::zero()); consumed_weight } @@ -2463,8 +2463,8 @@ decl_module! { Self::update_ledger(&controller, &ledger); Ok(Some( - 35 * WEIGHT_PER_MICROS - + 50 * WEIGHT_PER_NANOS * (ledger.unlocking.len() as Weight) + 35u64 * WEIGHT_PER_MICROS + + 50u64 * WEIGHT_PER_NANOS * (ledger.unlocking.len() as u64) + T::DbWeight::get().reads_writes(3, 2) ).into()) } @@ -2733,7 +2733,7 @@ impl Module { /// This data is used to efficiently evaluate election results. returns `true` if the operation /// is successful. pub fn create_stakers_snapshot() -> (bool, Weight) { - let mut consumed_weight = 0; + let mut consumed_weight = Weight::zero(); let mut add_db_reads_writes = |reads, writes| { consumed_weight += T::DbWeight::get().reads_writes(reads, writes); }; @@ -2752,7 +2752,7 @@ impl Module { let num_validators = validators.len(); let num_nominators = nominators.len(); - add_db_reads_writes((num_validators + num_nominators) as Weight, 0); + add_db_reads_writes((num_validators + num_nominators) as u64, 0); if num_validators > MAX_VALIDATORS || @@ -3028,7 +3028,7 @@ impl Module { ) } - Ok(None.into()) + Ok(None::.into()) } /// Checks a given solution and if correct and improved, writes it on chain as the queued result @@ -3203,7 +3203,7 @@ impl Module { // emit event. Self::deposit_event(RawEvent::SolutionStored(compute)); - Ok(None.into()) + Ok(None::.into()) } /// Start a session potentially starting an era. @@ -3565,7 +3565,7 @@ impl Module { Self::validator_count() as usize, all_validators, all_nominators, - Some((iterations, 0)), // exactly run `iterations` rounds. + Some(BalancingConfig { iterations, tolerance: 0 }), // exactly run `iterations` rounds. ) .map_err(|err| log!(error, "Call to seq-phragmen failed due to {:?}", err)) .ok() @@ -3632,8 +3632,11 @@ impl Module { /// Clear all era information for given era. fn clear_era_information(era_index: EraIndex) { + #[allow(deprecated)] >::remove_prefix(era_index, None); + #[allow(deprecated)] >::remove_prefix(era_index, None); + #[allow(deprecated)] >::remove_prefix(era_index, None); >::remove(era_index); >::remove(era_index); @@ -3750,7 +3753,7 @@ impl Module { * T::ExpectedBlockTime::get().saturated_into::() } - fn base_chill_from_governance(origin: T::Origin, identity: IdentityId, stash_keys: Vec) -> DispatchResult { + fn base_chill_from_governance(origin: T::RuntimeOrigin, identity: IdentityId, stash_keys: Vec) -> DispatchResult { // Checks that the era election status is closed. ensure!(Self::era_election_status().is_closed(), Error::::CallNotAllowed); // Required origin for removing a validator. @@ -3925,7 +3928,7 @@ for Module where slash_fraction: &[Perbill], slash_session: SessionIndex, _disable_strategy: DisableStrategy, - ) -> u64 { + ) -> Weight { // Polymesh-Note: // When slashing is off or allowed for none, set slash fraction to zero. // --------------------------------------------------------------------- @@ -3939,7 +3942,7 @@ for Module where // --------------------------------------------------------------------- let reward_proportion = SlashRewardFraction::get(); - let mut consumed_weight: Weight = 0; + let mut consumed_weight = Weight::zero(); let mut add_db_reads_writes = |reads, writes| { consumed_weight += T::DbWeight::get().reads_writes(reads, writes); }; diff --git a/pallets/staking/src/offchain_election.rs b/pallets/staking/src/offchain_election.rs index 752e401c79..9b661d0bcb 100644 --- a/pallets/staking/src/offchain_election.rs +++ b/pallets/staking/src/offchain_election.rs @@ -164,7 +164,7 @@ pub fn get_balancing_iters() -> usize { pub fn maximum_compact_len( winners_len: u32, size: ElectionSize, - max_weight: Weight, + max_weight: u64, ) -> u32 { use sp_std::cmp::Ordering; @@ -176,16 +176,16 @@ pub fn maximum_compact_len( let mut voters = max_voters; // helper closures. - let weight_with = |voters: u32| -> Weight { + let weight_with = |voters: u32| -> u64 { W::submit_solution_better( size.validators.into(), size.nominators.into(), voters, winners_len, - ) + ).ref_time() }; - let next_voters = |current_weight: Weight, voters: u32, step: u32| -> Result { + let next_voters = |current_weight: u64, voters: u32, step: u32| -> Result { match current_weight.cmp(&max_weight) { Ordering::Less => { let next_voters = voters.checked_add(step); @@ -553,7 +553,7 @@ mod test { } fn submit_solution_better(v: u32, n: u32, a: u32, w: u32) -> Weight { - (0 * v + 0 * n + 1000 * a + 0 * w) as Weight + Weight::from_ref_time((0 * v + 0 * n + 1000 * a + 0 * w).into()) } fn chill_from_governance(s: u32) -> Weight { diff --git a/pallets/staking/src/slashing.rs b/pallets/staking/src/slashing.rs index c9eb89e254..03e6d77bd6 100644 --- a/pallets/staking/src/slashing.rs +++ b/pallets/staking/src/slashing.rs @@ -587,7 +587,9 @@ impl<'a, T: 'a + Config> Drop for InspectingSpans<'a, T> { /// Clear slashing metadata for an obsolete era. pub(crate) fn clear_era_metadata(obsolete_era: EraIndex) { + #[allow(deprecated)] as Store>::ValidatorSlashInEra::remove_prefix(&obsolete_era, None); + #[allow(deprecated)] as Store>::NominatorSlashInEra::remove_prefix(&obsolete_era, None); } diff --git a/pallets/staking/src/testing_utils.rs b/pallets/staking/src/testing_utils.rs index e041204e99..27b7edb82c 100644 --- a/pallets/staking/src/testing_utils.rs +++ b/pallets/staking/src/testing_utils.rs @@ -39,7 +39,9 @@ const SEED: u32 = 0; /// This function removes all validators and nominators from storage. pub fn clear_validators_and_nominators() { + #[allow(deprecated)] Validators::::remove_all(None); + #[allow(deprecated)] Nominators::::remove_all(None); } diff --git a/pallets/statistics/Cargo.toml b/pallets/statistics/Cargo.toml index 0f60cd3b2f..2976c53afb 100644 --- a/pallets/statistics/Cargo.toml +++ b/pallets/statistics/Cargo.toml @@ -17,12 +17,12 @@ serde_derive = { version = "1.0.112", optional = true, default-features = false} # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } -sp-arithmetic = { version = "5.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-arithmetic = { version = "6.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } @@ -31,7 +31,7 @@ pallet-timestamp = { version = "4.0.0-dev", default-features = false } pallet-session = { version = "4.0.0-dev", default-features = false } # Only in STD -substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-05-2", optional = true} +substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-12", optional = true} # Only in Benchmarks frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true } diff --git a/pallets/statistics/src/lib.rs b/pallets/statistics/src/lib.rs index 3c7953177a..56c875ac92 100644 --- a/pallets/statistics/src/lib.rs +++ b/pallets/statistics/src/lib.rs @@ -34,7 +34,7 @@ use polymesh_primitives::{ transfer_compliance::*, Balance, IdentityId, ScopeId, Ticker, }; -use sp_std::{collections::btree_set::BTreeSet, vec::Vec}; +use sp_std::{collections::btree_set::BTreeSet, vec, vec::Vec}; type Identity = pallet_identity::Module; type ExternalAgents = pallet_external_agents::Module; @@ -66,7 +66,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; /// initialize the default event for this module @@ -158,7 +158,7 @@ decl_module! { impl Module { fn ensure_asset_perms( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, ) -> Result { match asset { @@ -171,7 +171,7 @@ impl Module { } fn base_set_active_asset_stats( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, stat_types: BTreeSet, ) -> DispatchResult { @@ -210,6 +210,7 @@ impl Module { // Cleanup storage for old types to be removed. for stat_type in &remove_types { // Cleanup storage for this stat type, since it is being removed. + #[allow(deprecated)] AssetStats::remove_prefix( Stat1stKey { asset, @@ -233,7 +234,7 @@ impl Module { } fn base_batch_update_asset_stats( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, stat_type: StatType, values: BTreeSet, @@ -268,7 +269,7 @@ impl Module { } fn base_set_asset_transfer_compliance( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, transfer_conditions: BTreeSet, ) -> DispatchResult { @@ -310,7 +311,7 @@ impl Module { } fn base_set_entities_exempt( - origin: T::Origin, + origin: T::RuntimeOrigin, is_exempt: bool, exempt_key: TransferConditionExemptKey, entities: BTreeSet, diff --git a/pallets/sto/Cargo.toml b/pallets/sto/Cargo.toml index b3af24a53b..02ae831737 100644 --- a/pallets/sto/Cargo.toml +++ b/pallets/sto/Cargo.toml @@ -23,10 +23,10 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } pallet-timestamp = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/sto/src/lib.rs b/pallets/sto/src/lib.rs index 81c5e39cba..a2d26e3d50 100644 --- a/pallets/sto/src/lib.rs +++ b/pallets/sto/src/lib.rs @@ -175,7 +175,7 @@ pub trait Config: + pallet_base::Config { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Weight information for extrinsic of the sto pallet. type WeightInfo: WeightInfo; } @@ -269,7 +269,7 @@ decl_storage! { } decl_module! { - pub struct Module for enum Call where origin: ::Origin { + pub struct Module for enum Call where origin: ::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -598,7 +598,7 @@ decl_module! { impl Module { fn set_frozen( - origin: T::Origin, + origin: T::RuntimeOrigin, offering_asset: Ticker, id: FundraiserId, frozen: bool, diff --git a/pallets/sudo/Cargo.toml b/pallets/sudo/Cargo.toml index 752d16c179..8e9dfba8c6 100644 --- a/pallets/sudo/Cargo.toml +++ b/pallets/sudo/Cargo.toml @@ -16,14 +16,14 @@ targets = ["x86_64-unknown-linux-gnu"] serde = { version = "1.0.104", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false} -sp-runtime = { version = "6.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false} +sp-runtime = { version = "7.0.0", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } [dev-dependencies] -sp-core = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } [features] default = ["std"] diff --git a/pallets/sudo/README.md b/pallets/sudo/README.md index 95ca7ce88d..575e02021f 100644 --- a/pallets/sudo/README.md +++ b/pallets/sudo/README.md @@ -41,7 +41,7 @@ use frame_system::ensure_root; pub trait Config: frame_system::Config {} decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { #[weight = 0] pub fn privileged_function(origin) -> dispatch::DispatchResult { ensure_root(origin)?; diff --git a/pallets/sudo/src/lib.rs b/pallets/sudo/src/lib.rs index 32cb520ef5..af892e7b83 100644 --- a/pallets/sudo/src/lib.rs +++ b/pallets/sudo/src/lib.rs @@ -58,7 +58,7 @@ //! pub trait Trait: frame_system::Config {} //! //! decl_module! { -//! pub struct Module for enum Call where origin: T::Origin { +//! pub struct Module for enum Call where origin: T::RuntimeOrigin { //! #[weight = 0] //! pub fn privileged_function(origin) -> dispatch::DispatchResult { //! ensure_root(origin)?; @@ -90,11 +90,12 @@ use sp_runtime::{traits::StaticLookup, DispatchResult}; use sp_std::prelude::*; -use frame_support::{decl_error, decl_event, decl_module, decl_storage, ensure, Parameter}; +use frame_support::{decl_error, decl_event, decl_module, decl_storage, Parameter}; use frame_support::{ - dispatch::DispatchResultWithPostInfo, + dispatch::{ + DispatchErrorWithPostInfo, DispatchResultWithPostInfo, GetDispatchInfo, Pays, Weight, + }, traits::{Get, UnfilteredDispatchable}, - weights::{GetDispatchInfo, Pays, Weight}, }; use frame_system::ensure_signed; @@ -103,17 +104,21 @@ mod mock; #[cfg(test)] mod tests; +pub const MIN_WEIGHT: Weight = Weight::from_ref_time(1_000); + pub trait Config: frame_system::Config { /// The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// A sudo-able call. - type Call: Parameter + UnfilteredDispatchable + GetDispatchInfo; + type RuntimeCall: Parameter + + UnfilteredDispatchable + + GetDispatchInfo; } decl_module! { /// Sudo module declaration. - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -130,12 +135,10 @@ decl_module! { /// # #[weight = { let dispatch_info = call.get_dispatch_info(); - (dispatch_info.weight.saturating_add(10_000), dispatch_info.class) + (dispatch_info.weight.max(MIN_WEIGHT), dispatch_info.class) }] - fn sudo(origin, call: Box<::Call>) -> DispatchResultWithPostInfo { - // This is a public call, so we ensure that the origin is some signed account. - let sender = ensure_signed(origin)?; - ensure!(sender == Self::key(), Error::::RequireSudo); + fn sudo(origin, call: Box<::RuntimeCall>) -> DispatchResultWithPostInfo { + Self::ensure_sudo(origin)?; let res = call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()); Self::deposit_event(RawEvent::Sudid(res.map(|_| ()).map_err(|e| e.error))); @@ -153,11 +156,9 @@ decl_module! { /// - O(1). /// - The weight of this call is defined by the caller. /// # - #[weight = (*_weight, call.get_dispatch_info().class)] - fn sudo_unchecked_weight(origin, call: Box<::Call>, _weight: Weight) -> DispatchResultWithPostInfo { - // This is a public call, so we ensure that the origin is some signed account. - let sender = ensure_signed(origin)?; - ensure!(sender == Self::key(), Error::::RequireSudo); + #[weight = (_weight.max(MIN_WEIGHT), call.get_dispatch_info().class)] + fn sudo_unchecked_weight(origin, call: Box<::RuntimeCall>, _weight: Weight) -> DispatchResultWithPostInfo { + Self::ensure_sudo(origin)?; let res = call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()); Self::deposit_event(RawEvent::Sudid(res.map(|_| ()).map_err(|e| e.error))); @@ -174,11 +175,9 @@ decl_module! { /// - Limited storage reads. /// - One DB change. /// # - #[weight = 0] + #[weight = MIN_WEIGHT] fn set_key(origin, new: ::Source) -> DispatchResultWithPostInfo { - // This is a public call, so we ensure that the origin is some signed account. - let sender = ensure_signed(origin)?; - ensure!(sender == Self::key(), Error::::RequireSudo); + Self::ensure_sudo(origin)?; let new = T::Lookup::lookup(new)?; Self::deposit_event(RawEvent::KeyChanged(Self::key())); @@ -201,8 +200,7 @@ decl_module! { #[weight = { let dispatch_info = call.get_dispatch_info(); ( - dispatch_info.weight - .saturating_add(10_000) + dispatch_info.weight.max(MIN_WEIGHT) // AccountData for inner call origin accountdata. .saturating_add(T::DbWeight::get().reads_writes(1, 1)), dispatch_info.class, @@ -210,11 +208,9 @@ decl_module! { }] fn sudo_as(origin, who: ::Source, - call: Box<::Call> + call: Box<::RuntimeCall> ) -> DispatchResultWithPostInfo { - // This is a public call, so we ensure that the origin is some signed account. - let sender = ensure_signed(origin)?; - ensure!(sender == Self::key(), Error::::RequireSudo); + Self::ensure_sudo(origin)?; let who = T::Lookup::lookup(who)?; @@ -227,6 +223,23 @@ decl_module! { } } +impl Module { + /// Ensure `origin` is from the current Sudo key. + fn ensure_sudo(origin: T::RuntimeOrigin) -> DispatchResultWithPostInfo { + // Only allow signed origins. + let sender = ensure_signed(origin)?; + // Ensure the signer is the current Sudo key. + if sender != Self::key() { + // roughly same as a 4 byte remark since perbill is u32. + return Err(DispatchErrorWithPostInfo { + post_info: Some(MIN_WEIGHT).into(), + error: Error::::RequireSudo.into(), + }); + } + Ok(().into()) + } +} + decl_event!( pub enum Event where diff --git a/pallets/sudo/src/mock.rs b/pallets/sudo/src/mock.rs index bfa59aad8e..7daeacc823 100644 --- a/pallets/sudo/src/mock.rs +++ b/pallets/sudo/src/mock.rs @@ -33,7 +33,7 @@ pub mod logger { use frame_system::{ensure_root, ensure_signed}; pub trait Config: frame_system::Config { - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; } decl_storage! { @@ -51,7 +51,7 @@ pub mod logger { } decl_module! { - pub struct Module for enum Call where origin: ::Origin { + pub struct Module for enum Call where origin: ::RuntimeOrigin { fn deposit_event() = default; #[weight = *weight] @@ -91,7 +91,7 @@ frame_support::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(); } @@ -100,8 +100,8 @@ impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type BlockWeights = (); type BlockLength = (); - type Origin = Origin; - type Call = Call; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -109,7 +109,7 @@ impl frame_system::Config for Test { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type Event = Event; + type RuntimeEvent = RuntimeEvent; type BlockHashCount = BlockHashCount; type DbWeight = (); type Version = (); @@ -124,12 +124,12 @@ impl frame_system::Config for Test { } impl sudo::Config for Test { - type Event = Event; - type Call = Call; + type RuntimeEvent = RuntimeEvent; + type RuntimeCall = RuntimeCall; } impl logger::Config for Test { - type Event = Event; + type RuntimeEvent = RuntimeEvent; } // New types for dispatchable functions. diff --git a/pallets/sudo/src/tests.rs b/pallets/sudo/src/tests.rs index 108b85b713..c62af034e0 100644 --- a/pallets/sudo/src/tests.rs +++ b/pallets/sudo/src/tests.rs @@ -19,7 +19,10 @@ use super::*; use frame_support::{assert_noop, assert_ok}; -use mock::{new_test_ext, Call, Event, Logger, LoggerCall, Origin, Sudo, SudoCall, System, Test}; +use mock::{ + new_test_ext, Logger, LoggerCall, RuntimeCall, RuntimeEvent, RuntimeOrigin, Sudo, SudoCall, + System, Test, +}; #[test] fn test_setup_works() { @@ -36,21 +39,24 @@ fn sudo_basics() { // Configure a default test environment and set the root `key` to 1. new_test_ext(1).execute_with(|| { // A privileged function should work when `sudo` is passed the root `key` as `origin`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1_000, + weight: Weight::from_ref_time(1_000), })); - assert_ok!(Sudo::sudo(Origin::signed(1), call)); + assert_ok!(Sudo::sudo(RuntimeOrigin::signed(1), call)); assert_eq!(Logger::i32_log(), vec![42i32]); // A privileged function should not work when `sudo` is passed a non-root `key` as `origin`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1_000, + weight: Weight::from_ref_time(1_000), })); assert_noop!( - Sudo::sudo(Origin::signed(2), call), - Error::::RequireSudo + Sudo::sudo(RuntimeOrigin::signed(2), call), + DispatchErrorWithPostInfo { + post_info: Some(MIN_WEIGHT).into(), + error: Error::::RequireSudo.into(), + } ); }); } @@ -62,12 +68,12 @@ fn sudo_emits_events_correctly() { System::set_block_number(1); // Should emit event to indicate success when called with the root `key` and `call` is `Ok`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1, + weight: Weight::from_ref_time(1), })); - assert_ok!(Sudo::sudo(Origin::signed(1), call)); - let expected_event = Event::Sudo(RawEvent::Sudid(Ok(()))); + assert_ok!(Sudo::sudo(RuntimeOrigin::signed(1), call)); + let expected_event = RuntimeEvent::Sudo(RawEvent::Sudid(Ok(()))); assert!(System::events().iter().any(|a| a.event == expected_event)); }) } @@ -76,36 +82,47 @@ fn sudo_emits_events_correctly() { fn sudo_unchecked_weight_basics() { new_test_ext(1).execute_with(|| { // A privileged function should work when `sudo` is passed the root `key` as origin. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1_000, + weight: Weight::from_ref_time(1_000), })); - assert_ok!(Sudo::sudo_unchecked_weight(Origin::signed(1), call, 1_000)); + assert_ok!(Sudo::sudo_unchecked_weight( + RuntimeOrigin::signed(1), + call, + Weight::from_ref_time(1_000) + )); assert_eq!(Logger::i32_log(), vec![42i32]); // A privileged function should not work when called with a non-root `key`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1_000, + weight: Weight::from_ref_time(1_000), })); assert_noop!( - Sudo::sudo_unchecked_weight(Origin::signed(2), call, 1_000), - Error::::RequireSudo, + Sudo::sudo_unchecked_weight( + RuntimeOrigin::signed(2), + call, + Weight::from_ref_time(1_000) + ), + DispatchErrorWithPostInfo { + post_info: Some(MIN_WEIGHT).into(), + error: Error::::RequireSudo.into(), + } ); // `I32Log` is unchanged after unsuccessful call. assert_eq!(Logger::i32_log(), vec![42i32]); // Controls the dispatched weight. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1, + weight: Weight::from_ref_time(1), })); let sudo_unchecked_weight_call = SudoCall::sudo_unchecked_weight { call, - _weight: 1_000, + _weight: Weight::from_ref_time(1_000), }; let info = sudo_unchecked_weight_call.get_dispatch_info(); - assert_eq!(info.weight, 1_000); + assert_eq!(info.weight, Weight::from_ref_time(1_000)); }); } @@ -116,12 +133,16 @@ fn sudo_unchecked_weight_emits_events_correctly() { System::set_block_number(1); // Should emit event to indicate success when called with the root `key` and `call` is `Ok`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1, + weight: Weight::from_ref_time(1), })); - assert_ok!(Sudo::sudo_unchecked_weight(Origin::signed(1), call, 1_000)); - let expected_event = Event::Sudo(RawEvent::Sudid(Ok(()))); + assert_ok!(Sudo::sudo_unchecked_weight( + RuntimeOrigin::signed(1), + call, + Weight::from_ref_time(1_000) + )); + let expected_event = RuntimeEvent::Sudo(RawEvent::Sudid(Ok(()))); assert!(System::events().iter().any(|a| a.event == expected_event)); }) } @@ -130,15 +151,18 @@ fn sudo_unchecked_weight_emits_events_correctly() { fn set_key_basics() { new_test_ext(1).execute_with(|| { // A root `key` can change the root `key` - assert_ok!(Sudo::set_key(Origin::signed(1), 2)); + assert_ok!(Sudo::set_key(RuntimeOrigin::signed(1), 2)); assert_eq!(Sudo::key(), 2u64); }); new_test_ext(1).execute_with(|| { // A non-root `key` will trigger a `RequireSudo` error and a non-root `key` cannot change the root `key`. assert_noop!( - Sudo::set_key(Origin::signed(2), 3), - Error::::RequireSudo + Sudo::set_key(RuntimeOrigin::signed(2), 3), + DispatchErrorWithPostInfo { + post_info: Some(MIN_WEIGHT).into(), + error: Error::::RequireSudo.into(), + } ); }); } @@ -150,12 +174,12 @@ fn set_key_emits_events_correctly() { System::set_block_number(1); // A root `key` can change the root `key`. - assert_ok!(Sudo::set_key(Origin::signed(1), 2)); - let expected_event = Event::Sudo(RawEvent::KeyChanged(1)); + assert_ok!(Sudo::set_key(RuntimeOrigin::signed(1), 2)); + let expected_event = RuntimeEvent::Sudo(RawEvent::KeyChanged(1)); assert!(System::events().iter().any(|a| a.event == expected_event)); // Double check. - assert_ok!(Sudo::set_key(Origin::signed(2), 4)); - let expected_event = Event::Sudo(RawEvent::KeyChanged(2)); + assert_ok!(Sudo::set_key(RuntimeOrigin::signed(2), 4)); + let expected_event = RuntimeEvent::Sudo(RawEvent::KeyChanged(2)); assert!(System::events().iter().any(|a| a.event == expected_event)); }); } @@ -164,30 +188,33 @@ fn set_key_emits_events_correctly() { fn sudo_as_basics() { new_test_ext(1).execute_with(|| { // A privileged function will not work when passed to `sudo_as`. - let call = Box::new(Call::Logger(LoggerCall::privileged_i32_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::privileged_i32_log { i: 42, - weight: 1_000, + weight: Weight::from_ref_time(1_000), })); - assert_ok!(Sudo::sudo_as(Origin::signed(1), 2, call)); + assert_ok!(Sudo::sudo_as(RuntimeOrigin::signed(1), 2, call)); assert!(Logger::i32_log().is_empty()); assert!(Logger::account_log().is_empty()); // A non-privileged function should not work when called with a non-root `key`. - let call = Box::new(Call::Logger(LoggerCall::non_privileged_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::non_privileged_log { i: 42, - weight: 1, + weight: Weight::from_ref_time(1), })); assert_noop!( - Sudo::sudo_as(Origin::signed(3), 2, call), - Error::::RequireSudo + Sudo::sudo_as(RuntimeOrigin::signed(3), 2, call), + DispatchErrorWithPostInfo { + post_info: Some(MIN_WEIGHT).into(), + error: Error::::RequireSudo.into(), + } ); // A non-privileged function will work when passed to `sudo_as` with the root `key`. - let call = Box::new(Call::Logger(LoggerCall::non_privileged_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::non_privileged_log { i: 42, - weight: 1, + weight: Weight::from_ref_time(1), })); - assert_ok!(Sudo::sudo_as(Origin::signed(1), 2, call)); + assert_ok!(Sudo::sudo_as(RuntimeOrigin::signed(1), 2, call)); assert_eq!(Logger::i32_log(), vec![42i32]); // The correct user makes the call within `sudo_as`. assert_eq!(Logger::account_log(), vec![2]); @@ -201,12 +228,12 @@ fn sudo_as_emits_events_correctly() { System::set_block_number(1); // A non-privileged function will work when passed to `sudo_as` with the root `key`. - let call = Box::new(Call::Logger(LoggerCall::non_privileged_log { + let call = Box::new(RuntimeCall::Logger(LoggerCall::non_privileged_log { i: 42, - weight: 1, + weight: Weight::from_ref_time(1), })); - assert_ok!(Sudo::sudo_as(Origin::signed(1), 2, call)); - let expected_event = Event::Sudo(RawEvent::SudoAsDone(Ok(()))); + assert_ok!(Sudo::sudo_as(RuntimeOrigin::signed(1), 2, call)); + let expected_event = RuntimeEvent::Sudo(RawEvent::SudoAsDone(Ok(()))); assert!(System::events().iter().any(|a| a.event == expected_event)); }); } diff --git a/pallets/test-utils/Cargo.toml b/pallets/test-utils/Cargo.toml index d0bda41d58..a1e0c1d162 100644 --- a/pallets/test-utils/Cargo.toml +++ b/pallets/test-utils/Cargo.toml @@ -16,11 +16,11 @@ serde = { version = "1.0.104", default-features = false } serde_derive = { version = "1.0.104", optional = true, default-features = false } # Crypto -confidential_identity_v1 = { version = "1.0.1", default-features = false } +confidential_identity_v1 = { version = "1.1.0", default-features = false } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } frame-system = { version = "4.0.0-dev", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/test-utils/src/lib.rs b/pallets/test-utils/src/lib.rs index 41c2139a43..3b89c7bb1e 100644 --- a/pallets/test-utils/src/lib.rs +++ b/pallets/test-utils/src/lib.rs @@ -68,7 +68,7 @@ pub trait WeightInfo { } pub trait Config: IdentityConfig { - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// Weight information for extrinsics in the identity pallet. type WeightInfo: WeightInfo; } @@ -101,7 +101,7 @@ decl_error! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; diff --git a/pallets/transaction-payment/Cargo.toml b/pallets/transaction-payment/Cargo.toml index 81e0b1a2e6..83bf321eb1 100644 --- a/pallets/transaction-payment/Cargo.toml +++ b/pallets/transaction-payment/Cargo.toml @@ -15,10 +15,10 @@ serde = { version = "1.0.104", default-features = false, optional = true } # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } pallet-timestamp = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/transaction-payment/src/lib.rs b/pallets/transaction-payment/src/lib.rs index 305f91a2e4..cb6029262a 100644 --- a/pallets/transaction-payment/src/lib.rs +++ b/pallets/transaction-payment/src/lib.rs @@ -21,7 +21,7 @@ //! # Transaction Payment Module //! -//! This module provides the basic logic needed to pay the absolute minimum amount needed for a +//! This pallet provides the basic logic needed to pay the absolute minimum amount needed for a //! transaction to be included. This includes: //! - _base fee_: This is the minimum amount a user pays for a transaction. It is declared //! as a base _weight_ in the runtime and converted to a fee using `WeightToFee`. @@ -42,7 +42,7 @@ //! - `targeted_fee_adjustment`: This is a multiplier that can tune the final fee based on //! the congestion of the network. //! -//! Additionally, this module allows one to configure: +//! Additionally, this pallet allows one to configure: //! - The mapping between one unit of weight to one unit of fee via [`Config::WeightToFee`]. //! - A means of updating the fee for the next block, via defining a multiplier, based on the //! final state of the chain at the end of the previous block. This can be configured via @@ -51,15 +51,15 @@ #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode}; +use codec::{Decode, Encode, MaxEncodedLen}; use frame_support::{ - decl_module, decl_storage, - dispatch::DispatchResult, - traits::{Currency, Get, GetCallMetadata}, - weights::{ - DispatchClass, DispatchInfo, GetDispatchInfo, Pays, PostDispatchInfo, Weight, - WeightToFeeCoefficient, WeightToFeePolynomial, + decl_event, decl_module, decl_storage, + dispatch::{ + DispatchClass, DispatchInfo, DispatchResult, GetDispatchInfo, Pays, PostDispatchInfo, + Weight, }, + traits::{Currency, Get, GetCallMetadata}, + weights::{WeightToFee, WeightToFeeCoefficient, WeightToFeePolynomial}, }; use polymesh_common_utilities::traits::{ group::GroupTrait, @@ -96,7 +96,7 @@ type BalanceOf = <::OnChargeTransaction as OnChargeTransaction`, meaning that it can convert the previous multiplier to the next one. This should /// be called on `on_finalize` of a block, prior to potentially cleaning the weight data from the -/// system module. +/// system pallet. /// /// given: /// s = previous block weight @@ -138,12 +138,14 @@ type BalanceOf = <::OnChargeTransaction as OnChargeTransaction -pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData<(T, S, V, M)>); +pub struct TargetedFeeAdjustment(sp_std::marker::PhantomData<(T, S, V, M, X)>); /// Something that can convert the current multiplier to the next one. pub trait MultiplierUpdate: Convert { - /// Minimum multiplier + /// Minimum multiplier. Any outcome of the `convert` function should be at least this. fn min() -> Multiplier; + /// Maximum multiplier. Any outcome of the `convert` function should be less or equal this. + fn max() -> Multiplier; /// Target block saturation level fn target() -> Perquintill; /// Variability factor @@ -154,6 +156,9 @@ impl MultiplierUpdate for () { fn min() -> Multiplier { Default::default() } + fn max() -> Multiplier { + ::max_value() + } fn target() -> Perquintill { Default::default() } @@ -162,16 +167,20 @@ impl MultiplierUpdate for () { } } -impl MultiplierUpdate for TargetedFeeAdjustment +impl MultiplierUpdate for TargetedFeeAdjustment where T: frame_system::Config, S: Get, V: Get, M: Get, + X: Get, { fn min() -> Multiplier { M::get() } + fn max() -> Multiplier { + X::get() + } fn target() -> Perquintill { S::get() } @@ -180,18 +189,20 @@ where } } -impl Convert for TargetedFeeAdjustment +impl Convert for TargetedFeeAdjustment where T: frame_system::Config, S: Get, V: Get, M: Get, + X: Get, { fn convert(previous: Multiplier) -> Multiplier { // Defensive only. The multiplier in storage should always be at most positive. Nonetheless // we recover here in case of errors, because any value below this would be stale and can // never change. let min_multiplier = M::get(); + let max_multiplier = X::get(); let previous = previous.max(min_multiplier); let weights = T::BlockWeights::get(); @@ -201,9 +212,13 @@ where .max_total .unwrap_or_else(|| weights.max_block); let current_block_weight = >::block_weight(); - let normal_block_weight = *current_block_weight + let normal_block_weight = current_block_weight .get(DispatchClass::Normal) - .min(&normal_max_weight); + .min(normal_max_weight); + + // TODO: Handle all weight dimensions + let normal_max_weight = normal_max_weight.ref_time(); + let normal_block_weight = normal_block_weight.ref_time(); let s = S::get(); let v = V::get(); @@ -229,21 +244,62 @@ where let excess = first_term .saturating_add(second_term) .saturating_mul(previous); - previous.saturating_add(excess).max(min_multiplier) + previous + .saturating_add(excess) + .clamp(min_multiplier, max_multiplier) } else { // Defensive-only: first_term > second_term. Safe subtraction. let negative = first_term .saturating_sub(second_term) .saturating_mul(previous); - previous.saturating_sub(negative).max(min_multiplier) + previous + .saturating_sub(negative) + .clamp(min_multiplier, max_multiplier) } } } -/// Storage releases of the module. -#[derive(Encode, Decode, Clone, Copy, PartialEq, Eq, RuntimeDebug, TypeInfo)] +/// A struct to make the fee multiplier a constant +pub struct ConstFeeMultiplier>(sp_std::marker::PhantomData); + +impl> MultiplierUpdate for ConstFeeMultiplier { + fn min() -> Multiplier { + M::get() + } + fn max() -> Multiplier { + M::get() + } + fn target() -> Perquintill { + Default::default() + } + fn variability() -> Multiplier { + Default::default() + } +} + +impl Convert for ConstFeeMultiplier +where + M: Get, +{ + fn convert(_previous: Multiplier) -> Multiplier { + Self::min() + } +} + +/// Storage releases of the pallet. +#[derive( + Encode, + Decode, + Clone, + Copy, + PartialEq, + Eq, + RuntimeDebug, + TypeInfo, + MaxEncodedLen +)] enum Releases { - /// Original version of the module. + /// Original version of the pallet. V1Ancient, /// One that bumps the usage to FixedU128 from FixedI128. V2, @@ -256,6 +312,9 @@ impl Default for Releases { } pub trait Config: frame_system::Config + pallet_timestamp::Config { + /// The overarching event type. + type RuntimeEvent: From> + Into<::RuntimeEvent>; + /// The currency type in which fees will be paid. type Currency: Currency + Send + Sync; @@ -278,18 +337,22 @@ pub trait Config: frame_system::Config + pallet_timestamp::Config { // Polymesh note: This was specifically added for Polymesh /// Fetch the signatory to charge fee from. Also sets fee payer and identity in context. - type CddHandler: CddAndFeeDetails; + type CddHandler: CddAndFeeDetails; + // Polymesh note: This was specifically added for Polymesh /// Connection to the `Relayer` pallet. /// Used to charge transaction fees to a subsidiser, if any, instead of the payer. type Subsidiser: SubsidiserTrait; + // Polymesh note: This was specifically added for Polymesh /// CDD providers group. type CddProviders: GroupTrait; + // Polymesh note: This was specifically added for Polymesh /// Governance committee. type GovernanceCommittee: GroupTrait; + // Polymesh note: This was specifically added for Polymesh /// Identity functionality. type Identity: IdentityFnTrait; } @@ -302,8 +365,22 @@ decl_storage! { } } +decl_event! { + pub enum Event + where + Balance = BalanceOf, + AccountId = ::AccountId, + { + /// A transaction fee `actual_fee`, of which `tip` was added to the minimum inclusion fee, + /// has been paid by `who`. + TransactionFeePaid { who: AccountId, actual_fee: Balance, tip: Balance }, + } +} + decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { + fn deposit_event() = default; + /// The fee to be paid for making a transaction; the per-byte portion. const TransactionByteFee: BalanceOf = T::TransactionByteFee::get(); @@ -311,7 +388,7 @@ decl_module! { const WeightToFee: Vec>> = T::WeightToFee::polynomial().to_vec(); - // Polymesh specific change: Fee multiplier update has been disabled for the testnet. + // Polymesh specific change: Fee multiplier update has been disabled for the testnet. fn integrity_test() { // given weight == u64, we build multipliers from `diff` of two weight values, which can @@ -320,7 +397,7 @@ decl_module! { assert!( ::max_value() >= Multiplier::checked_from_integer::( - T::BlockWeights::get().max_block + T::BlockWeights::get().max_block.ref_time() ).unwrap(), ); @@ -328,8 +405,7 @@ decl_module! { // value, we can recover with a reasonable amount of traffic. For this test we assert // that if we collapse to minimum, the trend will be positive with a weight value // which is 1% more than the target. - let min_value = T::FeeMultiplierUpdate::min(); - let mut target = T::FeeMultiplierUpdate::target() * + let target = T::FeeMultiplierUpdate::target() * T::BlockWeights::get().get(DispatchClass::Normal).max_total.expect( "Setting `max_total` for `Normal` dispatch class is not compatible with \ `transaction-payment` pallet." @@ -337,13 +413,21 @@ decl_module! { // add 1 percent; let addition = target / 100; - if addition == 0 { + if addition == Weight::zero() { // this is most likely because in a test setup we set everything to (). return; } - target += addition; + #[cfg(any(feature = "std", test))] sp_io::TestExternalities::new_empty().execute_with(|| { + // This is the minimum value of the multiplier. Make sure that if we collapse to + // this value, we can recover with a reasonable amount of traffic. For this test we + // assert that if we collapse to minimum, the trend will be positive with a weight + // value which is 1% more than the target. + let min_value = T::FeeMultiplierUpdate::min(); + + let target = target + addition; + >::set_block_consumed_resources(target, 0); let next = T::FeeMultiplierUpdate::convert(min_value); assert!(next > min_value, "The minimum bound of the multiplier is too low. When \ @@ -361,18 +445,18 @@ where { /// Query the data that we know about the fee of a given `call`. /// - /// This module is not and cannot be aware of the internals of a signed extension, for example + /// This pallet is not and cannot be aware of the internals of a signed extension, for example /// a tip. It only interprets the extrinsic as some encoded value and accounts for its weight /// and length, the runtime's extrinsic base weight, and the current fee multiplier. /// /// All dispatchables must be annotated with weight and will have some fee info. This function /// always returns. - pub fn query_info( + pub fn query_info( unchecked_extrinsic: Extrinsic, len: u32, ) -> RuntimeDispatchInfo> where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { // NOTE: we can actually make it understand `ChargeTransactionPayment`, but would be some // hassle for sure. We have to make it aware of the index of `ChargeTransactionPayment` in @@ -381,7 +465,13 @@ where // a very very little potential gain in the future. let dispatch_info = ::get_dispatch_info(&unchecked_extrinsic); - let partial_fee = Self::compute_fee(len, &dispatch_info, 0u32.into()); + let partial_fee = if unchecked_extrinsic.is_signed().unwrap_or(false) { + Self::compute_fee(len, &dispatch_info, 0u32.into()) + } else { + // Unsigned extrinsics have no partial fee. + 0u32.into() + }; + let DispatchInfo { weight, class, .. } = dispatch_info; RuntimeDispatchInfo { @@ -392,21 +482,62 @@ where } /// Query the detailed fee of a given `call`. - pub fn query_fee_details( + pub fn query_fee_details( unchecked_extrinsic: Extrinsic, len: u32, ) -> FeeDetails> where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { let dispatch_info = ::get_dispatch_info(&unchecked_extrinsic); - Self::compute_fee_details(len, &dispatch_info, 0u32.into()) + + let tip = 0u32.into(); + + if unchecked_extrinsic.is_signed().unwrap_or(false) { + Self::compute_fee_details(len, &dispatch_info, tip) + } else { + // Unsigned extrinsics have no inclusion fee. + FeeDetails { + inclusion_fee: None, + tip, + } + } + } + + /// Query information of a dispatch class, weight, and fee of a given encoded `Call`. + pub fn query_call_info(call: T::RuntimeCall, len: u32) -> RuntimeDispatchInfo> + where + T::RuntimeCall: Dispatchable + GetDispatchInfo, + { + let dispatch_info = ::get_dispatch_info(&call); + let DispatchInfo { weight, class, .. } = dispatch_info; + + RuntimeDispatchInfo { + weight, + class, + partial_fee: Self::compute_fee(len, &dispatch_info, 0u32.into()), + } + } + + /// Query fee details of a given encoded `Call`. + pub fn query_call_fee_details(call: T::RuntimeCall, len: u32) -> FeeDetails> + where + T::RuntimeCall: Dispatchable + GetDispatchInfo, + { + let dispatch_info = ::get_dispatch_info(&call); + let tip = 0u32.into(); + + Self::compute_fee_details(len, &dispatch_info, tip) } /// Compute the final fee value for a particular transaction. - pub fn compute_fee(len: u32, info: &DispatchInfoOf, tip: BalanceOf) -> BalanceOf + pub fn compute_fee( + len: u32, + info: &DispatchInfoOf, + tip: BalanceOf, + ) -> BalanceOf where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { Self::compute_fee_details(len, info, tip).final_fee() } @@ -414,11 +545,11 @@ where /// Compute the fee details for a particular transaction. pub fn compute_fee_details( len: u32, - info: &DispatchInfoOf, + info: &DispatchInfoOf, tip: BalanceOf, ) -> FeeDetails> where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { Self::compute_fee_raw(len, info.weight, tip, info.pays_fee, info.class) } @@ -429,12 +560,12 @@ where /// weight is used for the weight fee calculation. pub fn compute_actual_fee( len: u32, - info: &DispatchInfoOf, - post_info: &PostDispatchInfoOf, + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, tip: BalanceOf, ) -> BalanceOf where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { Self::compute_actual_fee_details(len, info, post_info, tip).final_fee() } @@ -442,12 +573,12 @@ where /// Compute the actual post dispatch fee details for a particular transaction. pub fn compute_actual_fee_details( len: u32, - info: &DispatchInfoOf, - post_info: &PostDispatchInfoOf, + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, tip: BalanceOf, ) -> FeeDetails> where - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { Self::compute_fee_raw( len, @@ -466,12 +597,6 @@ where class: DispatchClass, ) -> FeeDetails> { if pays_fee == Pays::Yes { - let len = >::from(len); - let per_byte = T::TransactionByteFee::get(); - - // length fee. this is not adjusted. - let fixed_len_fee = per_byte.saturating_mul(len); - // the adjustable part of the fee. let unadjusted_weight_fee = Self::weight_to_fee(weight); let multiplier = Self::next_fee_multiplier(); @@ -479,11 +604,14 @@ where // final adjusted weight fee. let adjusted_weight_fee = multiplier.saturating_mul_int(unadjusted_weight_fee); + // length fee. this is adjusted via `LengthToFee`. + let len_fee = Self::length_to_fee(len); + let base_fee = Self::weight_to_fee(T::BlockWeights::get().get(class).base_extrinsic); FeeDetails { inclusion_fee: Some(InclusionFee { base_fee, - len_fee: fixed_len_fee, + len_fee, adjusted_weight_fee, }), tip, @@ -496,11 +624,18 @@ where } } + fn length_to_fee(length: u32) -> BalanceOf { + let len = >::from(length); + let per_byte = T::TransactionByteFee::get(); + + per_byte.saturating_mul(len) + } + fn weight_to_fee(weight: Weight) -> BalanceOf { // cap the weight to the maximum defined in runtime, otherwise it will be the // `Bounded` maximum of its data type, which is not desired. let capped_weight = weight.min(T::BlockWeights::get().max_block); - T::WeightToFee::calc(&capped_weight) + T::WeightToFee::weight_to_fee(&capped_weight) } /// Polymesh-Note :- Change for the supporting the test @@ -539,7 +674,8 @@ pub struct ChargeTransactionPayment(#[codec(compact)] BalanceOf); impl ChargeTransactionPayment where - T::Call: Dispatchable + GetCallMetadata, + T::RuntimeCall: + Dispatchable + GetCallMetadata, BalanceOf: Send + Sync + FixedPointOperand + Into, { /// utility constructor. Used only in client/factory code. @@ -550,13 +686,15 @@ where fn withdraw_fee( &self, who: &T::AccountId, - call: &T::Call, - info: &DispatchInfoOf, + call: &T::RuntimeCall, + info: &DispatchInfoOf, len: usize, ) -> Result, TransactionValidityError> { let tip = self.0; let fee = Module::::compute_fee(len as u32, info, tip); + // Polymesh: Changed how the tx fee payer is selected. + // Only mess with balances if fee is not zero. if fee.is_zero() { let liquidity_info = Default::default(); @@ -578,13 +716,14 @@ where // key to pay the fee. let fee_key = subsidiser.as_ref().unwrap_or(&payer_key); let liquidity_info = - <::OnChargeTransaction as OnChargeTransaction>::withdraw_fee_with_call( + <::OnChargeTransaction as OnChargeTransaction>::withdraw_fee( fee_key, call, info, fee, tip, )?; T::CddHandler::set_payer_context(Some(payer_key)); Ok((fee, liquidity_info, subsidiser)) } + // Polymesh: Used to allow GC/CDD member to include a `tip`. /// Returns `true` iff `who` is member of `T::GovernanceCommittee` or `T::CddProviders`. fn is_gc_or_cdd_member(who: &T::AccountId) -> bool { T::Identity::get_identity(who) @@ -592,6 +731,7 @@ where .unwrap_or(false) } + // Polymesh: Used to allow GC/CDD member to include a `tip`. /// Ensures that the transaction tip is valid. /// /// We only allow tip != 0 if the transaction is `DispatchClass::Operational` and it was @@ -601,7 +741,7 @@ where fn ensure_valid_tip( &self, who: &T::AccountId, - info: &DispatchInfoOf, + info: &DispatchInfoOf, ) -> Result, TransactionValidityError> { let is_valid_tip = match info.class { DispatchClass::Normal => self.0 == Zero::zero(), @@ -628,14 +768,16 @@ impl sp_std::fmt::Debug for ChargeTransactionPayment { } } +// Polymesh: Almost all of this implementation was changed to enforce zero tip, support subsidiser and charge fee to proper payer. impl SignedExtension for ChargeTransactionPayment where BalanceOf: Send + Sync + From + FixedPointOperand + Into, - T::Call: Dispatchable + GetCallMetadata, + T::RuntimeCall: + Dispatchable + GetCallMetadata, { const IDENTIFIER: &'static str = "ChargeTransactionPayment"; type AccountId = T::AccountId; - type Call = T::Call; + type Call = T::RuntimeCall; type AdditionalSigned = (); type Pre = ( // tip @@ -644,14 +786,13 @@ where Self::AccountId, // Imbalance resulting from withdrawing the fee. <::OnChargeTransaction as OnChargeTransaction>::LiquidityInfo, - // Subsidiser + // Polymesh: Subsidiser Option, ); fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) } - // Polymesh note: Almost all of this function was re written to enforce zero tip and charge fee to proper payer. fn validate( &self, who: &Self::AccountId, @@ -662,8 +803,7 @@ where let tip = self.ensure_valid_tip(who, info)?; let (_fee, _, _) = self.withdraw_fee(who, call, info, len)?; - // NOTE: The priority of TX is just its `tip`, to ensure that operational one can be - // priorized and normal TX will follow the FIFO (defined by its `insertion_id`). + // Polymesh: `tip` can only be used by GC/CDD members. Ok(ValidTransaction { priority: tip.saturated_into::(), ..Default::default() @@ -697,7 +837,7 @@ where // Fee returned to original payer. // If payer context is empty, the fee is returned to the caller account. - let payer = T::CddHandler::get_payer_from_context().unwrap_or(who); + let payer = T::CddHandler::get_payer_from_context().unwrap_or(who.clone()); // `fee_key` is either a subsidiser or the original payer. let fee_key = if let Some(subsidiser_key) = subsidiser { @@ -713,6 +853,11 @@ where T::OnChargeTransaction::correct_and_deposit_fee( &fee_key, info, post_info, actual_fee, tip, imbalance, )?; + Module::::deposit_event(Event::::TransactionFeePaid { + who, + actual_fee, + tip, + }); // It clears the identity and payer in the context after transaction. T::CddHandler::clear_context(); @@ -724,14 +869,12 @@ where impl ChargeTxFee for Module where BalanceOf: FixedPointOperand, - T::Call: Dispatchable, + T::RuntimeCall: Dispatchable, { - fn charge_fee(len: u32, info: DispatchInfoOf) -> TransactionValidity { + fn charge_fee(len: u32, info: DispatchInfoOf) -> TransactionValidity { let fee = Self::compute_fee(len as u32, &info, 0u32.into()); if let Some(payer) = T::CddHandler::get_payer_from_context() { T::OnChargeTransaction::charge_fee(&payer, fee)?; - //let imbalance = <::OnChargeTransaction as OnChargeTransaction>::withdraw_fee(&payer, None, None, fee, tip)?; - //T::OnTransactionPayment::on_unbalanced(imbalance); } Ok(ValidTransaction::default()) } diff --git a/pallets/transaction-payment/src/payment.rs b/pallets/transaction-payment/src/payment.rs index db697d2137..3c1196482e 100644 --- a/pallets/transaction-payment/src/payment.rs +++ b/pallets/transaction-payment/src/payment.rs @@ -1,10 +1,7 @@ -///! Traits and default implementation for paying transaction fees. +/// ! Traits and default implementation for paying transaction fees. use crate::Config; + use codec::FullCodec; -use frame_support::{ - traits::{Currency, ExistenceRequirement, Get, Imbalance, OnUnbalanced, WithdrawReasons}, - unsigned::TransactionValidityError, -}; use sp_runtime::{ traits::{ AtLeast32BitUnsigned, DispatchInfoOf, MaybeSerializeDeserialize, PostDispatchInfoOf, @@ -14,6 +11,11 @@ use sp_runtime::{ }; use sp_std::{fmt::Debug, marker::PhantomData}; +use frame_support::{ + traits::{Currency, ExistenceRequirement, Imbalance, OnUnbalanced, WithdrawReasons}, + unsigned::TransactionValidityError, +}; + type NegativeImbalanceOf = ::AccountId>>::NegativeImbalance; @@ -33,16 +35,10 @@ pub trait OnChargeTransaction { /// need to be secured. /// /// Note: The `fee` already includes the `tip`. - fn withdraw_fee_with_call( - who: &T::AccountId, - call: &T::Call, - dispatch_info: &DispatchInfoOf, - fee: Self::Balance, - tip: Self::Balance, - ) -> Result; - fn withdraw_fee( who: &T::AccountId, + call: &T::RuntimeCall, + dispatch_info: &DispatchInfoOf, fee: Self::Balance, tip: Self::Balance, ) -> Result; @@ -54,26 +50,32 @@ pub trait OnChargeTransaction { /// Note: The `fee` already includes the `tip`. fn correct_and_deposit_fee( who: &T::AccountId, - dispatch_info: &DispatchInfoOf, - post_info: &PostDispatchInfoOf, + dispatch_info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, corrected_fee: Self::Balance, tip: Self::Balance, already_withdrawn: Self::LiquidityInfo, ) -> Result<(), TransactionValidityError>; + /// Polymesh: Used to charge protocal fees. fn charge_fee(who: &T::AccountId, fee: Self::Balance) -> Result<(), TransactionValidityError>; } -/// Implements the transaction payment for a module implementing the `Currency` +/// Implements the transaction payment for a pallet implementing the `Currency` /// trait (eg. the pallet_balances) using an unbalance handler (implementing /// `OnUnbalanced`). +/// +/// The unbalance handler is given 2 unbalanceds in [`OnUnbalanced::on_unbalanceds`]: fee and +/// then tip. pub struct CurrencyAdapter(PhantomData<(C, OU)>); /// Default implementation for a Currency and an OnUnbalanced handler. +/// +/// The unbalance handler is given 2 unbalanceds in [`OnUnbalanced::on_unbalanceds`]: fee and +/// then tip. impl OnChargeTransaction for CurrencyAdapter where T: Config, - T::TransactionByteFee: Get<::AccountId>>::Balance>, C: Currency<::AccountId>, C::PositiveImbalance: Imbalance< ::AccountId>>::Balance, @@ -88,22 +90,13 @@ where type LiquidityInfo = Option>; type Balance = ::AccountId>>::Balance; - /// Before the transaction is executed the payment of the transaction fees - /// need to be secured. + /// Withdraw the predicted fee from the transaction origin. /// /// Note: The `fee` already includes the `tip`. - fn withdraw_fee_with_call( - who: &T::AccountId, - _call: &T::Call, - _dispatch_info: &DispatchInfoOf, - fee: Self::Balance, - tip: Self::Balance, - ) -> Result { - >::withdraw_fee(who, fee, tip) - } - fn withdraw_fee( who: &T::AccountId, + _call: &T::RuntimeCall, + _info: &DispatchInfoOf, fee: Self::Balance, tip: Self::Balance, ) -> Result { @@ -123,24 +116,15 @@ where } } - fn charge_fee(who: &T::AccountId, fee: Self::Balance) -> Result<(), TransactionValidityError> { - let tip = Zero::zero(); - if let Some(imbalance) = >::withdraw_fee(who, fee, tip)? { - OU::on_unbalanced(imbalance); - } - - Ok(()) - } - /// Hand the fee and the tip over to the `[OnUnbalanced]` implementation. /// Since the predicted fee might have been too high, parts of the fee may /// be refunded. /// - /// Note: The `fee` already includes the `tip`. + /// Note: The `corrected_fee` already includes the `tip`. fn correct_and_deposit_fee( who: &T::AccountId, - _dispatch_info: &DispatchInfoOf, - _post_info: &PostDispatchInfoOf, + _dispatch_info: &DispatchInfoOf, + _post_info: &PostDispatchInfoOf, corrected_fee: Self::Balance, tip: Self::Balance, already_withdrawn: Self::LiquidityInfo, @@ -148,11 +132,10 @@ where if let Some(paid) = already_withdrawn { // Calculate how much refund we should return let refund_amount = paid.peek().saturating_sub(corrected_fee); - // refund to the the account that paid the fees. If this fails, the // account might have dropped below the existential balance. In // that case we don't refund anything. - let refund_imbalance = C::deposit_into_existing(&who, refund_amount) + let refund_imbalance = C::deposit_into_existing(who, refund_amount) .unwrap_or_else(|_| C::PositiveImbalance::zero()); // merge the imbalance caused by paying the fees and refunding parts of it again. let adjusted_paid = paid @@ -165,4 +148,24 @@ where } Ok(()) } + + /// Polymesh: Used to charge protocal fees. + fn charge_fee(who: &T::AccountId, fee: Self::Balance) -> Result<(), TransactionValidityError> { + if fee.is_zero() { + return Ok(()); + } + + match C::withdraw( + who, + fee, + WithdrawReasons::TRANSACTION_PAYMENT, + ExistenceRequirement::KeepAlive, + ) { + Ok(imbalance) => { + OU::on_unbalanced(imbalance); + Ok(()) + } + Err(_) => Err(InvalidTransaction::Payment.into()), + } + } } diff --git a/pallets/transaction-payment/src/types.rs b/pallets/transaction-payment/src/types.rs index d121d19321..65fd4171ba 100644 --- a/pallets/transaction-payment/src/types.rs +++ b/pallets/transaction-payment/src/types.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// Copyright (C) 2021-2022 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,12 +18,14 @@ //! Types for transaction-payment RPC. use codec::{Decode, Encode}; -use frame_support::weights::{DispatchClass, Weight}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; + use sp_runtime::traits::{AtLeast32BitUnsigned, Zero}; use sp_std::prelude::*; +use frame_support::dispatch::DispatchClass; + /// The base fee and adjusted weight and length fees constitute the _inclusion fee_. #[derive(Encode, Decode, Clone, Eq, PartialEq)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] @@ -34,8 +36,9 @@ pub struct InclusionFee { pub base_fee: Balance, /// The length fee, the amount paid for the encoded length (in bytes) of the transaction. pub len_fee: Balance, - /// - `targeted_fee_adjustment`: This is a multiplier that can tune the final fee based on - /// the congestion of the network. + /// + /// - `targeted_fee_adjustment`: This is a multiplier that can tune the final fee based on the + /// congestion of the network. /// - `weight_fee`: This amount is computed based on the weight of the transaction. Weight /// accounts for the execution time of a transaction. /// @@ -58,8 +61,8 @@ impl InclusionFee { /// The `FeeDetails` is composed of: /// - (Optional) `inclusion_fee`: Only the `Pays::Yes` transaction can have the inclusion fee. -/// - `tip`: If included in the transaction, the tip will be added on top. Only -/// signed transactions can have a tip. +/// - `tip`: If included in the transaction, the tip will be added on top. Only signed +/// transactions can have a tip. #[derive(Encode, Decode, Clone, Eq, PartialEq)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] @@ -86,19 +89,20 @@ impl FeeDetails { } } -/// Information related to a dispatchable's class, weight, and fee that can be queried from the runtime. +/// Information related to a dispatchable's class, weight, and fee that can be queried from the +/// runtime. #[derive(Eq, PartialEq, Encode, Decode, Default)] #[cfg_attr(feature = "std", derive(Debug, Serialize, Deserialize))] #[cfg_attr(feature = "std", serde(rename_all = "camelCase"))] #[cfg_attr( feature = "std", - serde(bound(serialize = "Balance: std::fmt::Display")) + serde(bound(serialize = "Balance: std::fmt::Display, Weight: Serialize")) )] #[cfg_attr( feature = "std", - serde(bound(deserialize = "Balance: std::str::FromStr")) + serde(bound(deserialize = "Balance: std::str::FromStr, Weight: Deserialize<'de>")) )] -pub struct RuntimeDispatchInfo { +pub struct RuntimeDispatchInfo { /// Weight of this dispatch. pub weight: Weight, /// Class of this dispatch. @@ -134,16 +138,18 @@ mod serde_balance { #[cfg(test)] mod tests { use super::*; + use frame_support::weights::Weight; #[test] fn should_serialize_and_deserialize_properly_with_string() { let info = RuntimeDispatchInfo { - weight: 5, + weight: Weight::from_ref_time(5), class: DispatchClass::Normal, partial_fee: 1_000_000_u64, }; - let json_str = r#"{"weight":5,"class":"normal","partialFee":"1000000"}"#; + let json_str = + r#"{"weight":{"ref_time":5,"proof_size":0},"class":"normal","partialFee":"1000000"}"#; assert_eq!(serde_json::to_string(&info).unwrap(), json_str); assert_eq!( @@ -158,12 +164,12 @@ mod tests { #[test] fn should_serialize_and_deserialize_properly_large_value() { let info = RuntimeDispatchInfo { - weight: 5, + weight: Weight::from_ref_time(5), class: DispatchClass::Normal, partial_fee: u128::max_value(), }; - let json_str = r#"{"weight":5,"class":"normal","partialFee":"340282366920938463463374607431768211455"}"#; + let json_str = r#"{"weight":{"ref_time":5,"proof_size":0},"class":"normal","partialFee":"340282366920938463463374607431768211455"}"#; assert_eq!(serde_json::to_string(&info).unwrap(), json_str); assert_eq!( diff --git a/pallets/treasury/Cargo.toml b/pallets/treasury/Cargo.toml index 49ec4de4df..d9d6921ee3 100644 --- a/pallets/treasury/Cargo.toml +++ b/pallets/treasury/Cargo.toml @@ -18,10 +18,10 @@ serde_derive = { version = "1.0.104", optional = true, default-features = false # Substrate codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } sp-api = { version = "4.0.0-dev", default-features = false } diff --git a/pallets/treasury/src/lib.rs b/pallets/treasury/src/lib.rs index 7743ad0f9b..38bbdddd75 100644 --- a/pallets/treasury/src/lib.rs +++ b/pallets/treasury/src/lib.rs @@ -64,7 +64,7 @@ type NegativeImbalanceOf = <::Currency as Currency< pub trait Config: frame_system::Config + BalancesConfig { // The overarching event type. - type Event: From> + Into<::Event>; + type RuntimeEvent: From> + Into<::RuntimeEvent>; /// The native currency. type Currency: Currency; /// Weight information for extrinsics in the identity pallet. @@ -110,7 +110,7 @@ decl_error! { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; fn deposit_event() = default; @@ -139,7 +139,7 @@ decl_module! { impl Module { fn base_disbursement( - origin: T::Origin, + origin: T::RuntimeOrigin, beneficiaries: Vec>>, ) -> DispatchResult { ensure_root(origin)?; @@ -171,7 +171,7 @@ impl Module { Ok(()) } - fn base_reimbursement(origin: T::Origin, amount: BalanceOf) -> DispatchResult { + fn base_reimbursement(origin: T::RuntimeOrigin, amount: BalanceOf) -> DispatchResult { let identity::PermissionedCallOriginData { sender, primary_did, @@ -197,7 +197,7 @@ impl Module { /// This actually does computation. If you need to keep using it, then make sure you cache the /// value and only call this once. fn account_id() -> T::AccountId { - TREASURY_PALLET_ID.into_account() + TREASURY_PALLET_ID.into_account_truncating() } fn unsafe_disbursement(primary_key: T::AccountId, target: IdentityId, amount: BalanceOf) { diff --git a/pallets/utility/Cargo.toml b/pallets/utility/Cargo.toml index 24d8a01593..474898797e 100644 --- a/pallets/utility/Cargo.toml +++ b/pallets/utility/Cargo.toml @@ -19,10 +19,10 @@ frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive"] } -sp-core = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } # Only for benchmarks hex-literal = "0.2.1" diff --git a/pallets/utility/src/lib.rs b/pallets/utility/src/lib.rs index 726f8b2d94..9c6afe1808 100644 --- a/pallets/utility/src/lib.rs +++ b/pallets/utility/src/lib.rs @@ -55,10 +55,12 @@ use codec::{Decode, Encode}; use frame_support::storage::{with_transaction, TransactionOutcome}; use frame_support::{ decl_error, decl_event, decl_module, decl_storage, - dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, PostDispatchInfo}, + dispatch::{ + DispatchErrorWithPostInfo, DispatchResultWithPostInfo, GetDispatchInfo, PostDispatchInfo, + Weight, + }, ensure, traits::{GetCallMetadata, UnfilteredDispatchable}, - weights::{GetDispatchInfo, Weight}, Parameter, }; use frame_system::{ensure_root, ensure_signed, Pallet as System, RawOrigin}; @@ -80,16 +82,16 @@ pub type ErrorAt = (u32, DispatchError); /// Configuration trait. pub trait Config: frame_system::Config + IdentityConfig + BalancesConfig { /// The overarching event type. - type Event: From + Into<::Event>; + type RuntimeEvent: From + Into<::RuntimeEvent>; /// The overarching call type. type Call: Parameter - + Dispatchable + + Dispatchable + GetCallMetadata + GetDispatchInfo + From> + From> - + UnfilteredDispatchable; + + UnfilteredDispatchable; type WeightInfo: WeightInfo; } @@ -155,7 +157,7 @@ impl UniqueCall { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { + pub struct Module for enum Call where origin: T::RuntimeOrigin { type Error = Error; /// Deposit one of this module's events by using the default implementation. @@ -296,14 +298,14 @@ decl_module! { Self::dispatch_call(RawOrigin::Signed(target).into(), false, *call.call) .map(|info| info .actual_weight - .map(|w| w.saturating_add(90_000_000)) + .map(|w| w.saturating_add(Weight::from_ref_time(90_000_000))) .into()) .map_err(|e| DispatchErrorWithPostInfo { error: e.error, post_info: e .post_info .actual_weight - .map(|w| w.saturating_add(90_000_000)) + .map(|w| w.saturating_add(Weight::from_ref_time(90_000_000))) .into() }) } @@ -312,7 +314,7 @@ decl_module! { impl Module { fn dispatch_call( - origin: T::Origin, + origin: T::RuntimeOrigin, is_root: bool, call: ::Call, ) -> DispatchResultWithPostInfo { @@ -326,7 +328,7 @@ impl Module { } fn run_batch( - origin: T::Origin, + origin: T::RuntimeOrigin, is_root: bool, calls: Vec<::Call>, stop_on_errors: bool, @@ -357,7 +359,7 @@ impl Module { } } - fn ensure_root_or_signed(origin: T::Origin) -> Result { + fn ensure_root_or_signed(origin: T::RuntimeOrigin) -> Result { let is_root = ensure_root(origin.clone()).is_ok(); if !is_root { ensure_signed(origin)?; diff --git a/pallets/weights/Cargo.toml b/pallets/weights/Cargo.toml index 6cc13de4c5..ce3cf236ad 100644 --- a/pallets/weights/Cargo.toml +++ b/pallets/weights/Cargo.toml @@ -16,7 +16,7 @@ pallet-grandpa = { version = "4.0.0-dev", default-features = false } pallet-preimage = { version = "4.0.0-dev", default-features = false } pallet-scheduler = { version = "4.0.0-dev", default-features = false } pallet-session = { version = "4.0.0-dev", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } # our pallets pallet-asset = { path = "../asset", default-features = false } diff --git a/pallets/weights/src/frame_system.rs b/pallets/weights/src/frame_system.rs index 3343b0beb2..787f1a0d84 100644 --- a/pallets/weights/src/frame_system.rs +++ b/pallets/weights/src/frame_system.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,44 +51,53 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for frame_system using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl frame_system::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl frame_system::WeightInfo for SubstrateWeight { + /// The range of component `b` is `[0, 7864320]`. fn remark(b: u32) -> Weight { - (382_693_000 as Weight) + Weight::from_ref_time(382_693_000 as u64) // Standard Error: 0 - .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(219 as u64).saturating_mul(b as u64)) } + /// The range of component `b` is `[0, 7864320]`. fn remark_with_event(b: u32) -> Weight { - (133_584_000 as Weight) + Weight::from_ref_time(133_584_000 as u64) // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(b as u64)) } // Storage: System Digest (r:1 w:1) // Storage: unknown [0x3a686561707061676573] (r:0 w:1) fn set_heap_pages() -> Weight { - (12_228_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 9_457 nanoseconds. + Weight::from_ref_time(10_038_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32) -> Weight { - (48_404_000 as Weight) - // Standard Error: 35_000 - .saturating_add((806_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 4_689 nanoseconds. + Weight::from_ref_time(4_839_000) + // Standard Error: 2_971 + .saturating_add(Weight::from_ref_time(690_562).saturating_mul(i.into())) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32) -> Weight { - (31_024_000 as Weight) - // Standard Error: 17_000 - .saturating_add((547_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 4_859 nanoseconds. + Weight::from_ref_time(5_029_000) + // Standard Error: 1_057 + .saturating_add(Weight::from_ref_time(553_304).saturating_mul(i.into())) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32) -> Weight { - (63_671_000 as Weight) - // Standard Error: 25_000 - .saturating_add((1_127_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + // Minimum execution time: 7_203 nanoseconds. + Weight::from_ref_time(7_253_000) + // Standard Error: 3_674 + .saturating_add(Weight::from_ref_time(1_089_831).saturating_mul(p.into())) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(p.into()))) } } diff --git a/pallets/weights/src/pallet_asset.rs b/pallets/weights/src/pallet_asset.rs index 08031224ac..2170e7d482 100644 --- a/pallets/weights/src/pallet_asset.rs +++ b/pallets/weights/src/pallet_asset.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_asset //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_asset using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_asset::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_asset::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: Asset Tokens (r:1 w:0) // Storage: Asset TickerConfig (r:1 w:0) @@ -63,9 +64,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetOwnershipRelations (r:0 w:1) // Storage: Asset ClassicTickers (r:0 w:1) fn register_ticker() -> Weight { - (75_067_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 53_809 nanoseconds. + Weight::from_ref_time(55_263_000) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -75,9 +77,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetOwnershipRelations (r:0 w:2) // Storage: Asset ClassicTickers (r:0 w:1) fn accept_ticker_transfer() -> Weight { - (80_113_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 59_149 nanoseconds. + Weight::from_ref_time(59_560_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -89,9 +92,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: Asset AssetOwnershipRelations (r:0 w:2) fn accept_asset_ownership_transfer() -> Weight { - (186_929_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 72_134 nanoseconds. + Weight::from_ref_time(73_546_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Asset Tokens (r:1 w:1) @@ -111,14 +115,20 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset Identifiers (r:0 w:1) // Storage: ExternalAgents AgentOf (r:0 w:1) // Storage: ExternalAgents GroupOfAgent (r:0 w:1) - fn create_asset(_n: u32, i: u32, f: u32) -> Weight { - (222_532_000 as Weight) - // Standard Error: 28_000 - .saturating_add((68_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 109_000 - .saturating_add((142_000 as Weight).saturating_mul(f as Weight)) - .saturating_add(DbWeight::get().reads(11 as Weight)) - .saturating_add(DbWeight::get().writes(12 as Weight)) + /// The range of component `n` is `[1, 128]`. + /// The range of component `i` is `[1, 512]`. + /// The range of component `f` is `[1, 128]`. + fn create_asset(n: u32, i: u32, f: u32) -> Weight { + // Minimum execution time: 98_963 nanoseconds. + Weight::from_ref_time(103_561_555) + // Manually set weight for `n` + .saturating_add(Weight::from_ref_time(100_000).saturating_mul(n.into())) + // Standard Error: 1_327 + .saturating_add(Weight::from_ref_time(66_001).saturating_mul(i.into())) + // Manually set weight for `f` + .saturating_add(Weight::from_ref_time(100_000).saturating_mul(f.into())) + .saturating_add(DbWeight::get().reads(11)) + .saturating_add(DbWeight::get().writes(12)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -127,9 +137,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset Tokens (r:1 w:0) // Storage: Asset Frozen (r:1 w:1) fn freeze() -> Weight { - (52_377_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 45_164 nanoseconds. + Weight::from_ref_time(46_325_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -138,9 +149,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset Tokens (r:1 w:0) // Storage: Asset Frozen (r:1 w:1) fn unfreeze() -> Weight { - (53_257_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 46_366 nanoseconds. + Weight::from_ref_time(47_007_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Asset Tokens (r:1 w:0) // Storage: Identity KeyRecords (r:1 w:0) @@ -148,12 +160,14 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Asset AssetNames (r:0 w:1) + /// The range of component `n` is `[1, 128]`. fn rename_asset(n: u32) -> Weight { - (66_352_000 as Weight) - // Standard Error: 47_000 - .saturating_add((99_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 43_360 nanoseconds. + Weight::from_ref_time(44_313_406) + // Standard Error: 924 + .saturating_add(Weight::from_ref_time(14_448).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -163,7 +177,6 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset Tokens (r:1 w:1) // Storage: Asset BalanceOf (r:1 w:1) // Storage: Portfolio PortfolioAssetBalances (r:1 w:1) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: ProtocolFee Coefficient (r:1 w:0) // Storage: ProtocolFee BaseFees (r:1 w:0) // Storage: Checkpoint Schedules (r:1 w:0) @@ -174,9 +187,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset FundingRound (r:1 w:0) // Storage: Asset IssuedInFundingRound (r:1 w:1) fn issue() -> Weight { - (128_289_000 as Weight) - .saturating_add(DbWeight::get().reads(18 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 93_723 nanoseconds. + Weight::from_ref_time(95_467_000) + .saturating_add(DbWeight::get().reads(17)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -184,7 +198,6 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Portfolio PortfolioCustodian (r:1 w:0) // Storage: Asset Tokens (r:1 w:1) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Portfolio PortfolioAssetBalances (r:1 w:1) // Storage: Portfolio PortfolioLockedAssets (r:1 w:0) // Storage: Asset BalanceOf (r:1 w:1) @@ -196,9 +209,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Statistics ActiveAssetStats (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:0 w:1) fn redeem() -> Weight { - (257_496_000 as Weight) - .saturating_add(DbWeight::get().reads(16 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 90_156 nanoseconds. + Weight::from_ref_time(90_698_000) + .saturating_add(DbWeight::get().reads(15)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -206,9 +220,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Asset Tokens (r:1 w:1) fn make_divisible() -> Weight { - (57_715_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 43_921 nanoseconds. + Weight::from_ref_time(43_961_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -218,49 +233,57 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: ProtocolFee Coefficient (r:1 w:0) // Storage: ProtocolFee BaseFees (r:1 w:0) // Storage: Asset AssetDocuments (r:0 w:1) + /// The range of component `d` is `[1, 64]`. fn add_documents(d: u32) -> Weight { - (113_759_000 as Weight) - // Standard Error: 1_008_000 - .saturating_add((19_608_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(d as Weight))) + // Minimum execution time: 56_915 nanoseconds. + Weight::from_ref_time(48_762_600) + // Standard Error: 18_514 + .saturating_add(Weight::from_ref_time(10_231_354).saturating_mul(d.into())) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(d.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Asset AssetDocuments (r:0 w:1) + /// The range of component `d` is `[1, 64]`. fn remove_documents(d: u32) -> Weight { - (68_275_000 as Weight) - // Standard Error: 392_000 - .saturating_add((8_476_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(d as Weight))) + // Minimum execution time: 31_147 nanoseconds. + Weight::from_ref_time(36_167_840) + // Standard Error: 14_496 + .saturating_add(Weight::from_ref_time(5_179_212).saturating_mul(d.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(d.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Asset FundingRound (r:0 w:1) + /// The range of component `f` is `[1, 128]`. fn set_funding_round(f: u32) -> Weight { - (61_854_000 as Weight) - // Standard Error: 39_000 - .saturating_add((9_000 as Weight).saturating_mul(f as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 38_311 nanoseconds. + Weight::from_ref_time(41_787_332) + // Standard Error: 7_975 + .saturating_add(Weight::from_ref_time(1_416).saturating_mul(f.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Asset Identifiers (r:0 w:1) + /// The range of component `i` is `[1, 512]`. fn update_identifiers(i: u32) -> Weight { - (68_342_000 as Weight) - // Standard Error: 13_000 - .saturating_add((70_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 39_563 nanoseconds. + Weight::from_ref_time(41_840_366) + // Standard Error: 684 + .saturating_add(Weight::from_ref_time(52_799).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Asset ClassicTickers (r:1 w:0) @@ -268,9 +291,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:0) // Storage: Asset AssetOwnershipRelations (r:0 w:2) fn claim_classic_ticker() -> Weight { - (255_426_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 90_747 nanoseconds. + Weight::from_ref_time(91_478_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Asset Tokens (r:1 w:0) // Storage: Asset Tickers (r:1 w:1) @@ -278,9 +302,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetOwnershipRelations (r:0 w:1) // Storage: Asset ClassicTickers (r:0 w:1) fn reserve_classic_ticker() -> Weight { - (52_626_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 40_935 nanoseconds. + Weight::from_ref_time(41_888_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -299,18 +324,23 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Statistics ActiveAssetStats (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:0 w:2) fn controller_transfer() -> Weight { - (160_111_000 as Weight) - .saturating_add(DbWeight::get().reads(19 as Weight)) - .saturating_add(DbWeight::get().writes(9 as Weight)) + // Minimum execution time: 111_636 nanoseconds. + Weight::from_ref_time(112_027_000) + .saturating_add(DbWeight::get().reads(19)) + .saturating_add(DbWeight::get().writes(9)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Asset CustomTypesInverse (r:1 w:1) // Storage: Asset CustomTypeIdSequence (r:1 w:1) // Storage: Asset CustomTypes (r:0 w:1) - fn register_custom_asset_type(_n: u32) -> Weight { - (61_694_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + /// The range of component `n` is `[1, 2048]`. + fn register_custom_asset_type(n: u32) -> Weight { + // Minimum execution time: 35_405 nanoseconds. + Weight::from_ref_time(36_930_772) + // Standard Error: 76 + .saturating_add(Weight::from_ref_time(5_091).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -320,9 +350,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetMetadataValueDetails (r:1 w:1) // Storage: Asset AssetMetadataValues (r:0 w:1) fn set_asset_metadata() -> Weight { - (70_973_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 57_917 nanoseconds. + Weight::from_ref_time(57_987_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -331,9 +362,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetMetadataGlobalKeyToName (r:1 w:0) // Storage: Asset AssetMetadataValueDetails (r:1 w:1) fn set_asset_metadata_details() -> Weight { - (66_157_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 47_959 nanoseconds. + Weight::from_ref_time(48_129_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -346,9 +378,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetMetadataLocalKeyToName (r:0 w:1) // Storage: Asset AssetMetadataLocalSpecs (r:0 w:1) fn register_and_set_local_asset_metadata() -> Weight { - (156_134_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 89_555 nanoseconds. + Weight::from_ref_time(90_587_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -359,18 +392,20 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetMetadataLocalKeyToName (r:0 w:1) // Storage: Asset AssetMetadataLocalSpecs (r:0 w:1) fn register_asset_metadata_local_type() -> Weight { - (102_083_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 69_048 nanoseconds. + Weight::from_ref_time(69_118_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Asset AssetMetadataGlobalNameToKey (r:1 w:1) // Storage: Asset AssetMetadataNextGlobalKey (r:1 w:1) // Storage: Asset AssetMetadataGlobalKeyToName (r:0 w:1) // Storage: Asset AssetMetadataGlobalSpecs (r:0 w:1) fn register_asset_metadata_global_type() -> Weight { - (54_402_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 44_132 nanoseconds. + Weight::from_ref_time(45_144_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -379,7 +414,6 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioCustodian (r:1 w:0) // Storage: Asset Tokens (r:1 w:1) // Storage: Portfolio Portfolios (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Portfolio PortfolioAssetBalances (r:1 w:1) // Storage: Portfolio PortfolioLockedAssets (r:1 w:0) // Storage: Portfolio PortfolioAssetCount (r:1 w:1) @@ -392,9 +426,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Statistics ActiveAssetStats (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:0 w:1) fn redeem_from_portfolio() -> Weight { - (207_838_000 as Weight) - .saturating_add(DbWeight::get().reads(18 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 100_245 nanoseconds. + Weight::from_ref_time(101_537_000) + .saturating_add(DbWeight::get().reads(17)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Asset Tokens (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:0) @@ -402,9 +437,10 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) fn update_asset_type() -> Weight { - (58_233_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 46_175 nanoseconds. + Weight::from_ref_time(47_277_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -418,9 +454,9 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetMetadataLocalKeyToName (r:0 w:1) // Storage: Asset AssetMetadataLocalSpecs (r:0 w:1) fn remove_local_metadata_key() -> Weight { - (52_321_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(52_321_000 as u64) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -430,8 +466,8 @@ impl pallet_asset::WeightInfo for WeightInfo { // Storage: Asset AssetMetadataValueDetails (r:1 w:1) // Storage: Asset AssetMetadataValues (r:0 w:1) fn remove_metadata_value() -> Weight { - (36_579_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(36_579_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } } diff --git a/pallets/weights/src/pallet_babe.rs b/pallets/weights/src/pallet_babe.rs index aad11ed5ee..44fdb536bc 100644 --- a/pallets/weights/src/pallet_babe.rs +++ b/pallets/weights/src/pallet_babe.rs @@ -23,10 +23,10 @@ use polymesh_runtime_common::{ }; /// Weights for pallet_babe using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_babe::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_babe::WeightInfo for SubstrateWeight { fn plan_config_change() -> Weight { - 0 + Weight::zero() } // WARNING! Some components were not used: ["x"] @@ -40,14 +40,14 @@ impl pallet_babe::WeightInfo for WeightInfo { const MAX_NOMINATORS: u64 = 200; // checking membership proof - (35 * WEIGHT_PER_MICROS) - .saturating_add((175 * WEIGHT_PER_NANOS).saturating_mul(validator_count)) + (35u64 * WEIGHT_PER_MICROS) + .saturating_add((175u64 * WEIGHT_PER_NANOS).saturating_mul(validator_count)) .saturating_add(DbWeight::get().reads(5)) // check equivocation proof - .saturating_add(110 * WEIGHT_PER_MICROS) + .saturating_add(110u64 * WEIGHT_PER_MICROS) // report offence - .saturating_add(110 * WEIGHT_PER_MICROS) - .saturating_add(25 * WEIGHT_PER_MICROS * MAX_NOMINATORS) + .saturating_add(110u64 * WEIGHT_PER_MICROS) + .saturating_add(25u64 * WEIGHT_PER_MICROS * MAX_NOMINATORS) .saturating_add(DbWeight::get().reads(14 + 3 * MAX_NOMINATORS)) .saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS)) } diff --git a/pallets/weights/src/pallet_balances.rs b/pallets/weights/src/pallet_balances.rs index ab3c568d9c..db616e00fd 100644 --- a/pallets/weights/src/pallet_balances.rs +++ b/pallets/weights/src/pallet_balances.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_balances using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_balances::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_balances::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) @@ -59,9 +60,10 @@ impl pallet_balances::WeightInfo for WeightInfo { // Storage: Identity Claims (r:2 w:0) // Storage: System Account (r:2 w:2) fn transfer() -> Weight { - (122_921_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 74_818 nanoseconds. + Weight::from_ref_time(77_083_000) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) @@ -70,38 +72,43 @@ impl pallet_balances::WeightInfo for WeightInfo { // Storage: Identity Claims (r:2 w:0) // Storage: System Account (r:2 w:2) fn transfer_with_memo() -> Weight { - (141_470_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 75_009 nanoseconds. + Weight::from_ref_time(76_411_000) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:2 w:2) fn deposit_block_reward_reserve_balance() -> Weight { - (151_655_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 54_230 nanoseconds. + Weight::from_ref_time(55_363_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:2 w:2) fn set_balance() -> Weight { - (100_179_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 68_006 nanoseconds. + Weight::from_ref_time(69_148_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: System Account (r:2 w:2) // Storage: Identity KeyRecords (r:2 w:0) fn force_transfer() -> Weight { - (61_835_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 45_965 nanoseconds. + Weight::from_ref_time(46_166_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity CurrentDid (r:1 w:0) // Storage: System Account (r:1 w:1) fn burn_account_balance() -> Weight { - (59_540_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 43_480 nanoseconds. + Weight::from_ref_time(43_620_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_capital_distribution.rs b/pallets/weights/src/pallet_capital_distribution.rs index 1c4d7e6c61..4a706aab44 100644 --- a/pallets/weights/src/pallet_capital_distribution.rs +++ b/pallets/weights/src/pallet_capital_distribution.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_capital_distribution //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_capital_distribution using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_corporate_actions::distribution::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) @@ -66,9 +67,10 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: ProtocolFee Coefficient (r:1 w:0) // Storage: ProtocolFee BaseFees (r:1 w:0) fn distribute() -> Weight { - (118_799_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 83_825 nanoseconds. + Weight::from_ref_time(84_496_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: CapitalDistribution HolderPaid (r:1 w:1) @@ -78,7 +80,6 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Checkpoint SchedulePoints (r:1 w:0) // Storage: Asset BalanceOf (r:3 w:2) // Storage: Asset Tokens (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Asset Frozen (r:1 w:0) // Storage: Asset DisableInvestorUniqueness (r:1 w:0) @@ -92,14 +93,17 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Checkpoint Schedules (r:1 w:0) // Storage: Checkpoint CheckpointIdSequence (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:0 w:2) + /// The range of component `t` is `[0, 1000]`. + /// The range of component `w` is `[0, 1000]`. fn claim(t: u32, w: u32) -> Weight { - (449_169_000 as Weight) - // Standard Error: 6_000 - .saturating_add((194_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 6_000 - .saturating_add((80_000 as Weight).saturating_mul(w as Weight)) - .saturating_add(DbWeight::get().reads(27 as Weight)) - .saturating_add(DbWeight::get().writes(12 as Weight)) + // Minimum execution time: 384_750 nanoseconds. + Weight::from_ref_time(381_525_284) + // Standard Error: 1_803 + .saturating_add(Weight::from_ref_time(52_168).saturating_mul(t.into())) + // Standard Error: 1_803 + .saturating_add(Weight::from_ref_time(17_224).saturating_mul(w.into())) + .saturating_add(DbWeight::get().reads(26)) + .saturating_add(DbWeight::get().writes(11)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -112,7 +116,6 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Checkpoint SchedulePoints (r:1 w:0) // Storage: Asset BalanceOf (r:3 w:2) // Storage: Asset Tokens (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Asset Frozen (r:1 w:0) // Storage: Asset DisableInvestorUniqueness (r:1 w:0) @@ -126,14 +129,17 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Checkpoint Schedules (r:1 w:0) // Storage: Checkpoint CheckpointIdSequence (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:0 w:2) + /// The range of component `t` is `[0, 1000]`. + /// The range of component `w` is `[0, 1000]`. fn push_benefit(t: u32, w: u32) -> Weight { - (539_024_000 as Weight) - // Standard Error: 6_000 - .saturating_add((172_000 as Weight).saturating_mul(t as Weight)) - // Standard Error: 6_000 - .saturating_add((72_000 as Weight).saturating_mul(w as Weight)) - .saturating_add(DbWeight::get().reads(30 as Weight)) - .saturating_add(DbWeight::get().writes(12 as Weight)) + // Minimum execution time: 429_212 nanoseconds. + Weight::from_ref_time(427_375_323) + // Standard Error: 1_936 + .saturating_add(Weight::from_ref_time(57_902).saturating_mul(t.into())) + // Standard Error: 1_936 + .saturating_add(Weight::from_ref_time(17_225).saturating_mul(w.into())) + .saturating_add(DbWeight::get().reads(29)) + .saturating_add(DbWeight::get().writes(11)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -144,9 +150,10 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioCustodian (r:1 w:0) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) fn reclaim() -> Weight { - (97_479_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 65_020 nanoseconds. + Weight::from_ref_time(65_100_000) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -156,8 +163,9 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:0) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) fn remove_distribution() -> Weight { - (94_159_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 61_744 nanoseconds. + Weight::from_ref_time(62_415_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(2)) } } diff --git a/pallets/weights/src/pallet_checkpoint.rs b/pallets/weights/src/pallet_checkpoint.rs index ea8562c5e3..c9acc7c54b 100644 --- a/pallets/weights/src/pallet_checkpoint.rs +++ b/pallets/weights/src/pallet_checkpoint.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_checkpoint //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,11 +51,12 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_checkpoint using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_asset::checkpoint::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_asset::checkpoint::WeightInfo for SubstrateWeight { // Storage: Checkpoint SchedulesMaxComplexity (r:0 w:1) fn set_schedules_max_complexity() -> Weight { - (59_899_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_362 nanoseconds. + Weight::from_ref_time(17_463_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -66,9 +68,10 @@ impl pallet_asset::checkpoint::WeightInfo for WeightInfo { // Storage: Checkpoint TotalSupply (r:0 w:1) // Storage: Checkpoint Timestamps (r:0 w:1) fn create_checkpoint() -> Weight { - (64_397_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 52_406 nanoseconds. + Weight::from_ref_time(54_421_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -86,10 +89,14 @@ impl pallet_asset::checkpoint::WeightInfo for WeightInfo { // Storage: Checkpoint TotalSupply (r:0 w:1) // Storage: Checkpoint Timestamps (r:0 w:1) // Storage: Checkpoint ScheduleRefCount (r:0 w:1) - fn create_schedule(_s: u32) -> Weight { - (147_224_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + /// The range of component `s` is `[1, 52]`. + fn create_schedule(s: u32) -> Weight { + // Minimum execution time: 79_877 nanoseconds. + Weight::from_ref_time(82_377_747) + // Standard Error: 18_602 + .saturating_add(Weight::from_ref_time(133_833).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(7)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -97,11 +104,13 @@ impl pallet_asset::checkpoint::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Checkpoint Schedules (r:1 w:1) // Storage: Checkpoint ScheduleRefCount (r:1 w:1) + /// The range of component `s` is `[1, 52]`. fn remove_schedule(s: u32) -> Weight { - (65_599_000 as Weight) - // Standard Error: 130_000 - .saturating_add((311_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 47_819 nanoseconds. + Weight::from_ref_time(50_762_879) + // Standard Error: 14_306 + .saturating_add(Weight::from_ref_time(198_098).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(2)) } } diff --git a/pallets/weights/src/pallet_committee.rs b/pallets/weights/src/pallet_committee.rs index 6316381201..04cc2ee4dd 100644 --- a/pallets/weights/src/pallet_committee.rs +++ b/pallets/weights/src/pallet_committee.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_committee //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,22 +51,25 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_committee using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_committee::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_committee::WeightInfo for SubstrateWeight { // Storage: Instance1Committee VoteThreshold (r:0 w:1) fn set_vote_threshold() -> Weight { - (57_429_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_312 nanoseconds. + Weight::from_ref_time(17_553_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Instance1Committee Members (r:1 w:0) // Storage: Instance1Committee ReleaseCoordinator (r:0 w:1) fn set_release_coordinator() -> Weight { - (104_777_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 132_525 nanoseconds. + Weight::from_ref_time(135_140_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Instance1Committee ExpiresAfter (r:0 w:1) fn set_expires_after() -> Weight { - (31_739_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_062 nanoseconds. + Weight::from_ref_time(17_572_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Instance1Committee Voting (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:0) @@ -75,18 +79,20 @@ impl pallet_committee::WeightInfo for WeightInfo { // Storage: Instance1Committee Proposals (r:1 w:1) // Storage: Instance1Committee ExpiresAfter (r:1 w:0) fn vote_or_propose_new_proposal() -> Weight { - (284_417_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 282_422 nanoseconds. + Weight::from_ref_time(288_804_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Instance1Committee Voting (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee Members (r:1 w:0) // Storage: Instance1Committee VoteThreshold (r:1 w:0) fn vote_or_propose_existing_proposal() -> Weight { - (266_418_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 260_972 nanoseconds. + Weight::from_ref_time(267_574_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee Members (r:1 w:0) @@ -96,17 +102,19 @@ impl pallet_committee::WeightInfo for WeightInfo { // Storage: Instance1Committee ProposalOf (r:1 w:1) // Storage: Instance1Committee Proposals (r:1 w:1) fn vote_aye() -> Weight { - (424_894_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 369_482 nanoseconds. + Weight::from_ref_time(373_519_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee Members (r:1 w:0) // Storage: Instance1Committee Voting (r:1 w:1) // Storage: Instance1Committee VoteThreshold (r:1 w:0) fn vote_nay() -> Weight { - (254_190_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 255_211 nanoseconds. + Weight::from_ref_time(255_883_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_compliance_manager.rs b/pallets/weights/src/pallet_compliance_manager.rs index 0271e89a97..06fae24b95 100644 --- a/pallets/weights/src/pallet_compliance_manager.rs +++ b/pallets/weights/src/pallet_compliance_manager.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_compliance_manager //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,18 +51,23 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_compliance_manager using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_compliance_manager::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_compliance_manager::WeightInfo for SubstrateWeight { + /// The range of component `a` is `[1, 10]`. + /// The range of component `b` is `[1, 10]`. + /// The range of component `c` is `[1, 10]`. + /// The range of component `d` is `[1, 10]`. fn condition_costs(a: u32, b: u32, c: u32, d: u32) -> Weight { - (0 as Weight) - // Standard Error: 340_000 - .saturating_add((5_873_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 340_000 - .saturating_add((1_729_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 340_000 - .saturating_add((2_897_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 340_000 - .saturating_add((1_101_000 as Weight).saturating_mul(d as Weight)) + // Minimum execution time: 7_864 nanoseconds. + Weight::from_ref_time(8_114_000) + // Standard Error: 39_365 + .saturating_add(Weight::from_ref_time(2_949_096).saturating_mul(a.into())) + // Standard Error: 39_365 + .saturating_add(Weight::from_ref_time(411_324).saturating_mul(b.into())) + // Standard Error: 39_365 + .saturating_add(Weight::from_ref_time(671_782).saturating_mul(c.into())) + // Manually set for `d` + .saturating_add(Weight::from_ref_time(721_394).saturating_mul(d.into())) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -71,12 +77,14 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: ComplianceManager TrustedClaimIssuer (r:1 w:0) // Storage: ProtocolFee Coefficient (r:1 w:0) // Storage: ProtocolFee BaseFees (r:1 w:0) + /// The range of component `c` is `[1, 6]`. fn add_compliance_requirement(c: u32) -> Weight { - (75_374_000 as Weight) - // Standard Error: 2_063_000 - .saturating_add((2_699_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 59_480 nanoseconds. + Weight::from_ref_time(60_491_667) + // Standard Error: 35_288 + .saturating_add(Weight::from_ref_time(1_128_590).saturating_mul(c.into())) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -84,9 +92,10 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ComplianceManager AssetCompliances (r:1 w:1) fn remove_compliance_requirement() -> Weight { - (70_212_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 48_980 nanoseconds. + Weight::from_ref_time(50_152_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -94,9 +103,10 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ComplianceManager AssetCompliances (r:1 w:1) fn pause_asset_compliance() -> Weight { - (63_229_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 50_974 nanoseconds. + Weight::from_ref_time(51_204_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -104,9 +114,10 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ComplianceManager AssetCompliances (r:1 w:1) fn resume_asset_compliance() -> Weight { - (54_917_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 47_508 nanoseconds. + Weight::from_ref_time(47_998_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -116,9 +127,10 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: ComplianceManager TrustedClaimIssuer (r:1 w:1) // Storage: ComplianceManager AssetCompliances (r:1 w:0) fn add_default_trusted_claim_issuer() -> Weight { - (69_056_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 54_821 nanoseconds. + Weight::from_ref_time(55_422_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -126,9 +138,10 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ComplianceManager TrustedClaimIssuer (r:1 w:1) fn remove_default_trusted_claim_issuer() -> Weight { - (52_572_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 47_818 nanoseconds. + Weight::from_ref_time(48_189_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -136,12 +149,14 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ComplianceManager AssetCompliances (r:1 w:1) // Storage: ComplianceManager TrustedClaimIssuer (r:1 w:0) + /// The range of component `c` is `[1, 6]`. fn change_compliance_requirement(c: u32) -> Weight { - (62_057_000 as Weight) - // Standard Error: 1_732_000 - .saturating_add((3_975_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 55_072 nanoseconds. + Weight::from_ref_time(57_468_205) + // Standard Error: 32_981 + .saturating_add(Weight::from_ref_time(683_464).saturating_mul(c.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -149,12 +164,14 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ComplianceManager TrustedClaimIssuer (r:1 w:0) // Storage: ComplianceManager AssetCompliances (r:1 w:1) + /// The range of component `c` is `[0, 2]`. fn replace_asset_compliance(c: u32) -> Weight { - (62_348_000 as Weight) - // Standard Error: 2_113_000 - .saturating_add((12_614_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 50_874 nanoseconds. + Weight::from_ref_time(53_556_546) + // Standard Error: 88_581 + .saturating_add(Weight::from_ref_time(6_514_529).saturating_mul(c.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -162,8 +179,9 @@ impl pallet_compliance_manager::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ComplianceManager AssetCompliances (r:0 w:1) fn reset_asset_compliance() -> Weight { - (50_062_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 42_659 nanoseconds. + Weight::from_ref_time(42_899_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_corporate_actions.rs b/pallets/weights/src/pallet_corporate_actions.rs index ea23614cb3..475decd8ce 100644 --- a/pallets/weights/src/pallet_corporate_actions.rs +++ b/pallets/weights/src/pallet_corporate_actions.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_corporate_actions //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,23 +51,26 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_corporate_actions using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_corporate_actions::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_corporate_actions::WeightInfo for SubstrateWeight { // Storage: CorporateAction MaxDetailsLength (r:0 w:1) fn set_max_details_length() -> Weight { - (61_773_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 18_525 nanoseconds. + Weight::from_ref_time(18_895_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: CorporateAction DefaultTargetIdentities (r:1 w:1) + /// The range of component `t` is `[0, 500]`. fn set_default_targets(t: u32) -> Weight { - (97_698_000 as Weight) - // Standard Error: 9_000 - .saturating_add((462_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 44_793 nanoseconds. + Weight::from_ref_time(59_308_531) + // Standard Error: 3_297 + .saturating_add(Weight::from_ref_time(407_855).saturating_mul(t.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -74,21 +78,24 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: CorporateAction DefaultWithholdingTax (r:1 w:1) fn set_default_withholding_tax() -> Weight { - (48_824_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 43_941 nanoseconds. + Weight::from_ref_time(44_462_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: CorporateAction DidWithholdingTax (r:1 w:1) + /// The range of component `w` is `[0, 999]`. fn set_did_withholding_tax(w: u32) -> Weight { - (98_129_000 as Weight) - // Standard Error: 3_000 - .saturating_add((140_000 as Weight).saturating_mul(w as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 46_977 nanoseconds. + Weight::from_ref_time(62_848_208) + // Standard Error: 1_974 + .saturating_add(Weight::from_ref_time(210_352).saturating_mul(w.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -97,7 +104,6 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: CorporateAction MaxDetailsLength (r:1 w:0) // Storage: CorporateAction CAIdSequence (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Checkpoint Schedules (r:1 w:1) // Storage: Checkpoint SchedulesMaxComplexity (r:1 w:0) // Storage: Checkpoint ScheduleIdSequence (r:1 w:1) @@ -109,14 +115,17 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: Checkpoint ScheduleRefCount (r:0 w:1) // Storage: CorporateAction CorporateActions (r:0 w:1) // Storage: CorporateAction Details (r:0 w:1) + /// The range of component `w` is `[0, 1000]`. + /// The range of component `t` is `[0, 500]`. fn initiate_corporate_action_use_defaults(w: u32, t: u32) -> Weight { - (220_483_000 as Weight) - // Standard Error: 4_000 - .saturating_add((188_000 as Weight).saturating_mul(w as Weight)) - // Standard Error: 9_000 - .saturating_add((93_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(DbWeight::get().reads(16 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 218_163 nanoseconds. + Weight::from_ref_time(192_138_698) + // Standard Error: 2_478 + .saturating_add(Weight::from_ref_time(181_016).saturating_mul(w.into())) + // Standard Error: 4_953 + .saturating_add(Weight::from_ref_time(24_264).saturating_mul(t.into())) + .saturating_add(DbWeight::get().reads(15)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -125,7 +134,6 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: CorporateAction MaxDetailsLength (r:1 w:0) // Storage: CorporateAction CAIdSequence (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Checkpoint Schedules (r:1 w:1) // Storage: Checkpoint SchedulesMaxComplexity (r:1 w:0) // Storage: Checkpoint ScheduleIdSequence (r:1 w:1) @@ -134,14 +142,17 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: Checkpoint ScheduleRefCount (r:0 w:1) // Storage: CorporateAction CorporateActions (r:0 w:1) // Storage: CorporateAction Details (r:0 w:1) + /// The range of component `w` is `[0, 1000]`. + /// The range of component `t` is `[0, 500]`. fn initiate_corporate_action_provided(w: u32, t: u32) -> Weight { - (225_979_000 as Weight) - // Standard Error: 7_000 - .saturating_add((357_000 as Weight).saturating_mul(w as Weight)) - // Standard Error: 14_000 - .saturating_add((386_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 333_666 nanoseconds. + Weight::from_ref_time(202_036_061) + // Standard Error: 2_860 + .saturating_add(Weight::from_ref_time(281_998).saturating_mul(w.into())) + // Standard Error: 5_717 + .saturating_add(Weight::from_ref_time(210_649).saturating_mul(t.into())) + .saturating_add(DbWeight::get().reads(12)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -150,13 +161,15 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: CorporateAction CorporateActions (r:1 w:0) // Storage: CorporateAction CADocLink (r:1 w:1) // Storage: Asset AssetDocuments (r:10 w:0) + /// The range of component `d` is `[0, 1000]`. fn link_ca_doc(d: u32) -> Weight { - (0 as Weight) - // Standard Error: 55_000 - .saturating_add((7_782_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(d as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 48_670 nanoseconds. + Weight::from_ref_time(36_449_012) + // Standard Error: 3_376 + .saturating_add(Weight::from_ref_time(2_762_766).saturating_mul(d.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(d.into()))) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -172,9 +185,10 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: CorporateBallot Metas (r:0 w:1) // Storage: CorporateBallot RCV (r:0 w:1) fn remove_ca_with_ballot() -> Weight { - (86_637_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) + // Minimum execution time: 77_072 nanoseconds. + Weight::from_ref_time(77_473_000) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().writes(8)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -188,16 +202,16 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: CorporateAction Details (r:0 w:1) // Storage: CorporateAction CADocLink (r:0 w:1) fn remove_ca_with_dist() -> Weight { - (113_050_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 79_777 nanoseconds. + Weight::from_ref_time(80_078_000) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: CorporateAction CorporateActions (r:1 w:1) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Checkpoint ScheduleRefCount (r:1 w:2) // Storage: Checkpoint Schedules (r:1 w:1) // Storage: Checkpoint SchedulesMaxComplexity (r:1 w:0) @@ -207,16 +221,16 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: ProtocolFee BaseFees (r:1 w:0) // Storage: CorporateBallot TimeRanges (r:1 w:0) fn change_record_date_with_ballot() -> Weight { - (113_094_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 89_876 nanoseconds. + Weight::from_ref_time(90_487_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: CorporateAction CorporateActions (r:1 w:1) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Checkpoint ScheduleRefCount (r:1 w:2) // Storage: Checkpoint Schedules (r:1 w:1) // Storage: Checkpoint SchedulesMaxComplexity (r:1 w:0) @@ -226,8 +240,9 @@ impl pallet_corporate_actions::WeightInfo for WeightInfo { // Storage: ProtocolFee BaseFees (r:1 w:0) // Storage: CapitalDistribution Distributions (r:1 w:0) fn change_record_date_with_dist() -> Weight { - (123_418_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 92_371 nanoseconds. + Weight::from_ref_time(92_921_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(5)) } } diff --git a/pallets/weights/src/pallet_corporate_ballot.rs b/pallets/weights/src/pallet_corporate_ballot.rs index 1fa7f27596..eda84eae14 100644 --- a/pallets/weights/src/pallet_corporate_ballot.rs +++ b/pallets/weights/src/pallet_corporate_ballot.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_corporate_ballot //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_corporate_ballot using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_corporate_actions::ballot::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) @@ -64,12 +65,14 @@ impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { // Storage: CorporateBallot MotionNumChoices (r:0 w:1) // Storage: CorporateBallot Metas (r:0 w:1) // Storage: CorporateBallot RCV (r:0 w:1) + /// The range of component `c` is `[0, 1000]`. fn attach_ballot(c: u32) -> Weight { - (113_047_000 as Weight) - // Standard Error: 12_000 - .saturating_add((63_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 64_139 nanoseconds. + Weight::from_ref_time(66_678_350) + // Standard Error: 247 + .saturating_add(Weight::from_ref_time(36_154).saturating_mul(c.into())) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: CorporateBallot TimeRanges (r:1 w:0) @@ -81,14 +84,17 @@ impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { // Storage: Asset BalanceOf (r:1 w:0) // Storage: CorporateBallot Votes (r:1 w:1) // Storage: CorporateBallot Results (r:1 w:1) + /// The range of component `c` is `[0, 1000]`. + /// The range of component `t` is `[0, 1000]`. fn vote(c: u32, t: u32) -> Weight { - (71_860_000 as Weight) - // Standard Error: 4_000 - .saturating_add((170_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 4_000 - .saturating_add((189_000 as Weight).saturating_mul(t as Weight)) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 124_840 nanoseconds. + Weight::from_ref_time(64_266_338) + // Standard Error: 1_953 + .saturating_add(Weight::from_ref_time(85_981).saturating_mul(c.into())) + // Standard Error: 1_953 + .saturating_add(Weight::from_ref_time(206_261).saturating_mul(t.into())) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -97,9 +103,10 @@ impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { // Storage: CorporateBallot TimeRanges (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) fn change_end() -> Weight { - (122_596_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 50_193 nanoseconds. + Weight::from_ref_time(50_864_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -109,12 +116,14 @@ impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:0) // Storage: CorporateBallot MotionNumChoices (r:0 w:1) // Storage: CorporateBallot Metas (r:0 w:1) + /// The range of component `c` is `[0, 1000]`. fn change_meta(c: u32) -> Weight { - (91_517_000 as Weight) - // Standard Error: 11_000 - .saturating_add((68_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 52_808 nanoseconds. + Weight::from_ref_time(55_766_860) + // Standard Error: 1_245 + .saturating_add(Weight::from_ref_time(34_983).saturating_mul(c.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -124,9 +133,10 @@ impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:0) // Storage: CorporateBallot RCV (r:0 w:1) fn change_rcv() -> Weight { - (139_031_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 51_064 nanoseconds. + Weight::from_ref_time(52_938_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -138,8 +148,9 @@ impl pallet_corporate_actions::ballot::WeightInfo for WeightInfo { // Storage: CorporateBallot Metas (r:0 w:1) // Storage: CorporateBallot RCV (r:0 w:1) fn remove_ballot() -> Weight { - (73_456_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 55_022 nanoseconds. + Weight::from_ref_time(56_124_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(4)) } } diff --git a/pallets/weights/src/pallet_external_agents.rs b/pallets/weights/src/pallet_external_agents.rs index 5c8c2cd807..9b1195e012 100644 --- a/pallets/weights/src/pallet_external_agents.rs +++ b/pallets/weights/src/pallet_external_agents.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_external_agents //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,20 +51,22 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_external_agents using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_external_agents::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_external_agents::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ExternalAgents AGIdSequence (r:1 w:1) // Storage: ExternalAgents GroupPermissions (r:0 w:1) + /// The range of component `p` is `[0, 19]`. fn create_group(p: u32) -> Weight { - (85_865_000 as Weight) - // Standard Error: 738_000 - .saturating_add((207_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 46_175 nanoseconds. + Weight::from_ref_time(48_062_130) + // Standard Error: 12_473 + .saturating_add(Weight::from_ref_time(349_596).saturating_mul(p.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -71,12 +74,14 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ExternalAgents AGIdSequence (r:1 w:0) // Storage: ExternalAgents GroupPermissions (r:0 w:1) + /// The range of component `p` is `[0, 19]`. fn set_group_permissions(p: u32) -> Weight { - (73_998_000 as Weight) - // Standard Error: 435_000 - .saturating_add((801_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 46_866 nanoseconds. + Weight::from_ref_time(48_212_988) + // Standard Error: 15_613 + .saturating_add(Weight::from_ref_time(468_628).saturating_mul(p.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:2 w:1) @@ -85,18 +90,20 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: ExternalAgents NumFullAgents (r:1 w:1) // Storage: ExternalAgents AgentOf (r:0 w:1) fn remove_agent() -> Weight { - (76_838_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 52_147 nanoseconds. + Weight::from_ref_time(52_507_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:1) // Storage: ExternalAgents NumFullAgents (r:1 w:1) // Storage: ExternalAgents AgentOf (r:0 w:1) fn abdicate() -> Weight { - (95_025_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 44_623 nanoseconds. + Weight::from_ref_time(45_233_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:2 w:1) @@ -105,9 +112,10 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: ExternalAgents AGIdSequence (r:1 w:0) // Storage: ExternalAgents NumFullAgents (r:1 w:1) fn change_group_custom() -> Weight { - (75_339_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 52_827 nanoseconds. + Weight::from_ref_time(53_058_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:2 w:1) @@ -115,9 +123,10 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: ExternalAgents NumFullAgents (r:1 w:1) fn change_group_builtin() -> Weight { - (71_608_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 50_102 nanoseconds. + Weight::from_ref_time(50_854_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -128,9 +137,10 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: ExternalAgents AgentOf (r:0 w:1) fn accept_become_agent() -> Weight { - (102_218_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 64_479 nanoseconds. + Weight::from_ref_time(64_809_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -141,14 +151,15 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: Identity Authorizations (r:0 w:1) // Storage: ExternalAgents GroupPermissions (r:0 w:1) + /// The range of component `p` is `[0, 19]`. fn create_group_and_add_auth(p: u32) -> Weight { - (121_513_000 as Weight) - // Standard Error: 1_210_000 - .saturating_add((1_243_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 58_188 nanoseconds. + Weight::from_ref_time(60_640_539) + // Standard Error: 11_297 + .saturating_add(Weight::from_ref_time(340_691).saturating_mul(p.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(5)) } - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:2 w:1) // Storage: Permissions CurrentPalletName (r:1 w:0) @@ -156,11 +167,13 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: ExternalAgents AGIdSequence (r:1 w:1) // Storage: ExternalAgents NumFullAgents (r:1 w:1) // Storage: ExternalAgents GroupPermissions (r:0 w:1) + /// The range of component `p` is `[0, 19]`. fn create_and_change_custom_group(p: u32) -> Weight { - (113_769_000 as Weight) - // Standard Error: 645_000 - .saturating_add((955_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 62_776 nanoseconds. + Weight::from_ref_time(65_101_749) + // Standard Error: 13_101 + .saturating_add(Weight::from_ref_time(421_147).saturating_mul(p.into())) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(4)) } } diff --git a/pallets/weights/src/pallet_grandpa.rs b/pallets/weights/src/pallet_grandpa.rs index 66c6e18b34..096ea88ab2 100644 --- a/pallets/weights/src/pallet_grandpa.rs +++ b/pallets/weights/src/pallet_grandpa.rs @@ -51,8 +51,8 @@ use polymesh_runtime_common::{ RocksDbWeight as DbWeight, Weight, WEIGHT_PER_MICROS, WEIGHT_PER_NANOS, }; /// Weights for pallet_grandpa using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_grandpa::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_grandpa::WeightInfo for SubstrateWeight { fn report_equivocation(validator_count: u32) -> Weight { // we take the validator set count from the membership proof to // calculate the weight but we set a floor of 100 validators. @@ -63,14 +63,14 @@ impl pallet_grandpa::WeightInfo for WeightInfo { const MAX_NOMINATORS: u64 = 200; // checking membership proof - (35 * WEIGHT_PER_MICROS) - .saturating_add((175 * WEIGHT_PER_NANOS).saturating_mul(validator_count)) + (35u64 * WEIGHT_PER_MICROS) + .saturating_add((175u64 * WEIGHT_PER_NANOS).saturating_mul(validator_count)) .saturating_add(DbWeight::get().reads(5)) // check equivocation proof - .saturating_add(95 * WEIGHT_PER_MICROS) + .saturating_add(95u64 * WEIGHT_PER_MICROS) // report offence - .saturating_add(110 * WEIGHT_PER_MICROS) - .saturating_add(25 * WEIGHT_PER_MICROS * MAX_NOMINATORS) + .saturating_add(110u64 * WEIGHT_PER_MICROS) + .saturating_add(25u64 * WEIGHT_PER_MICROS * MAX_NOMINATORS) .saturating_add(DbWeight::get().reads(14 + 3 * MAX_NOMINATORS)) .saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS)) // fetching set id -> session index mappings @@ -78,6 +78,6 @@ impl pallet_grandpa::WeightInfo for WeightInfo { } // Storage: Grandpa Stalled (r:0 w:1) fn note_stalled() -> Weight { - (2_979_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(2_979_000).saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_group.rs b/pallets/weights/src/pallet_group.rs index 17e2d9bb91..e16c72837a 100644 --- a/pallets/weights/src/pallet_group.rs +++ b/pallets/weights/src/pallet_group.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_group //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,13 +51,14 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_group using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_group::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_group::WeightInfo for SubstrateWeight { // Storage: Instance2Group ActiveMembersLimit (r:1 w:1) fn set_active_members_limit() -> Weight { - (18_544_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 20_257 nanoseconds. + Weight::from_ref_time(20_438_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Instance2Group ActiveMembers (r:1 w:1) // Storage: Instance2Group ActiveMembersLimit (r:1 w:0) @@ -64,17 +66,19 @@ impl pallet_group::WeightInfo for WeightInfo { // Storage: Identity Claims (r:1 w:1) // Storage: Identity CurrentDid (r:1 w:0) fn add_member() -> Weight { - (1_241_335_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 787_333 nanoseconds. + Weight::from_ref_time(803_354_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:1) // Storage: Identity CurrentDid (r:1 w:0) fn remove_member() -> Weight { - (232_796_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 232_319 nanoseconds. + Weight::from_ref_time(238_461_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Instance2Group ActiveMembers (r:1 w:1) // Storage: Identity Claims (r:1 w:1) @@ -82,32 +86,36 @@ impl pallet_group::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:1) fn disable_member() -> Weight { - (219_773_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 281_590 nanoseconds. + Weight::from_ref_time(285_057_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Instance2Group ActiveMembers (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) // Storage: Identity Claims (r:2 w:2) // Storage: Identity CurrentDid (r:1 w:0) fn swap_member() -> Weight { - (1_254_033_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 855_159 nanoseconds. + Weight::from_ref_time(858_716_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Instance2Group ActiveMembersLimit (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) // Storage: Identity Claims (r:2 w:2) // Storage: Identity CurrentDid (r:1 w:0) + /// The range of component `m` is `[1, 1000]`. fn reset_members(m: u32) -> Weight { - (2_876_585_000 as Weight) - // Standard Error: 3_421_000 - .saturating_add((1_021_849_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(m as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight))) + // Minimum execution time: 601_971 nanoseconds. + Weight::from_ref_time(602_092_000) + // Standard Error: 824_354 + .saturating_add(Weight::from_ref_time(549_071_738).saturating_mul(m.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(DbWeight::get().writes(2)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(m.into()))) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Identity KeyRecords (r:1 w:0) @@ -115,8 +123,9 @@ impl pallet_group::WeightInfo for WeightInfo { // Storage: Instance2Group ActiveMembers (r:1 w:1) // Storage: Identity Claims (r:1 w:1) fn abdicate_membership() -> Weight { - (241_722_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 296_237 nanoseconds. + Weight::from_ref_time(298_281_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(2)) } } diff --git a/pallets/weights/src/pallet_identity.rs b/pallets/weights/src/pallet_identity.rs index 7029e37778..04cfc3a08c 100644 --- a/pallets/weights/src/pallet_identity.rs +++ b/pallets/weights/src/pallet_identity.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_identity //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_identity using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_identity::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_identity::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:2 w:1) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Identity MultiPurposeNonce (r:1 w:1) @@ -62,14 +63,16 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Identity DidKeys (r:0 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:2) // Storage: Identity Authorizations (r:0 w:2) + /// The range of component `i` is `[0, 200]`. fn cdd_register_did(i: u32) -> Weight { - (169_056_000 as Weight) - // Standard Error: 392_000 - .saturating_add((19_194_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 50_232 nanoseconds. + Weight::from_ref_time(70_470_746) + // Standard Error: 24_402 + .saturating_add(Weight::from_ref_time(9_995_396).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(i.into()))) } // Storage: Timestamp Now (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:1) @@ -77,22 +80,25 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Identity Claims (r:1 w:1) // Storage: Identity CurrentDid (r:1 w:0) fn invalidate_cdd_claims() -> Weight { - (77_308_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 58_468 nanoseconds. + Weight::from_ref_time(58_889_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity AccountKeyRefCount (r:2 w:0) // Storage: MultiSig MultiSigToIdentity (r:2 w:0) // Storage: Identity Authorizations (r:2 w:0) // Storage: Identity DidKeys (r:0 w:2) + /// The range of component `i` is `[0, 200]`. fn remove_secondary_keys(i: u32) -> Weight { - (153_651_000 as Weight) - // Standard Error: 403_000 - .saturating_add((28_078_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(i as Weight))) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 25_477 nanoseconds. + Weight::from_ref_time(21_917_598) + // Standard Error: 15_158 + .saturating_add(Weight::from_ref_time(13_732_990).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().reads((4_u64).saturating_mul(i.into()))) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(i.into()))) } // Storage: Identity Authorizations (r:2 w:2) // Storage: Identity DidRecords (r:1 w:1) @@ -104,9 +110,10 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Identity AuthorizationsGiven (r:0 w:2) // Storage: Identity DidKeys (r:0 w:2) fn accept_primary_key() -> Weight { - (104_071_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(9 as Weight)) + // Minimum execution time: 84_627 nanoseconds. + Weight::from_ref_time(85_308_000) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(9)) } // Storage: Identity Authorizations (r:2 w:2) // Storage: Identity DidRecords (r:1 w:1) @@ -116,13 +123,15 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Identity AuthorizationsGiven (r:0 w:2) // Storage: Identity DidKeys (r:0 w:1) fn rotate_primary_key_to_secondary() -> Weight { - (143_100_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) + // Minimum execution time: 72_775 nanoseconds. + Weight::from_ref_time(73_786_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(8)) } // Storage: Identity CddAuthForPrimaryKeyRotation (r:0 w:1) fn change_cdd_requirement_for_mk_rotation() -> Weight { - (32_540_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_251 nanoseconds. + Weight::from_ref_time(17_752_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Identity Authorizations (r:1 w:1) // Storage: Identity DidRecords (r:1 w:0) @@ -137,9 +146,10 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Identity DidKeys (r:0 w:1) // Storage: Identity CurrentDid (r:0 w:1) fn join_identity_as_key() -> Weight { - (151_602_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 71_953 nanoseconds. + Weight::from_ref_time(72_363_000) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Identity KeyRecords (r:1 w:1) @@ -147,9 +157,10 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: MultiSig MultiSigToIdentity (r:1 w:0) // Storage: Identity DidKeys (r:0 w:1) fn leave_identity_as_key() -> Weight { - (61_618_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 42_859 nanoseconds. + Weight::from_ref_time(43_199_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity DidRecords (r:1 w:0) @@ -158,17 +169,19 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Timestamp Now (r:1 w:0) // Storage: Identity Claims (r:1 w:1) fn add_claim() -> Weight { - (56_960_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 47_197 nanoseconds. + Weight::from_ref_time(47_658_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Claims (r:1 w:1) // Storage: Asset BalanceOfAtScope (r:1 w:0) fn revoke_claim() -> Weight { - (58_277_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 44_692 nanoseconds. + Weight::from_ref_time(45_033_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Claims (r:1 w:1) @@ -176,57 +189,68 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Asset ScopeIdOf (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:1 w:0) fn revoke_claim_by_index() -> Weight { - (76_831_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 48_860 nanoseconds. + Weight::from_ref_time(49_221_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:2 w:1) fn set_secondary_key_permissions() -> Weight { - (84_890_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_264 nanoseconds. + Weight::from_ref_time(34_925_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } + /// The range of component `a` is `[0, 1000]`. + /// The range of component `p` is `[0, 1000]`. + /// The range of component `l` is `[0, 100]`. + /// The range of component `e` is `[0, 100]`. fn permissions_cost(a: u32, p: u32, l: u32, e: u32) -> Weight { - (0 as Weight) - // Standard Error: 60_000 - .saturating_add((296_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 107_000 - .saturating_add((211_000 as Weight).saturating_mul(p as Weight)) - // Standard Error: 1_073_000 - .saturating_add((27_959_000 as Weight).saturating_mul(l as Weight)) - // Standard Error: 1_073_000 - .saturating_add((26_262_000 as Weight).saturating_mul(e as Weight)) + // Minimum execution time: 200_481 nanoseconds. + Weight::from_ref_time(201_151_000) + // Manually set for `a` + .saturating_add(Weight::from_ref_time(100_000).saturating_mul(a.into())) + // Manually set for `p` + .saturating_add(Weight::from_ref_time(100_000).saturating_mul(p.into())) + // Standard Error: 140_388 + .saturating_add(Weight::from_ref_time(12_202_214).saturating_mul(l.into())) + // Standard Error: 140_388 + .saturating_add(Weight::from_ref_time(11_817_991).saturating_mul(e.into())) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity IsDidFrozen (r:0 w:1) fn freeze_secondary_keys() -> Weight { - (63_860_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 26_959 nanoseconds. + Weight::from_ref_time(27_491_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity IsDidFrozen (r:0 w:1) fn unfreeze_secondary_keys() -> Weight { - (82_294_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 27_130 nanoseconds. + Weight::from_ref_time(27_761_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity MultiPurposeNonce (r:1 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: Identity Authorizations (r:0 w:1) fn add_authorization() -> Weight { - (44_345_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 33_202 nanoseconds. + Weight::from_ref_time(33_452_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) fn remove_authorization() -> Weight { - (61_202_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 35_346 nanoseconds. + Weight::from_ref_time(36_447_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) @@ -234,14 +258,16 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: ProtocolFee Coefficient (r:1 w:0) // Storage: ProtocolFee BaseFees (r:1 w:0) // Storage: Identity DidKeys (r:0 w:2) + /// The range of component `i` is `[0, 200]`. fn add_secondary_keys_with_authorization(i: u32) -> Weight { - (85_253_000 as Weight) - // Standard Error: 305_000 - .saturating_add((74_604_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 37_910 nanoseconds. + Weight::from_ref_time(31_006_236) + // Standard Error: 62_588 + .saturating_add(Weight::from_ref_time(53_146_463).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(i.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity DidRecords (r:1 w:0) @@ -255,9 +281,10 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Asset BalanceOf (r:1 w:0) // Storage: Asset AggregateBalance (r:1 w:1) fn add_investor_uniqueness_claim() -> Weight { - (1_904_315_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 1_009_724 nanoseconds. + Weight::from_ref_time(1_018_561_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity DidRecords (r:1 w:0) @@ -271,19 +298,22 @@ impl pallet_identity::WeightInfo for WeightInfo { // Storage: Asset BalanceOf (r:1 w:0) // Storage: Asset AggregateBalance (r:1 w:1) fn add_investor_uniqueness_claim_v2() -> Weight { - (3_509_996_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 1_913_584 nanoseconds. + Weight::from_ref_time(1_921_098_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity CustomClaimsInverse (r:1 w:1) // Storage: Identity CustomClaimIdSequence (r:1 w:1) // Storage: Identity CustomClaims (r:0 w:1) + /// The range of component `n` is `[1, 2048]`. fn register_custom_claim_type(n: u32) -> Weight { - (46_056_000 as Weight) - // Standard Error: 3_000 - .saturating_add((23_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 34_513 nanoseconds. + Weight::from_ref_time(35_229_181) + // Standard Error: 234 + .saturating_add(Weight::from_ref_time(5_513).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(3)) } } diff --git a/pallets/weights/src/pallet_im_online.rs b/pallets/weights/src/pallet_im_online.rs index c1304fe108..d9793ed725 100644 --- a/pallets/weights/src/pallet_im_online.rs +++ b/pallets/weights/src/pallet_im_online.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_im_online //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,20 +51,23 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_im_online using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_im_online::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_im_online::WeightInfo for SubstrateWeight { // Storage: Session Validators (r:1 w:0) // Storage: Session CurrentIndex (r:1 w:0) // Storage: ImOnline ReceivedHeartbeats (r:1 w:1) // Storage: ImOnline AuthoredBlocks (r:1 w:0) // Storage: ImOnline Keys (r:1 w:0) + /// The range of component `k` is `[1, 1000]`. + /// The range of component `e` is `[1, 100]`. fn validate_unsigned_and_then_heartbeat(k: u32, e: u32) -> Weight { - (149_245_000 as Weight) - // Standard Error: 2_000 - .saturating_add((75_000 as Weight).saturating_mul(k as Weight)) - // Standard Error: 28_000 - .saturating_add((603_000 as Weight).saturating_mul(e as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 108_701 nanoseconds. + Weight::from_ref_time(89_039_827) + // Standard Error: 1_200 + .saturating_add(Weight::from_ref_time(43_220).saturating_mul(k.into())) + // Standard Error: 12_120 + .saturating_add(Weight::from_ref_time(368_299).saturating_mul(e.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_indices.rs b/pallets/weights/src/pallet_indices.rs index cd9f8ed6a9..ef9d5189be 100644 --- a/pallets/weights/src/pallet_indices.rs +++ b/pallets/weights/src/pallet_indices.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_indices //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,38 +51,43 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_indices using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_indices::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_indices::WeightInfo for SubstrateWeight { // Storage: Indices Accounts (r:1 w:1) fn claim() -> Weight { - (43_276_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 32_280 nanoseconds. + Weight::from_ref_time(32_470_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Indices Accounts (r:1 w:1) // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - (45_058_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 38_230 nanoseconds. + Weight::from_ref_time(39_433_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Indices Accounts (r:1 w:1) fn free() -> Weight { - (130_558_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 33_311 nanoseconds. + Weight::from_ref_time(34_063_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Indices Accounts (r:1 w:1) // Storage: System Account (r:1 w:1) fn force_transfer() -> Weight { - (49_887_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 34_895 nanoseconds. + Weight::from_ref_time(35_346_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Indices Accounts (r:1 w:1) fn freeze() -> Weight { - (109_902_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_874 nanoseconds. + Weight::from_ref_time(35_426_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_multisig.rs b/pallets/weights/src/pallet_multisig.rs index cbc45f0822..0736622ea4 100644 --- a/pallets/weights/src/pallet_multisig.rs +++ b/pallets/weights/src/pallet_multisig.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_multisig //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_multisig using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_multisig::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_multisig::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity CurrentDid (r:1 w:0) // Storage: MultiSig MultiSigNonce (r:1 w:1) @@ -60,13 +61,15 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Identity Authorizations (r:0 w:1) // Storage: MultiSig MultiSigToIdentity (r:0 w:1) // Storage: MultiSig MultiSigSignsRequired (r:0 w:1) + /// The range of component `i` is `[1, 256]`. fn create_multisig(i: u32) -> Weight { - (79_534_000 as Weight) - // Standard Error: 70_000 - .saturating_add((12_215_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 50_182 nanoseconds. + Weight::from_ref_time(32_760_927) + // Standard Error: 30_880 + .saturating_add(Weight::from_ref_time(9_478_768).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(i.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: MultiSig ProposalIds (r:1 w:1) @@ -81,9 +84,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig ProposalDetail (r:0 w:1) // Storage: MultiSig Proposals (r:0 w:1) fn create_or_approve_proposal_as_identity() -> Weight { - (115_239_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 90_477 nanoseconds. + Weight::from_ref_time(91_438_000) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(7)) } // Storage: MultiSig ProposalIds (r:1 w:1) // Storage: MultiSig MultiSigSigners (r:1 w:0) @@ -99,9 +103,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig ProposalDetail (r:0 w:1) // Storage: MultiSig Proposals (r:0 w:1) fn create_or_approve_proposal_as_key() -> Weight { - (275_951_000 as Weight) - .saturating_add(DbWeight::get().reads(11 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 93_222 nanoseconds. + Weight::from_ref_time(94_665_000) + .saturating_add(DbWeight::get().reads(11)) + .saturating_add(DbWeight::get().writes(7)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: MultiSig MultiSigSigners (r:1 w:0) @@ -115,9 +120,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig ProposalDetail (r:0 w:1) // Storage: MultiSig Proposals (r:0 w:1) fn create_proposal_as_identity() -> Weight { - (122_542_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 85_327 nanoseconds. + Weight::from_ref_time(86_219_000) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: MultiSig MultiSigSigners (r:1 w:0) // Storage: Identity CurrentDid (r:1 w:0) @@ -132,9 +138,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig ProposalDetail (r:0 w:1) // Storage: MultiSig Proposals (r:0 w:1) fn create_proposal_as_key() -> Weight { - (110_473_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 86_550 nanoseconds. + Weight::from_ref_time(87_702_000) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: MultiSig MultiSigSigners (r:1 w:0) @@ -146,9 +153,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) fn approve_as_identity() -> Weight { - (104_119_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 74_578 nanoseconds. + Weight::from_ref_time(74_888_000) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: MultiSig MultiSigSigners (r:1 w:0) // Storage: MultiSig Votes (r:1 w:1) @@ -159,9 +167,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) fn approve_as_key() -> Weight { - (88_335_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 67_996 nanoseconds. + Weight::from_ref_time(68_627_000) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: MultiSig MultiSigSigners (r:1 w:0) @@ -171,9 +180,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig MultiSigSignsRequired (r:1 w:0) // Storage: MultiSig NumberOfSigners (r:1 w:0) fn reject_as_identity() -> Weight { - (67_369_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 57_476 nanoseconds. + Weight::from_ref_time(57_876_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: MultiSig MultiSigSigners (r:1 w:0) // Storage: MultiSig Votes (r:1 w:1) @@ -182,9 +192,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig MultiSigSignsRequired (r:1 w:0) // Storage: MultiSig NumberOfSigners (r:1 w:0) fn reject_as_key() -> Weight { - (61_836_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 52_477 nanoseconds. + Weight::from_ref_time(53_088_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -194,9 +205,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig NumberOfSigners (r:1 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) fn accept_multisig_signer_as_identity() -> Weight { - (65_327_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 57_466 nanoseconds. + Weight::from_ref_time(58_177_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity Authorizations (r:1 w:1) // Storage: MultiSig MultiSigToIdentity (r:1 w:0) @@ -206,18 +218,20 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig NumberOfSigners (r:1 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) fn accept_multisig_signer_as_key() -> Weight { - (83_983_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 59_841 nanoseconds. + Weight::from_ref_time(60_602_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: MultiSig MultiSigToIdentity (r:1 w:0) // Storage: Identity MultiPurposeNonce (r:1 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: Identity Authorizations (r:0 w:1) fn add_multisig_signer() -> Weight { - (51_046_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 41_977 nanoseconds. + Weight::from_ref_time(42_599_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: MultiSig MultiSigToIdentity (r:1 w:0) // Storage: MultiSig MultiSigSigners (r:1 w:1) @@ -226,9 +240,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Identity CddAuthForPrimaryKeyRotation (r:1 w:0) // Storage: Identity CurrentDid (r:1 w:0) fn remove_multisig_signer() -> Weight { - (144_204_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 47_187 nanoseconds. + Weight::from_ref_time(47_428_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Identity KeyRecords (r:1 w:0) @@ -237,13 +252,15 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Identity MultiPurposeNonce (r:1 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: Identity Authorizations (r:0 w:1) + /// The range of component `i` is `[1, 256]`. fn add_multisig_signers_via_creator(i: u32) -> Weight { - (64_781_000 as Weight) - // Standard Error: 102_000 - .saturating_add((17_501_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 52_116 nanoseconds. + Weight::from_ref_time(18_655_199) + // Standard Error: 16_698 + .saturating_add(Weight::from_ref_time(13_340_764).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(i.into()))) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Identity KeyRecords (r:2 w:1) @@ -253,14 +270,16 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: MultiSig NumberOfSigners (r:1 w:1) // Storage: MultiSig MultiSigSignsRequired (r:1 w:0) // Storage: MultiSig MultiSigSigners (r:1 w:1) + /// The range of component `i` is `[1, 256]`. fn remove_multisig_signers_via_creator(i: u32) -> Weight { - (43_808_000 as Weight) - // Standard Error: 123_000 - .saturating_add((21_993_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(i as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 62_164 nanoseconds. + Weight::from_ref_time(61_078_844) + // Standard Error: 32_662 + .saturating_add(Weight::from_ref_time(13_669_782).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().reads((2_u64).saturating_mul(i.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(i.into()))) } // Storage: MultiSig MultiSigToIdentity (r:1 w:0) // Storage: MultiSig NumberOfSigners (r:1 w:0) @@ -268,17 +287,19 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Identity CurrentDid (r:1 w:0) // Storage: MultiSig MultiSigSignsRequired (r:0 w:1) fn change_sigs_required() -> Weight { - (45_287_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 37_730 nanoseconds. + Weight::from_ref_time(38_811_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:2 w:1) // Storage: MultiSig MultiSigToIdentity (r:1 w:0) // Storage: Identity DidKeys (r:0 w:1) fn make_multisig_secondary() -> Weight { - (50_608_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 44_262 nanoseconds. + Weight::from_ref_time(44_593_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Identity KeyRecords (r:2 w:2) @@ -288,9 +309,10 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Identity CddAuthForPrimaryKeyRotation (r:1 w:0) // Storage: Identity DidKeys (r:0 w:2) fn make_multisig_primary() -> Weight { - (85_912_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 60_802 nanoseconds. + Weight::from_ref_time(61_013_000) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Timestamp Now (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) @@ -304,8 +326,9 @@ impl pallet_multisig::WeightInfo for WeightInfo { // Storage: Identity CurrentDid (r:0 w:1) // Storage: Identity CurrentPayer (r:0 w:1) fn execute_scheduled_proposal() -> Weight { - (258_636_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 71_683 nanoseconds. + Weight::from_ref_time(72_895_000) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(5)) } } diff --git a/pallets/weights/src/pallet_nft.rs b/pallets/weights/src/pallet_nft.rs index 0bf1814da8..cc50d46116 100644 --- a/pallets/weights/src/pallet_nft.rs +++ b/pallets/weights/src/pallet_nft.rs @@ -50,8 +50,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_nft using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_nft::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_nft::WeightInfo for SubstrateWeight { // Storage: Asset Tokens (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:0) // Storage: NFT CollectionTicker (r:1 w:1) @@ -76,12 +76,12 @@ impl pallet_nft::WeightInfo for WeightInfo { // Storage: ExternalAgents AgentOf (r:0 w:1) // Storage: ExternalAgents GroupOfAgent (r:0 w:1) fn create_nft_collection(n: u32) -> Weight { - (120_477_000 as Weight) + Weight::from_ref_time(120_477_000 as u64) // Standard Error: 6_000 - .saturating_add((3_674_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(16 as Weight)) + .saturating_add(Weight::from_ref_time(3_674_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(16 as u64)) } // Storage: NFT CollectionTicker (r:1 w:0) // Storage: Identity KeyRecords (r:1 w:0) @@ -95,12 +95,12 @@ impl pallet_nft::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioNFT (r:0 w:1) // Storage: NFT MetadataValue (r:0 w:1) fn issue_nft(n: u32) -> Weight { - (70_116_000 as Weight) + Weight::from_ref_time(70_116_000 as u64) // Standard Error: 4_000 - .saturating_add((2_578_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + .saturating_add(Weight::from_ref_time(2_578_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(n as u64))) } // Storage: NFT CollectionTicker (r:1 w:0) // Storage: Identity KeyRecords (r:1 w:0) @@ -112,11 +112,11 @@ impl pallet_nft::WeightInfo for WeightInfo { // Storage: Asset BalanceOf (r:1 w:1) // Storage: NFT MetadataValue (r:0 w:1) fn redeem_nft(n: u32) -> Weight { - (76_996_000 as Weight) + Weight::from_ref_time(76_996_000 as u64) // Standard Error: 4_000 - .saturating_add((871_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + .saturating_add(Weight::from_ref_time(871_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(n as u64))) } } diff --git a/pallets/weights/src/pallet_pips.rs b/pallets/weights/src/pallet_pips.rs index a4bbfeb2db..2a1d04ab6e 100644 --- a/pallets/weights/src/pallet_pips.rs +++ b/pallets/weights/src/pallet_pips.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_pips //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,50 +51,55 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_pips using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_pips::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_pips::WeightInfo for SubstrateWeight { // Storage: Pips PruneHistoricalPips (r:1 w:1) fn set_prune_historical_pips() -> Weight { - (24_488_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 20_768 nanoseconds. + Weight::from_ref_time(21_299_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Pips MinimumProposalDeposit (r:1 w:1) fn set_min_proposal_deposit() -> Weight { - (25_644_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 21_691 nanoseconds. + Weight::from_ref_time(22_692_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Pips DefaultEnactmentPeriod (r:1 w:1) fn set_default_enactment_period() -> Weight { - (22_774_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 22_421 nanoseconds. + Weight::from_ref_time(22_953_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Pips PendingPipExpiry (r:1 w:1) fn set_pending_pip_expiry() -> Weight { - (26_131_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 22_191 nanoseconds. + Weight::from_ref_time(22_512_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Pips MaxPipSkipCount (r:1 w:1) fn set_max_pip_skip_count() -> Weight { - (25_405_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 20_658 nanoseconds. + Weight::from_ref_time(21_279_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Pips ActivePipLimit (r:1 w:1) fn set_active_pip_limit() -> Weight { - (25_271_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 21_720 nanoseconds. + Weight::from_ref_time(22_100_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Pips PipIdSequence (r:1 w:1) // Storage: Pips ActivePipLimit (r:1 w:0) // Storage: Pips ActivePipCount (r:1 w:1) // Storage: Pips MinimumProposalDeposit (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: ProtocolFee Coefficient (r:1 w:0) @@ -107,9 +113,10 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips Proposals (r:0 w:1) // Storage: Pips ProposalStates (r:0 w:1) fn propose_from_community() -> Weight { - (182_332_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(12 as Weight)) + // Minimum execution time: 104_993 nanoseconds. + Weight::from_ref_time(107_659_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(11)) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Pips PipIdSequence (r:1 w:1) @@ -122,22 +129,23 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips Proposals (r:0 w:1) // Storage: Pips ProposalStates (r:0 w:1) fn propose_from_committee() -> Weight { - (95_400_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 61_213 nanoseconds. + Weight::from_ref_time(63_227_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Pips Proposals (r:1 w:0) // Storage: Pips ProposalStates (r:1 w:0) // Storage: Pips ProposalResult (r:1 w:1) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Pips Deposits (r:1 w:1) // Storage: Pips ProposalVotes (r:1 w:1) // Storage: Pips LiveQueue (r:1 w:1) fn vote() -> Weight { - (223_574_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 173_130 nanoseconds. + Weight::from_ref_time(181_616_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Pips ProposalStates (r:1 w:1) // Storage: Pips Proposals (r:1 w:0) @@ -146,9 +154,10 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Scheduler Agenda (r:1 w:1) // Storage: Pips PipToSchedule (r:0 w:1) fn approve_committee_proposal() -> Weight { - (147_679_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 54_842 nanoseconds. + Weight::from_ref_time(55_573_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Pips ProposalStates (r:1 w:1) // Storage: Pips LiveQueue (r:1 w:1) @@ -164,9 +173,10 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips PipSkipCount (r:0 w:1) // Storage: Pips ProposalResult (r:0 w:1) fn reject_proposal() -> Weight { - (179_779_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(11 as Weight)) + // Minimum execution time: 96_539 nanoseconds. + Weight::from_ref_time(97_260_000) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(11)) } // Storage: Pips ProposalStates (r:1 w:1) // Storage: Pips Deposits (r:1 w:0) @@ -176,9 +186,10 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips PipSkipCount (r:0 w:1) // Storage: Pips ProposalResult (r:0 w:1) fn prune_proposal() -> Weight { - (171_912_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 57_476 nanoseconds. + Weight::from_ref_time(58_217_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(6)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee ReleaseCoordinator (r:1 w:0) @@ -187,18 +198,20 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Scheduler Agenda (r:2 w:2) // Storage: Pips PipToSchedule (r:0 w:1) fn reschedule_execution() -> Weight { - (105_473_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 64_409 nanoseconds. + Weight::from_ref_time(65_361_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee Members (r:1 w:0) // Storage: Pips SnapshotMeta (r:1 w:1) // Storage: Pips SnapshotQueue (r:0 w:1) fn clear_snapshot() -> Weight { - (54_718_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 41_196 nanoseconds. + Weight::from_ref_time(42_048_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee Members (r:1 w:0) @@ -207,9 +220,10 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips SnapshotQueue (r:0 w:1) // Storage: Pips SnapshotMeta (r:0 w:1) fn snapshot() -> Weight { - (794_311_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 5_045_658 nanoseconds. + Weight::from_ref_time(5_749_538_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Pips MaxPipSkipCount (r:1 w:0) // Storage: Pips SnapshotQueue (r:1 w:1) @@ -226,18 +240,26 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) // Storage: Pips PipToSchedule (r:0 w:1) + /// The range of component `a` is `[0, 33]`. + /// The range of component `r` is `[0, 33]`. + /// The range of component `s` is `[0, 33]`. fn enact_snapshot_results(a: u32, r: u32, s: u32) -> Weight { - (10_522_234_000 as Weight) - // Standard Error: 79_087_000 - .saturating_add((15_530_919_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(689 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(a as Weight))) - .saturating_add(DbWeight::get().reads((405 as Weight).saturating_mul(r as Weight))) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(685 as Weight)) - .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(a as Weight))) - .saturating_add(DbWeight::get().writes((404 as Weight).saturating_mul(r as Weight))) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + // Minimum execution time: 6_566_096 nanoseconds. + Weight::from_ref_time(6_957_298_000) + // Standard Error: 12_544_789 + .saturating_add(Weight::from_ref_time(10_744_149).saturating_mul(a.into())) + // Standard Error: 12_544_789 + .saturating_add(Weight::from_ref_time(7_854_153_472).saturating_mul(r.into())) + // Standard Error: 12_544_789 + .saturating_add(Weight::from_ref_time(44_364_707).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(685)) + .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(a.into()))) + .saturating_add(DbWeight::get().reads((405_u64).saturating_mul(r.into()))) + .saturating_add(DbWeight::get().reads((2_u64).saturating_mul(s.into()))) + .saturating_add(DbWeight::get().writes(681)) + .saturating_add(DbWeight::get().writes((4_u64).saturating_mul(a.into()))) + .saturating_add(DbWeight::get().writes((404_u64).saturating_mul(r.into()))) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(s.into()))) } // Storage: Pips Proposals (r:1 w:1) // Storage: Pips ProposalStates (r:1 w:1) @@ -252,9 +274,10 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips PipToSchedule (r:0 w:1) // Storage: Pips ProposalResult (r:0 w:1) fn execute_scheduled_pip() -> Weight { - (22_111_574_000 as Weight) - .saturating_add(DbWeight::get().reads(1205 as Weight)) - .saturating_add(DbWeight::get().writes(1607 as Weight)) + // Minimum execution time: 17_083_650 nanoseconds. + Weight::from_ref_time(17_474_763_000) + .saturating_add(DbWeight::get().reads(1205)) + .saturating_add(DbWeight::get().writes(1607)) } // Storage: Pips ProposalStates (r:1 w:1) // Storage: Pips LiveQueue (r:1 w:1) @@ -271,8 +294,9 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips PipSkipCount (r:0 w:1) // Storage: Pips ProposalResult (r:0 w:1) fn expire_scheduled_pip() -> Weight { - (22_383_084_000 as Weight) - .saturating_add(DbWeight::get().reads(1208 as Weight)) - .saturating_add(DbWeight::get().writes(1608 as Weight)) + // Minimum execution time: 18_138_449 nanoseconds. + Weight::from_ref_time(18_256_757_000) + .saturating_add(DbWeight::get().reads(1208)) + .saturating_add(DbWeight::get().writes(1608)) } } diff --git a/pallets/weights/src/pallet_portfolio.rs b/pallets/weights/src/pallet_portfolio.rs index 19650605e5..d8bff51c83 100644 --- a/pallets/weights/src/pallet_portfolio.rs +++ b/pallets/weights/src/pallet_portfolio.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_portfolio //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,16 +51,17 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_portfolio using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_portfolio::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_portfolio::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio NameToNumber (r:1 w:1) // Storage: Portfolio NextPortfolioNumber (r:1 w:1) // Storage: Portfolio Portfolios (r:0 w:1) fn create_portfolio() -> Weight { - (164_683_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 38_721 nanoseconds. + Weight::from_ref_time(39_473_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio PortfolioAssetCount (r:1 w:1) @@ -68,9 +70,10 @@ impl pallet_portfolio::WeightInfo for WeightInfo { // Storage: Portfolio PortfoliosInCustody (r:0 w:1) // Storage: Portfolio NameToNumber (r:0 w:1) fn delete_portfolio() -> Weight { - (85_305_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 52_497 nanoseconds. + Weight::from_ref_time(53_108_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio PortfolioCustodian (r:1 w:0) @@ -79,32 +82,37 @@ impl pallet_portfolio::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioAssetBalances (r:2 w:2) // Storage: Portfolio PortfolioLockedAssets (r:1 w:0) // Storage: Portfolio PortfolioAssetCount (r:2 w:2) + /// The range of component `a` is `[1, 500]`. fn move_portfolio_funds(a: u32) -> Weight { - (0 as Weight) - // Standard Error: 201_000 - .saturating_add((46_270_000 as Weight).saturating_mul(a as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(a as Weight))) + // Minimum execution time: 58_878 nanoseconds. + Weight::from_ref_time(59_269_000) + // Standard Error: 28_100 + .saturating_add(Weight::from_ref_time(21_530_196).saturating_mul(a.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((4_u64).saturating_mul(a.into()))) + .saturating_add(DbWeight::get().writes(2)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(a.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio Portfolios (r:1 w:1) // Storage: Portfolio NameToNumber (r:1 w:2) + /// The range of component `i` is `[1, 500]`. fn rename_portfolio(i: u32) -> Weight { - (75_356_000 as Weight) - // Standard Error: 13_000 - .saturating_add((31_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 41_106 nanoseconds. + Weight::from_ref_time(43_656_870) + // Standard Error: 1_134 + .saturating_add(Weight::from_ref_time(11_802).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio PortfolioCustodian (r:1 w:1) // Storage: Portfolio PortfoliosInCustody (r:0 w:1) fn quit_portfolio_custody() -> Weight { - (90_935_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 37_319 nanoseconds. + Weight::from_ref_time(38_331_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -112,9 +120,10 @@ impl pallet_portfolio::WeightInfo for WeightInfo { // Storage: Portfolio PortfoliosInCustody (r:0 w:2) // Storage: Identity AuthorizationsGiven (r:0 w:1) fn accept_portfolio_custody() -> Weight { - (75_337_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 50_784 nanoseconds. + Weight::from_ref_time(50_874_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio Portfolios (r:1 w:0) @@ -126,16 +135,16 @@ impl pallet_portfolio::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioLockedAssets (r:1 w:0) // Storage: Portfolio PortfolioAssetCount (r:1 w:1) fn move_portfolio_funds_v2(f: u32, n: u32) -> Weight { - (68_018_000 as Weight) + Weight::from_ref_time(68_018_000 as u64) // Standard Error: 473_000 - .saturating_add((25_861_000 as Weight).saturating_mul(f as Weight)) + .saturating_add(Weight::from_ref_time(25_861_000 as u64).saturating_mul(f as u64)) // Standard Error: 23_000 - .saturating_add((13_023_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(n as Weight))) + .saturating_add(Weight::from_ref_time(13_023_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().reads((4 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(n as u64))) } } diff --git a/pallets/weights/src/pallet_preimage.rs b/pallets/weights/src/pallet_preimage.rs index 3477116685..d3a7b19fec 100644 --- a/pallets/weights/src/pallet_preimage.rs +++ b/pallets/weights/src/pallet_preimage.rs @@ -1,6 +1,6 @@ // This file is part of Substrate. -// Copyright (C) 2022 Parity Technologies (UK) Ltd. +// Copyright (C) 2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,117 +18,138 @@ //! Autogenerated weights for pallet_preimage //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2022-01-31, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: -// ./target/production/substrate +// ./target/release/polymesh // benchmark -// --chain=dev -// --steps=50 -// --repeat=20 -// --pallet=pallet_preimage -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./frame/preimage/src/weights.rs -// --template=.maintain/frame-weight-template.hbs -// --header=HEADER-APACHE2 -// --raw +// pallet +// -s +// 100 +// -r +// 5 +// -p=pallet_preimage +// -e=* +// --heap-pages +// 4096 +// --db-cache +// 512 +// --execution +// wasm +// --wasm-execution +// compiled +// --output +// ./pallets/weights/src/ +// --template +// ./.maintain/frame-weight-template.hbs -#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; -/// Weights for pallet_scheduler using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_preimage::WeightInfo for WeightInfo { - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) - fn note_preimage(s: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:0) - fn note_requested_preimage(s: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:0) - fn note_no_deposit_preimage(s: u32, ) -> Weight { - (0 as Weight) - // Standard Error: 0 - .saturating_add((2_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) - fn unnote_preimage() -> Weight { - (39_239_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) - fn unnote_no_deposit_preimage() -> Weight { - (24_905_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - fn request_preimage() -> Weight { - (37_451_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - fn request_no_deposit_preimage() -> Weight { - (23_397_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - fn request_unnoted_preimage() -> Weight { - (13_407_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - fn request_requested_preimage() -> Weight { - (4_202_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) - fn unrequest_preimage() -> Weight { - (24_858_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Preimage PreimageFor (r:0 w:1) - fn unrequest_unnoted_preimage() -> Weight { - (13_763_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - // Storage: Preimage StatusFor (r:1 w:1) - fn unrequest_multi_referenced_preimage() -> Weight { - (4_262_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } +/// Weights for pallet_preimage using the Substrate node and recommended hardware. +pub struct SubstrateWeight; +impl pallet_preimage::WeightInfo for SubstrateWeight { + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_preimage(s: u32) -> Weight { + // Minimum execution time: 34_614 nanoseconds. + Weight::from_ref_time(34_975_000) + // Standard Error: 4 + .saturating_add(Weight::from_ref_time(1_459).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_requested_preimage(s: u32) -> Weight { + // Minimum execution time: 24_866 nanoseconds. + Weight::from_ref_time(41_874_607) + // Standard Error: 4 + .saturating_add(Weight::from_ref_time(1_451).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + /// The range of component `s` is `[0, 4194304]`. + fn note_no_deposit_preimage(s: u32) -> Weight { + // Minimum execution time: 29_514 nanoseconds. + Weight::from_ref_time(34_293_360) + // Standard Error: 4 + .saturating_add(Weight::from_ref_time(1_431).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_preimage() -> Weight { + // Minimum execution time: 37_649 nanoseconds. + Weight::from_ref_time(38_240_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unnote_no_deposit_preimage() -> Weight { + // Minimum execution time: 24_596 nanoseconds. + Weight::from_ref_time(25_276_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_preimage() -> Weight { + // Minimum execution time: 26_208 nanoseconds. + Weight::from_ref_time(29_916_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_no_deposit_preimage() -> Weight { + // Minimum execution time: 12_212 nanoseconds. + Weight::from_ref_time(12_613_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_unnoted_preimage() -> Weight { + // Minimum execution time: 19_727 nanoseconds. + Weight::from_ref_time(20_107_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn request_requested_preimage() -> Weight { + // Minimum execution time: 10_600 nanoseconds. + Weight::from_ref_time(11_071_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + // Storage: Preimage PreimageFor (r:0 w:1) + fn unrequest_preimage() -> Weight { + // Minimum execution time: 23_604 nanoseconds. + Weight::from_ref_time(24_486_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_unnoted_preimage() -> Weight { + // Minimum execution time: 10_419 nanoseconds. + Weight::from_ref_time(10_790_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) + } + // Storage: Preimage StatusFor (r:1 w:1) + fn unrequest_multi_referenced_preimage() -> Weight { + // Minimum execution time: 10_589 nanoseconds. + Weight::from_ref_time(10_759_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) + } } diff --git a/pallets/weights/src/pallet_protocol_fee.rs b/pallets/weights/src/pallet_protocol_fee.rs index d25374227a..4c304b6188 100644 --- a/pallets/weights/src/pallet_protocol_fee.rs +++ b/pallets/weights/src/pallet_protocol_fee.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_protocol_fee //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,14 +51,16 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_protocol_fee using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_protocol_fee::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_protocol_fee::WeightInfo for SubstrateWeight { // Storage: ProtocolFee Coefficient (r:0 w:1) fn change_coefficient() -> Weight { - (17_374_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_092 nanoseconds. + Weight::from_ref_time(17_693_000).saturating_add(DbWeight::get().writes(1)) } // Storage: ProtocolFee BaseFees (r:0 w:1) fn change_base_fee() -> Weight { - (40_408_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_913 nanoseconds. + Weight::from_ref_time(18_494_000).saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_relayer.rs b/pallets/weights/src/pallet_relayer.rs index 8f1eb468da..8a2084c4e6 100644 --- a/pallets/weights/src/pallet_relayer.rs +++ b/pallets/weights/src/pallet_relayer.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_relayer //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -47,21 +48,20 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::traits::Get; use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; -use sp_std::marker::PhantomData; /// Weights for pallet_relayer using the Substrate node and recommended hardware. -pub struct WeightInfo(PhantomData); -impl pallet_relayer::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_relayer::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity MultiPurposeNonce (r:1 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: Identity Authorizations (r:0 w:1) fn set_paying_key() -> Weight { - (52_900_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 38_521 nanoseconds. + Weight::from_ref_time(39_032_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -73,37 +73,42 @@ impl pallet_relayer::WeightInfo for WeightInfo { // Storage: Identity AccountKeyRefCount (r:2 w:2) // Storage: Identity AuthorizationsGiven (r:0 w:1) fn accept_paying_key() -> Weight { - (115_234_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 84_446 nanoseconds. + Weight::from_ref_time(85_077_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Relayer Subsidies (r:1 w:1) // Storage: Identity AccountKeyRefCount (r:2 w:2) fn remove_paying_key() -> Weight { - (45_370_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 42_438 nanoseconds. + Weight::from_ref_time(42_639_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Relayer Subsidies (r:1 w:1) fn update_polyx_limit() -> Weight { - (40_478_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_745 nanoseconds. + Weight::from_ref_time(35_415_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Relayer Subsidies (r:1 w:1) fn increase_polyx_limit() -> Weight { - (67_330_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 35_064 nanoseconds. + Weight::from_ref_time(35_335_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Relayer Subsidies (r:1 w:1) fn decrease_polyx_limit() -> Weight { - (35_955_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_674 nanoseconds. + Weight::from_ref_time(35_024_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } } diff --git a/pallets/weights/src/pallet_rewards.rs b/pallets/weights/src/pallet_rewards.rs index 837ba0da84..ab90cc2942 100644 --- a/pallets/weights/src/pallet_rewards.rs +++ b/pallets/weights/src/pallet_rewards.rs @@ -51,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; use sp_std::marker::PhantomData; /// Weights for pallet_rewards using the Substrate node and recommended hardware. -pub struct WeightInfo(PhantomData); -impl pallet_rewards::WeightInfo for WeightInfo { +pub struct SubstrateWeight(PhantomData); +impl pallet_rewards::WeightInfo for SubstrateWeight { // Storage: Rewards ItnRewards (r:1 w:1) // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity KeyRecords (r:2 w:0) @@ -69,12 +69,12 @@ impl pallet_rewards::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: Staking Payee (r:0 w:1) fn claim_itn_reward() -> Weight { - (309_235_000 as Weight) - .saturating_add(DbWeight::get().reads(17 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) + Weight::from_ref_time(309_235_000 as u64) + .saturating_add(DbWeight::get().reads(17 as u64)) + .saturating_add(DbWeight::get().writes(8 as u64)) } // Storage: Rewards ItnRewards (r:0 w:1) fn set_itn_reward_status() -> Weight { - (6_318_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(6_318_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_scheduler.rs b/pallets/weights/src/pallet_scheduler.rs index a6f7445ca2..66b56402bc 100644 --- a/pallets/weights/src/pallet_scheduler.rs +++ b/pallets/weights/src/pallet_scheduler.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_scheduler //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,152 +51,98 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_scheduler using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_scheduler::WeightInfo for WeightInfo { - // Storage: Scheduler Agenda (r:2 w:2) - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Scheduler Lookup (r:0 w:1) - fn on_initialize_periodic_named_resolved(s: u32) -> Weight { - (323_671_000 as Weight) - // Standard Error: 2_738_000 - .saturating_add((36_011_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(s as Weight))) +pub struct SubstrateWeight; +impl pallet_scheduler::WeightInfo for SubstrateWeight { + // Storage: Scheduler IncompleteSince (r:1 w:1) + fn service_agendas_base() -> Weight { + // Minimum execution time: 5_690 nanoseconds. + Weight::from_ref_time(5_921_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Scheduler Agenda (r:1 w:1) - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) - // Storage: Scheduler Lookup (r:0 w:1) - fn on_initialize_named_resolved(s: u32) -> Weight { - (189_810_000 as Weight) - // Standard Error: 2_846_000 - .saturating_add((34_162_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + /// The range of component `s` is `[0, 50]`. + fn service_agenda_base(s: u32) -> Weight { + // Minimum execution time: 4_849 nanoseconds. + Weight::from_ref_time(8_917_460) + // Standard Error: 3_633 + .saturating_add(Weight::from_ref_time(429_534).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } - // Storage: Scheduler Agenda (r:2 w:2) - // Storage: Preimage PreimageFor (r:1 w:1) - // Storage: Preimage StatusFor (r:1 w:1) - fn on_initialize_periodic_resolved(s: u32) -> Weight { - (318_362_000 as Weight) - // Standard Error: 3_054_000 - .saturating_add((32_874_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + fn service_task_base() -> Weight { + // Minimum execution time: 12_182 nanoseconds. + Weight::from_ref_time(13_065_000) } - // Storage: Scheduler Agenda (r:1 w:1) // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:1) - fn on_initialize_resolved(s: u32) -> Weight { - (202_634_000 as Weight) - // Standard Error: 2_151_000 - .saturating_add((27_098_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + /// The range of component `s` is `[128, 4194304]`. + fn service_task_fetched(s: u32) -> Weight { + // Minimum execution time: 27_290 nanoseconds. + Weight::from_ref_time(27_320_000) + // Standard Error: 2 + .saturating_add(Weight::from_ref_time(819).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(2)) } - // Storage: Scheduler Agenda (r:2 w:2) - // Storage: Preimage PreimageFor (r:1 w:0) // Storage: Scheduler Lookup (r:0 w:1) - fn on_initialize_named_aborted(s: u32) -> Weight { - (65_035_000 as Weight) - // Standard Error: 1_411_000 - .saturating_add((14_999_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - // Storage: Scheduler Agenda (r:2 w:2) - // Storage: Preimage PreimageFor (r:1 w:0) - fn on_initialize_aborted(s: u32) -> Weight { - (64_503_000 as Weight) - // Standard Error: 894_000 - .saturating_add((9_734_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) + fn service_task_named() -> Weight { + // Minimum execution time: 13_394 nanoseconds. + Weight::from_ref_time(13_605_000).saturating_add(DbWeight::get().writes(1)) } - // Storage: Scheduler Agenda (r:2 w:2) - // Storage: Scheduler Lookup (r:0 w:1) - fn on_initialize_periodic_named(s: u32) -> Weight { - (69_487_000 as Weight) - // Standard Error: 2_267_000 - .saturating_add((25_617_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight))) + fn service_task_periodic() -> Weight { + // Minimum execution time: 11_461 nanoseconds. + Weight::from_ref_time(11_652_000) } - // Storage: Scheduler Agenda (r:2 w:2) - fn on_initialize_periodic(s: u32) -> Weight { - (91_929_000 as Weight) - // Standard Error: 1_986_000 - .saturating_add((18_768_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + fn execute_dispatch_signed() -> Weight { + // Minimum execution time: 5_179 nanoseconds. + Weight::from_ref_time(5_340_000) } - // Storage: Scheduler Agenda (r:1 w:1) - // Storage: Scheduler Lookup (r:0 w:1) - fn on_initialize_named(s: u32) -> Weight { - (87_190_000 as Weight) - // Standard Error: 1_511_000 - .saturating_add((15_747_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - // Storage: Scheduler Agenda (r:1 w:1) - fn on_initialize(s: u32) -> Weight { - (69_180_000 as Weight) - // Standard Error: 1_228_000 - .saturating_add((13_298_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + fn execute_dispatch_unsigned() -> Weight { + // Minimum execution time: 5_260 nanoseconds. + Weight::from_ref_time(5_600_000) } // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. fn schedule(s: u32) -> Weight { - (54_152_000 as Weight) - // Standard Error: 145_000 - .saturating_add((115_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 21_470 nanoseconds. + Weight::from_ref_time(24_835_964) + // Standard Error: 5_328 + .saturating_add(Weight::from_ref_time(430_846).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Scheduler Agenda (r:1 w:1) // Storage: Scheduler Lookup (r:0 w:1) + /// The range of component `s` is `[1, 50]`. fn cancel(s: u32) -> Weight { - (70_932_000 as Weight) - // Standard Error: 286_000 - .saturating_add((1_173_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 21_911 nanoseconds. + Weight::from_ref_time(23_175_482) + // Standard Error: 3_158 + .saturating_add(Weight::from_ref_time(418_212).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. fn schedule_named(s: u32) -> Weight { - (28_166_000 as Weight) - // Standard Error: 55_000 - .saturating_add((454_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 24_215 nanoseconds. + Weight::from_ref_time(28_748_465) + // Standard Error: 11_682 + .saturating_add(Weight::from_ref_time(490_645).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[1, 50]`. fn cancel_named(s: u32) -> Weight { - (56_084_000 as Weight) - // Standard Error: 301_000 - .saturating_add((1_989_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 23_794 nanoseconds. + Weight::from_ref_time(26_378_940) + // Standard Error: 18_377 + .saturating_add(Weight::from_ref_time(448_772).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(2)) } } diff --git a/pallets/weights/src/pallet_session.rs b/pallets/weights/src/pallet_session.rs index f11dd68e7f..1dddc2e04f 100644 --- a/pallets/weights/src/pallet_session.rs +++ b/pallets/weights/src/pallet_session.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_session //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,22 +51,24 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_session using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_session::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_session::WeightInfo for SubstrateWeight { // Storage: Staking Ledger (r:1 w:0) // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:4 w:4) fn set_keys() -> Weight { - (76_220_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 70_581 nanoseconds. + Weight::from_ref_time(71_542_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Staking Ledger (r:1 w:0) // Storage: Session NextKeys (r:1 w:1) // Storage: Session KeyOwner (r:0 w:4) fn purge_keys() -> Weight { - (56_389_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 58_689 nanoseconds. + Weight::from_ref_time(61_464_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(5)) } } diff --git a/pallets/weights/src/pallet_settlement.rs b/pallets/weights/src/pallet_settlement.rs index 0a52615e19..98b91a1343 100644 --- a/pallets/weights/src/pallet_settlement.rs +++ b/pallets/weights/src/pallet_settlement.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_settlement //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -47,55 +48,62 @@ #![allow(unused_parens)] #![allow(unused_imports)] -use pallet_settlement::{get_transfer_by_asset, LegV2}; use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_settlement using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_settlement::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_settlement::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueCounter (r:1 w:1) // Storage: Settlement UserVenues (r:1 w:1) // Storage: Settlement VenueInfo (r:0 w:1) // Storage: Settlement Details (r:0 w:1) // Storage: Settlement VenueSigners (r:0 w:50) + /// The range of component `d` is `[1, 2048]`. + /// The range of component `s` is `[0, 50]`. fn create_venue(d: u32, s: u32) -> Weight { - (64_307_000 as Weight) - // Standard Error: 1_000 - .saturating_add((9_000 as Weight).saturating_mul(d as Weight)) - // Standard Error: 55_000 - .saturating_add((2_830_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + // Minimum execution time: 39_733 nanoseconds. + Weight::from_ref_time(39_161_374) + // Standard Error: 202 + .saturating_add(Weight::from_ref_time(2_353).saturating_mul(d.into())) + // Standard Error: 8_239 + .saturating_add(Weight::from_ref_time(1_930_155).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(s.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) // Storage: Settlement Details (r:0 w:1) + /// The range of component `d` is `[1, 2048]`. fn update_venue_details(d: u32) -> Weight { - (60_542_000 as Weight) - // Standard Error: 2_000 - .saturating_add((1_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 32_680 nanoseconds. + Weight::from_ref_time(34_950_775) + // Standard Error: 288 + .saturating_add(Weight::from_ref_time(762).saturating_mul(d.into())) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:1) fn update_venue_type() -> Weight { - (41_814_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 32_370 nanoseconds. + Weight::from_ref_time(32_891_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) // Storage: Settlement VenueSigners (r:1 w:1) + /// The range of component `s` is `[0, 50]`. fn update_venue_signers(s: u32) -> Weight { - (73_894_000 as Weight) - // Standard Error: 127_000 - .saturating_add((7_435_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + // Minimum execution time: 30_626 nanoseconds. + Weight::from_ref_time(37_642_859) + // Standard Error: 10_259 + .saturating_add(Weight::from_ref_time(3_462_863).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(s.into()))) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(s.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) @@ -107,14 +115,16 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueFiltering (r:1 w:0) // Storage: Settlement InstructionLegs (r:0 w:1) // Storage: Settlement UserAffirmations (r:0 w:2) + /// The range of component `l` is `[1, 10]`. fn add_instruction(l: u32) -> Weight { - (52_088_000 as Weight) - // Standard Error: 1_892_000 - .saturating_add((19_622_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 43_019 nanoseconds. + Weight::from_ref_time(37_650_918) + // Standard Error: 45_281 + .saturating_add(Weight::from_ref_time(9_341_374).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) @@ -128,17 +138,18 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueFiltering (r:1 w:0) // Storage: Settlement InstructionLegs (r:0 w:1) // Storage: Settlement UserAffirmations (r:0 w:2) + /// The range of component `l` is `[1, 10]`. fn add_instruction_with_settle_on_block_type(l: u32) -> Weight { - (98_691_000 as Weight) - // Standard Error: 1_546_000 - .saturating_add((17_634_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(3 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 61_073 nanoseconds. + Weight::from_ref_time(55_770_778) + // Standard Error: 36_316 + .saturating_add(Weight::from_ref_time(9_236_082).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(3)) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Settlement VenueInfo (r:1 w:0) // Storage: Settlement VenueFiltering (r:1 w:0) // Storage: Settlement InstructionCounter (r:1 w:1) @@ -154,17 +165,18 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) + /// The range of component `l` is `[1, 10]`. fn add_and_affirm_instruction(l: u32) -> Weight { - (145_578_000 as Weight) - // Standard Error: 2_536_000 - .saturating_add((72_449_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(5 as Weight)) - .saturating_add(DbWeight::get().writes((6 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 110_675 nanoseconds. + Weight::from_ref_time(79_732_657) + // Standard Error: 97_715 + .saturating_add(Weight::from_ref_time(36_375_230).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((6_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Settlement VenueInfo (r:1 w:0) // Storage: Settlement VenueFiltering (r:1 w:0) // Storage: Settlement InstructionCounter (r:1 w:1) @@ -182,14 +194,16 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) + /// The range of component `l` is `[1, 10]`. fn add_and_affirm_instruction_with_settle_on_block_type(l: u32) -> Weight { - (183_423_000 as Weight) - // Standard Error: 8_719_000 - .saturating_add((80_566_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(7 as Weight)) - .saturating_add(DbWeight::get().writes((6 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 132_565 nanoseconds. + Weight::from_ref_time(97_850_453) + // Standard Error: 58_630 + .saturating_add(Weight::from_ref_time(37_324_304).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(6)) + .saturating_add(DbWeight::get().writes((6_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -197,33 +211,38 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Settlement VenueFiltering (r:0 w:1) fn set_venue_filtering() -> Weight { - (57_263_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 40_985 nanoseconds. + Weight::from_ref_time(41_226_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Settlement VenueAllowList (r:0 w:1) + /// The range of component `v` is `[0, 100]`. fn allow_venues(v: u32) -> Weight { - (77_753_000 as Weight) - // Standard Error: 169_000 - .saturating_add((2_907_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(v as Weight))) + // Minimum execution time: 39_272 nanoseconds. + Weight::from_ref_time(40_103_592) + // Standard Error: 17_875 + .saturating_add(Weight::from_ref_time(1_774_899).saturating_mul(v.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(v.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Settlement VenueAllowList (r:0 w:1) + /// The range of component `v` is `[0, 100]`. fn disallow_venues(v: u32) -> Weight { - (76_515_000 as Weight) - // Standard Error: 191_000 - .saturating_add((3_126_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(v as Weight))) + // Minimum execution time: 38_962 nanoseconds. + Weight::from_ref_time(40_296_047) + // Standard Error: 2_619 + .saturating_add(Weight::from_ref_time(1_687_616).saturating_mul(v.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(v.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -235,16 +254,17 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionLegStatus (r:1 w:1) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) + /// The range of component `l` is `[0, 10]`. fn withdraw_affirmation(l: u32) -> Weight { - (50_005_000 as Weight) - // Standard Error: 4_527_000 - .saturating_add((66_389_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 33_151 nanoseconds. + Weight::from_ref_time(46_008_498) + // Standard Error: 119_212 + .saturating_add(Weight::from_ref_time(31_545_130).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((5_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((4_u64).saturating_mul(l.into()))) } - // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:1) // Storage: Settlement InstructionLegs (r:2 w:1) @@ -256,33 +276,36 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionAffirmsPending (r:0 w:1) // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) + /// The range of component `l` is `[1, 10]`. fn reject_instruction(l: u32) -> Weight { - (105_134_000 as Weight) - // Standard Error: 1_025_000 - .saturating_add((48_780_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(3 as Weight)) - .saturating_add(DbWeight::get().writes((6 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 94_174 nanoseconds. + Weight::from_ref_time(74_822_703) + // Standard Error: 94_753 + .saturating_add(Weight::from_ref_time(26_427_027).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(3)) + .saturating_add(DbWeight::get().writes((6_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) // Storage: Settlement InstructionLegs (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Settlement InstructionAffirmsPending (r:1 w:1) // Storage: Scheduler Lookup (r:1 w:0) // Storage: Portfolio PortfolioCustodian (r:1 w:0) // Storage: Settlement UserAffirmations (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) + /// The range of component `l` is `[0, 10]`. fn affirm_instruction(l: u32) -> Weight { - (109_209_000 as Weight) - // Standard Error: 1_771_000 - .saturating_add((39_261_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(3 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 52_097 nanoseconds. + Weight::from_ref_time(64_876_042) + // Standard Error: 109_941 + .saturating_add(Weight::from_ref_time(20_111_105).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(2)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -291,30 +314,31 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueSigners (r:1 w:0) // Storage: Settlement ReceiptsUsed (r:1 w:1) // Storage: Settlement InstructionLegs (r:2 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Settlement InstructionAffirmsPending (r:1 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) + /// The range of component `r` is `[1, 10]`. fn affirm_with_receipts(r: u32) -> Weight { - (150_260_000 as Weight) - // Standard Error: 2_823_000 - .saturating_add((140_329_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(r as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((4 as Weight).saturating_mul(r as Weight))) + // Minimum execution time: 135_991 nanoseconds. + Weight::from_ref_time(66_099_220) + // Standard Error: 104_920 + .saturating_add(Weight::from_ref_time(79_400_333).saturating_mul(r.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((4_u64).saturating_mul(r.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((4_u64).saturating_mul(r.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement ReceiptsUsed (r:0 w:1) fn change_receipt_validity() -> Weight { - (74_044_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 28_082 nanoseconds. + Weight::from_ref_time(28_433_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Settlement InstructionAffirmsPending (r:1 w:1) // Storage: Settlement InstructionDetails (r:1 w:1) // Storage: Settlement InstructionLegs (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement VenueFiltering (r:1 w:0) // Storage: Settlement InstructionLegStatus (r:1 w:1) @@ -340,14 +364,16 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement UserAffirmations (r:0 w:2) // Storage: Settlement AffirmsReceived (r:0 w:2) // Storage: Asset BalanceOfAtScope (r:0 w:2) + /// The range of component `l` is `[0, 10]`. fn execute_scheduled_instruction(l: u32) -> Weight { - (278_381_000 as Weight) - // Standard Error: 5_950_000 - .saturating_add((788_066_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(39 as Weight)) - .saturating_add(DbWeight::get().reads((30 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(5 as Weight)) - .saturating_add(DbWeight::get().writes((16 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 49_561 nanoseconds. + Weight::from_ref_time(169_535_200) + // Standard Error: 1_232_382 + .saturating_add(Weight::from_ref_time(405_339_852).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(36)) + .saturating_add(DbWeight::get().reads((31_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((16_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:1) @@ -355,9 +381,10 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) fn reschedule_instruction() -> Weight { - (224_544_000 as Weight) - .saturating_add(DbWeight::get().reads(15 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 128_167 nanoseconds. + Weight::from_ref_time(128_858_000) + .saturating_add(DbWeight::get().reads(15)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) @@ -372,17 +399,18 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueFiltering (r:1 w:0) // Storage: Settlement InstructionLegs (r:0 w:1) // Storage: Settlement UserAffirmations (r:0 w:2) + /// The range of component `l` is `[1, 10]`. fn add_instruction_with_memo_and_settle_on_block_type(l: u32) -> Weight { - (100_830_000 as Weight) - // Standard Error: 1_142_000 - .saturating_add((17_338_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 59_731 nanoseconds. + Weight::from_ref_time(55_103_129) + // Standard Error: 43_109 + .saturating_add(Weight::from_ref_time(9_209_349).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Settlement VenueInfo (r:1 w:0) // Storage: Settlement VenueFiltering (r:1 w:0) // Storage: Settlement InstructionCounter (r:1 w:1) @@ -401,14 +429,16 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) + /// The range of component `l` is `[1, 10]`. fn add_and_affirm_instruction_with_memo_and_settle_on_block_type(l: u32) -> Weight { - (183_901_000 as Weight) - // Standard Error: 1_503_000 - .saturating_add((71_439_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((6 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 129_519 nanoseconds. + Weight::from_ref_time(99_489_498) + // Standard Error: 70_208 + .saturating_add(Weight::from_ref_time(35_692_783).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(7)) + .saturating_add(DbWeight::get().writes((6_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:1) @@ -416,7 +446,6 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionLegs (r:2 w:1) // Storage: Settlement InstructionAffirmsPending (r:1 w:1) // Storage: Settlement VenueFiltering (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Settlement InstructionLegStatus (r:1 w:1) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Asset Frozen (r:1 w:0) @@ -441,14 +470,16 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement AffirmsReceived (r:0 w:2) // Storage: Asset BalanceOfAtScope (r:0 w:2) + /// The range of component `l` is `[1, 10]`. fn execute_manual_instruction(l: u32) -> Weight { - (451_346_000 as Weight) - // Standard Error: 11_367_000 - .saturating_add((806_388_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(57 as Weight)) - .saturating_add(DbWeight::get().reads((28 as Weight).saturating_mul(l as Weight))) - .saturating_add(DbWeight::get().writes(6 as Weight)) - .saturating_add(DbWeight::get().writes((16 as Weight).saturating_mul(l as Weight))) + // Minimum execution time: 579_329 nanoseconds. + Weight::from_ref_time(131_712_065) + // Standard Error: 447_198 + .saturating_add(Weight::from_ref_time(436_517_218).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(56)) + .saturating_add(DbWeight::get().reads((28_u64).saturating_mul(l.into()))) + .saturating_add(DbWeight::get().writes(5)) + .saturating_add(DbWeight::get().writes((16_u64).saturating_mul(l.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) @@ -464,12 +495,12 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionDetails (r:0 w:1) // Storage: Settlement VenueInstructions (r:0 w:1) fn add_instruction_with_memo_v2(f: u32) -> Weight { - (119_496_000 as Weight) + Weight::from_ref_time(119_496_000 as u64) // Standard Error: 191_000 - .saturating_add((2_101_000 as Weight).saturating_mul(f as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(19 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(f as Weight))) + .saturating_add(Weight::from_ref_time(2_101_000 as u64).saturating_mul(f as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(19 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(f as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) @@ -494,17 +525,17 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:11) fn add_and_affirm_instruction_with_memo_v2(f: u32, n: u32) -> Weight { - (114_317_000 as Weight) + Weight::from_ref_time(114_317_000 as u64) // Standard Error: 356_000 - .saturating_add((18_329_000 as Weight).saturating_mul(f as Weight)) + .saturating_add(Weight::from_ref_time(18_329_000 as u64).saturating_mul(f as u64)) // Standard Error: 17_000 - .saturating_add((12_938_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(12 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + .saturating_add(Weight::from_ref_time(12_938_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(14 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(12 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(n as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -521,17 +552,17 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:11) fn affirm_instruction_v2(f: u32, n: u32) -> Weight { - (84_908_000 as Weight) + Weight::from_ref_time(84_908_000 as u64) // Standard Error: 360_000 - .saturating_add((17_455_000 as Weight).saturating_mul(f as Weight)) + .saturating_add(Weight::from_ref_time(17_455_000 as u64).saturating_mul(f as u64)) // Standard Error: 18_000 - .saturating_add((12_961_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(5 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + .saturating_add(Weight::from_ref_time(12_961_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(10 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(5 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(n as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -545,17 +576,17 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionAffirmsPending (r:1 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) fn withdraw_affirmation_v2(f: u32, n: u32) -> Weight { - (68_187_000 as Weight) + Weight::from_ref_time(68_187_000 as u64) // Standard Error: 290_000 - .saturating_add((17_795_000 as Weight).saturating_mul(f as Weight)) + .saturating_add(Weight::from_ref_time(17_795_000 as u64).saturating_mul(f as u64)) // Standard Error: 14_000 - .saturating_add((9_530_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(5 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + .saturating_add(Weight::from_ref_time(9_530_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(5 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(n as u64))) } // Storage: Settlement InstructionDetails (r:1 w:1) // Storage: Settlement InstructionLegsV2 (r:12 w:11) @@ -572,16 +603,16 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) fn reject_instruction_v2(f: u32, n: u32) -> Weight { - (92_422_000 as Weight) + Weight::from_ref_time(92_422_000 as u64) // Standard Error: 365_000 - .saturating_add((24_665_000 as Weight).saturating_mul(f as Weight)) + .saturating_add(Weight::from_ref_time(24_665_000 as u64).saturating_mul(f as u64)) // Standard Error: 18_000 - .saturating_add((10_175_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((2 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(10 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(f as Weight))) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + .saturating_add(Weight::from_ref_time(10_175_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(10 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(f as u64))) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(n as u64))) } } diff --git a/pallets/weights/src/pallet_staking.rs b/pallets/weights/src/pallet_staking.rs index 5f06fa8179..9ecf322119 100644 --- a/pallets/weights/src/pallet_staking.rs +++ b/pallets/weights/src/pallet_staking.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_staking //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_staking using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_staking::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_staking::WeightInfo for SubstrateWeight { // Storage: Staking Bonded (r:1 w:1) // Storage: Staking Ledger (r:1 w:1) // Storage: Staking CurrentEra (r:1 w:0) @@ -60,9 +61,10 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: Staking Payee (r:0 w:1) fn bond() -> Weight { - (96_134_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 63_979 nanoseconds. + Weight::from_ref_time(64_590_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Bonded (r:1 w:0) @@ -70,9 +72,10 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Identity CurrentDid (r:1 w:0) // Storage: Balances Locks (r:1 w:1) fn bond_extra() -> Weight { - (179_045_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 60_962 nanoseconds. + Weight::from_ref_time(61_874_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) @@ -82,21 +85,24 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Storage: Identity CurrentDid (r:1 w:0) fn unbond() -> Weight { - (86_189_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 58_888 nanoseconds. + Weight::from_ref_time(59_409_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) // Storage: Staking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) + /// The range of component `s` is `[0, 100]`. fn withdraw_unbonded_update(s: u32) -> Weight { - (100_962_000 as Weight) - // Standard Error: 71_000 - .saturating_add((47_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 52_698 nanoseconds. + Weight::from_ref_time(55_473_095) + // Standard Error: 10_384 + .saturating_add(Weight::from_ref_time(37_791).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) @@ -109,13 +115,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Payee (r:0 w:1) // Storage: Staking Nominators (r:0 w:1) // Storage: Staking SpanSlash (r:0 w:1) + /// The range of component `s` is `[0, 100]`. fn withdraw_unbonded_kill(s: u32) -> Weight { - (146_196_000 as Weight) - // Standard Error: 177_000 - .saturating_add((2_414_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + // Minimum execution time: 70_239 nanoseconds. + Weight::from_ref_time(75_825_109) + // Standard Error: 14_661 + .saturating_add(Weight::from_ref_time(1_506_254).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(8)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(s.into()))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:0) @@ -127,13 +135,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Identity AccountKeyRefCount (r:1 w:1) // Storage: Staking Nominators (r:0 w:1) fn validate() -> Weight { - (69_332_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 50_413 nanoseconds. + Weight::from_ref_time(50_854_000) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Staking MinimumBondThreshold (r:0 w:1) fn set_min_bond_threshold() -> Weight { - (19_903_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_182 nanoseconds. + Weight::from_ref_time(17_332_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Staking PermissionedIdentity (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) @@ -142,26 +152,30 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Identity Claims (r:2 w:0) // Storage: Staking ValidatorCount (r:1 w:0) fn add_permissioned_validator() -> Weight { - (86_141_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 49_461 nanoseconds. + Weight::from_ref_time(50_152_000) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking PermissionedIdentity (r:1 w:1) fn remove_permissioned_validator() -> Weight { - (39_823_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 29_975 nanoseconds. + Weight::from_ref_time(30_777_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking ValidatorCommissionCap (r:1 w:1) // Storage: Staking Validators (r:2 w:1) + /// The range of component `m` is `[0, 150]`. fn set_commission_cap(m: u32) -> Weight { - (76_025_000 as Weight) - // Standard Error: 87_000 - .saturating_add((15_329_000 as Weight).saturating_mul(m as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(m as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(m as Weight))) + // Minimum execution time: 33_963 nanoseconds. + Weight::from_ref_time(23_510_002) + // Standard Error: 18_380 + .saturating_add(Weight::from_ref_time(7_623_018).saturating_mul(m.into())) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(m.into()))) + .saturating_add(DbWeight::get().writes(2)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(m.into()))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:0) @@ -173,59 +187,74 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Identity Claims (r:2 w:0) // Storage: Staking Validators (r:2 w:1) // Storage: Staking CurrentEra (r:1 w:0) + /// The range of component `n` is `[1, 16]`. fn nominate(n: u32) -> Weight { - (112_277_000 as Weight) - // Standard Error: 628_000 - .saturating_add((10_806_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(11 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 76_912 nanoseconds. + Weight::from_ref_time(75_251_141) + // Standard Error: 23_061 + .saturating_add(Weight::from_ref_time(3_896_516).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(11)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:0) // Storage: Staking Validators (r:1 w:1) // Storage: Staking Nominators (r:0 w:1) fn chill() -> Weight { - (35_621_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 28_182 nanoseconds. + Weight::from_ref_time(28_923_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Staking Ledger (r:1 w:0) // Storage: Staking Payee (r:0 w:1) fn set_payee() -> Weight { - (38_059_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 21_490 nanoseconds. + Weight::from_ref_time(21_831_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking Bonded (r:1 w:1) // Storage: Staking Ledger (r:2 w:2) fn set_controller() -> Weight { - (49_866_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 31_969 nanoseconds. + Weight::from_ref_time(32_259_000) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Staking ValidatorCount (r:0 w:1) - fn set_validator_count(_c: u32) -> Weight { - (5_416_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + /// The range of component `c` is `[0, 1000]`. + fn set_validator_count(c: u32) -> Weight { + // Minimum execution time: 6_743 nanoseconds. + Weight::from_ref_time(7_404_924) + // Standard Error: 70 + .saturating_add(Weight::from_ref_time(4).saturating_mul(c.into())) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking ForceEra (r:0 w:1) fn force_no_eras() -> Weight { - (4_299_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 7_113 nanoseconds. + Weight::from_ref_time(7_374_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Staking ForceEra (r:0 w:1) fn force_new_era() -> Weight { - (8_515_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 6_792 nanoseconds. + Weight::from_ref_time(7_013_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Staking ForceEra (r:0 w:1) fn force_new_era_always() -> Weight { - (3_579_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 6_853 nanoseconds. + Weight::from_ref_time(7_033_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Staking Invulnerables (r:0 w:1) + /// The range of component `v` is `[0, 1000]`. fn set_invulnerables(v: u32) -> Weight { - (5_203_000 as Weight) - // Standard Error: 2_000 - .saturating_add((24_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 7_514 nanoseconds. + Weight::from_ref_time(7_638_784) + // Standard Error: 102 + .saturating_add(Weight::from_ref_time(8_329).saturating_mul(v.into())) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking Bonded (r:1 w:1) // Storage: Staking SlashingSpans (r:1 w:0) @@ -236,21 +265,25 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Payee (r:0 w:1) // Storage: Staking Nominators (r:0 w:1) // Storage: Staking SpanSlash (r:0 w:1) + /// The range of component `s` is `[0, 100]`. fn force_unstake(s: u32) -> Weight { - (111_066_000 as Weight) - // Standard Error: 127_000 - .saturating_add((1_901_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + // Minimum execution time: 50_323 nanoseconds. + Weight::from_ref_time(52_904_075) + // Standard Error: 4_324 + .saturating_add(Weight::from_ref_time(1_515_165).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(8)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(s.into()))) } // Storage: Staking UnappliedSlashes (r:1 w:1) + /// The range of component `s` is `[1, 1000]`. fn cancel_deferred_slash(s: u32) -> Weight { - (2_240_651_000 as Weight) - // Standard Error: 246_000 - .saturating_add((6_448_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 97_870 nanoseconds. + Weight::from_ref_time(884_214_773) + // Standard Error: 73_183 + .saturating_add(Weight::from_ref_time(4_668_406).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -266,14 +299,16 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: Identity KeyRecords (r:4 w:0) // Storage: Identity IsDidFrozen (r:1 w:0) + /// The range of component `n` is `[1, 2048]`. fn payout_stakers(n: u32) -> Weight { - (504_191_000 as Weight) - // Standard Error: 279_000 - .saturating_add((102_713_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(15 as Weight)) - .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + // Minimum execution time: 1_003_723 nanoseconds. + Weight::from_ref_time(1_483_152_965) + // Standard Error: 152_019 + .saturating_add(Weight::from_ref_time(48_944_980).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(15)) + .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(n.into()))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -288,23 +323,30 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System Account (r:3 w:3) // Storage: Balances Locks (r:2 w:2) // Storage: Identity KeyRecords (r:3 w:0) + /// The range of component `n` is `[1, 2048]`. fn payout_stakers_alive_controller(n: u32) -> Weight { - (604_608_000 as Weight) - // Standard Error: 369_000 - .saturating_add((113_211_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(15 as Weight)) - .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) + // Minimum execution time: 1_106_463 nanoseconds. + Weight::from_ref_time(1_328_865_997) + // Standard Error: 120_768 + .saturating_add(Weight::from_ref_time(57_264_608).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(15)) + .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(n.into()))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) - fn rebond(_u: u32) -> Weight { - (76_450_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + /// The range of component `u` is `[0, 1000]`. + /// The range of component `l` is `[1, 32]`. + fn rebond(u: u32) -> Weight { + // Minimum execution time: 47_949 nanoseconds. + Weight::from_ref_time(49_739_043) + // Standard Error: 5_104 + .saturating_add(Weight::from_ref_time(1_000).saturating_mul(u.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Staking CurrentEra (r:1 w:0) // Storage: Staking HistoryDepth (r:1 w:1) @@ -315,13 +357,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking ErasStakers (r:0 w:2) // Storage: Staking ErasTotalStake (r:0 w:1) // Storage: Staking ErasStartSessionIndex (r:0 w:1) + /// The range of component `e` is `[1, 100]`. fn set_history_depth(e: u32) -> Weight { - (107_179_000 as Weight) - // Standard Error: 826_000 - .saturating_add((40_214_000 as Weight).saturating_mul(e as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight))) + // Minimum execution time: 42_097 nanoseconds. + Weight::from_ref_time(42_479_000) + // Standard Error: 71_075 + .saturating_add(Weight::from_ref_time(23_670_060).saturating_mul(e.into())) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(4)) + .saturating_add(DbWeight::get().writes((7_u64).saturating_mul(e.into()))) } // Storage: System Account (r:1 w:1) // Storage: Staking Bonded (r:1 w:1) @@ -332,13 +376,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Payee (r:0 w:1) // Storage: Staking Nominators (r:0 w:1) // Storage: Staking SpanSlash (r:0 w:1) + /// The range of component `s` is `[1, 100]`. fn reap_stash(s: u32) -> Weight { - (103_480_000 as Weight) - // Standard Error: 128_000 - .saturating_add((2_241_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + // Minimum execution time: 60_181 nanoseconds. + Weight::from_ref_time(62_880_483) + // Standard Error: 2_922 + .saturating_add(Weight::from_ref_time(1_565_560).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(8)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(s.into()))) } // Storage: Staking CurrentEra (r:1 w:1) // Storage: Staking HistoryDepth (r:1 w:0) @@ -367,17 +413,20 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking QueuedScore (r:0 w:1) // Storage: Staking EraElectionStatus (r:0 w:1) // Storage: Staking SnapshotNominators (r:0 w:1) + /// The range of component `v` is `[1, 10]`. + /// The range of component `n` is `[1, 100]`. fn new_era(v: u32, n: u32) -> Weight { - (0 as Weight) - // Standard Error: 10_531_000 - .saturating_add((535_457_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 529_000 - .saturating_add((108_940_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(11 as Weight)) - .saturating_add(DbWeight::get().reads((8 as Weight).saturating_mul(v as Weight))) - .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) + // Minimum execution time: 612_651 nanoseconds. + Weight::from_ref_time(613_213_000) + // Standard Error: 3_914_944 + .saturating_add(Weight::from_ref_time(85_170_068).saturating_mul(v.into())) + // Standard Error: 402_138 + .saturating_add(Weight::from_ref_time(35_397_639).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(11)) + .saturating_add(DbWeight::get().reads((8_u64).saturating_mul(v.into()))) + .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(DbWeight::get().writes(8)) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(v.into()))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -392,29 +441,34 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System Account (r:102 w:102) // Storage: Balances Locks (r:101 w:101) // Storage: Identity KeyRecords (r:102 w:0) + /// The range of component `v` is `[1, 10]`. + /// The range of component `n` is `[1, 100]`. fn payout_all(v: u32, n: u32) -> Weight { - (0 as Weight) - // Standard Error: 249_996_000 - .saturating_add((4_259_711_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 12_561_000 - .saturating_add((464_874_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().reads((8 as Weight).saturating_mul(v as Weight))) - .saturating_add(DbWeight::get().reads((6 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) + // Minimum execution time: 1_027_959 nanoseconds. + Weight::from_ref_time(1_028_740_000) + // Standard Error: 46_424_607 + .saturating_add(Weight::from_ref_time(1_008_136_990).saturating_mul(v.into())) + // Standard Error: 4_768_680 + .saturating_add(Weight::from_ref_time(130_031_197).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(7)) + .saturating_add(DbWeight::get().reads((8_u64).saturating_mul(v.into()))) + .saturating_add(DbWeight::get().reads((6_u64).saturating_mul(n.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(v.into()))) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(n.into()))) } // Storage: Staking Bonded (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) // Storage: System Account (r:1 w:1) // Storage: Balances Locks (r:1 w:1) + /// The range of component `l` is `[1, 32]`. fn do_slash(l: u32) -> Weight { - (100_876_000 as Weight) - // Standard Error: 569_000 - .saturating_add((780_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 57_176 nanoseconds. + Weight::from_ref_time(59_802_895) + // Standard Error: 11_466 + .saturating_add(Weight::from_ref_time(32_868).saturating_mul(l.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -428,43 +482,48 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Bonded (r:500 w:0) // Storage: Staking Ledger (r:500 w:0) // Storage: Staking QueuedElected (r:0 w:1) - fn submit_solution_better(v: u32, n: u32, a: u32, w: u32) -> Weight { - (0 as Weight) - // Standard Error: 150_000 - .saturating_add((1_566_000 as Weight).saturating_mul(v as Weight)) - // Standard Error: 150_000 - .saturating_add((751_000 as Weight).saturating_mul(n as Weight)) - // Standard Error: 500_000 - .saturating_add((76_838_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 1_877_000 - .saturating_add((11_420_000 as Weight).saturating_mul(w as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) + /// The range of component `v` is `[1000, 2000]`. + /// The range of component `n` is `[1000, 2000]`. + /// The range of component `a` is `[200, 500]`. + /// The range of component `w` is `[16, 100]`. + fn submit_solution_better(v: u32, _n: u32, a: u32, w: u32) -> Weight { + // Minimum execution time: 14_586_378 nanoseconds. + Weight::from_ref_time(14_875_622_000) + // Standard Error: 93_923 + .saturating_add(Weight::from_ref_time(355_707).saturating_mul(v.into())) + // Standard Error: 336_506 + .saturating_add(Weight::from_ref_time(27_529_904).saturating_mul(a.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().reads((4_u64).saturating_mul(a.into()))) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(w.into()))) + .saturating_add(DbWeight::get().writes(2)) } // Storage: Staking SlashingAllowedFor (r:0 w:1) fn change_slashing_allowed_for() -> Weight { - (43_547_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 18_825 nanoseconds. + Weight::from_ref_time(19_806_000).saturating_add(DbWeight::get().writes(1)) } // Storage: Staking ValidatorCount (r:1 w:0) // Storage: Staking PermissionedIdentity (r:1 w:1) fn update_permissioned_validator_intended_count() -> Weight { - (28_091_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 24_676 nanoseconds. + Weight::from_ref_time(25_327_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking ValidatorCount (r:1 w:1) fn increase_validator_count() -> Weight { - (8_205_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_052 nanoseconds. + Weight::from_ref_time(17_312_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking ValidatorCount (r:1 w:1) fn scale_validator_count() -> Weight { - (8_981_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 16_821 nanoseconds. + Weight::from_ref_time(17_493_000) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking PermissionedIdentity (r:1 w:1) @@ -473,13 +532,15 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Validators (r:1 w:1) // Storage: Identity AccountKeyRefCount (r:1 w:1) // Storage: Staking Nominators (r:0 w:1) + /// The range of component `s` is `[1, 100]`. fn chill_from_governance(s: u32) -> Weight { - (58_999_000 as Weight) - // Standard Error: 230_000 - .saturating_add((35_387_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(s as Weight))) + // Minimum execution time: 54_241 nanoseconds. + Weight::from_ref_time(60_823_853) + // Standard Error: 45_698 + .saturating_add(Weight::from_ref_time(17_368_108).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(3)) + .saturating_add(DbWeight::get().reads((3_u64).saturating_mul(s.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((3_u64).saturating_mul(s.into()))) } } diff --git a/pallets/weights/src/pallet_statistics.rs b/pallets/weights/src/pallet_statistics.rs index ceefd1c574..30b80fb0d9 100644 --- a/pallets/weights/src/pallet_statistics.rs +++ b/pallets/weights/src/pallet_statistics.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_statistics //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,20 +51,22 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_statistics using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_statistics::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_statistics::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Statistics AssetTransferCompliances (r:1 w:0) // Storage: Statistics ActiveAssetStats (r:1 w:1) + /// The range of component `i` is `[1, 1009]`. fn set_active_asset_stats(i: u32) -> Weight { - (100_618_000 as Weight) - // Standard Error: 13_000 - .saturating_add((123_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 46_717 nanoseconds. + Weight::from_ref_time(50_069_053) + // Standard Error: 1_983 + .saturating_add(Weight::from_ref_time(80_581).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -71,12 +74,14 @@ impl pallet_statistics::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Statistics ActiveAssetStats (r:1 w:0) // Storage: Statistics AssetStats (r:0 w:1) + /// The range of component `i` is `[1, 250]`. fn batch_update_asset_stats(i: u32) -> Weight { - (218_711_000 as Weight) - // Standard Error: 174_000 - .saturating_add((3_746_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 95_245 nanoseconds. + Weight::from_ref_time(88_846_948) + // Standard Error: 32_727 + .saturating_add(Weight::from_ref_time(2_502_955).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -84,23 +89,27 @@ impl pallet_statistics::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Statistics ActiveAssetStats (r:1 w:0) // Storage: Statistics AssetTransferCompliances (r:1 w:1) + /// The range of component `i` is `[1, 1003]`. fn set_asset_transfer_compliance(i: u32) -> Weight { - (4_011_919_000 as Weight) - // Standard Error: 914_000 - .saturating_add((77_733_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 96_799 nanoseconds. + Weight::from_ref_time(1_946_554_086) + // Standard Error: 488_336 + .saturating_add(Weight::from_ref_time(39_999_365).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Statistics TransferConditionExemptEntities (r:0 w:10) + /// The range of component `i` is `[0, 1000]`. fn set_entities_exempt(i: u32) -> Weight { - (152_234_000 as Weight) - // Standard Error: 76_000 - .saturating_add((2_882_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 39_263 nanoseconds. + Weight::from_ref_time(17_572_677) + // Standard Error: 5_850 + .saturating_add(Weight::from_ref_time(2_410_744).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } } diff --git a/pallets/weights/src/pallet_sto.rs b/pallets/weights/src/pallet_sto.rs index 865c3155a9..8e8075e87a 100644 --- a/pallets/weights/src/pallet_sto.rs +++ b/pallets/weights/src/pallet_sto.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_sto //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_sto using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_sto::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_sto::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:0) @@ -65,17 +66,17 @@ impl pallet_sto::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Sto FundraiserNames (r:0 w:1) // Storage: Sto Fundraisers (r:0 w:1) - fn create_fundraiser(i: u32) -> Weight { - (105_964_000 as Weight) - .saturating_add((4_429_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(11 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + /// The range of component `i` is `[1, 10]`. + fn create_fundraiser(_i: u32) -> Weight { + // Minimum execution time: 80_058 nanoseconds. + Weight::from_ref_time(83_318_098) + .saturating_add(DbWeight::get().reads(11)) + .saturating_add(DbWeight::get().writes(4)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio PortfolioCustodian (r:2 w:0) // Storage: Sto Fundraisers (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Portfolio PortfolioLockedAssets (r:2 w:2) // Storage: Settlement VenueInfo (r:1 w:0) // Storage: Settlement VenueFiltering (r:2 w:0) @@ -105,9 +106,10 @@ impl pallet_sto::WeightInfo for WeightInfo { // Storage: Settlement InstructionLegStatus (r:0 w:2) // Storage: Asset BalanceOfAtScope (r:0 w:2) fn invest() -> Weight { - (1_801_070_000 as Weight) - .saturating_add(DbWeight::get().reads(107 as Weight)) - .saturating_add(DbWeight::get().writes(34 as Weight)) + // Minimum execution time: 1_083_641 nanoseconds. + Weight::from_ref_time(1_089_762_000) + .saturating_add(DbWeight::get().reads(106)) + .saturating_add(DbWeight::get().writes(33)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -115,9 +117,10 @@ impl pallet_sto::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Sto Fundraisers (r:1 w:1) fn freeze_fundraiser() -> Weight { - (59_129_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 52_377 nanoseconds. + Weight::from_ref_time(52_687_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -125,9 +128,10 @@ impl pallet_sto::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Sto Fundraisers (r:1 w:1) fn unfreeze_fundraiser() -> Weight { - (58_314_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 51_846 nanoseconds. + Weight::from_ref_time(53_569_000) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -136,17 +140,19 @@ impl pallet_sto::WeightInfo for WeightInfo { // Storage: Sto Fundraisers (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) fn modify_fundraiser_window() -> Weight { - (60_509_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 54_049 nanoseconds. + Weight::from_ref_time(54_330_000) + .saturating_add(DbWeight::get().reads(6)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Sto Fundraisers (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) fn stop() -> Weight { - (57_759_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 54_610 nanoseconds. + Weight::from_ref_time(57_927_000) + .saturating_add(DbWeight::get().reads(4)) + .saturating_add(DbWeight::get().writes(2)) } } diff --git a/pallets/weights/src/pallet_test_utils.rs b/pallets/weights/src/pallet_test_utils.rs index f415d5d9b9..7b551e84fb 100644 --- a/pallets/weights/src/pallet_test_utils.rs +++ b/pallets/weights/src/pallet_test_utils.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_test_utils //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_test_utils using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_test_utils::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_test_utils::WeightInfo for SubstrateWeight { // Storage: Identity MultiPurposeNonce (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:1) // Storage: System ParentHash (r:1 w:0) @@ -63,14 +64,16 @@ impl pallet_test_utils::WeightInfo for WeightInfo { // Storage: Identity DidKeys (r:0 w:1) // Storage: Identity AuthorizationsGiven (r:0 w:1) // Storage: Identity Authorizations (r:0 w:1) + /// The range of component `i` is `[0, 100]`. fn register_did(i: u32) -> Weight { - (1_320_706_000 as Weight) - // Standard Error: 838_000 - .saturating_add((17_474_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight))) - .saturating_add(DbWeight::get().writes(5 as Weight)) - .saturating_add(DbWeight::get().writes((2 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 605_307 nanoseconds. + Weight::from_ref_time(621_874_961) + // Standard Error: 13_436 + .saturating_add(Weight::from_ref_time(10_500_069).saturating_mul(i.into())) + .saturating_add(DbWeight::get().reads(8)) + .saturating_add(DbWeight::get().reads((1_u64).saturating_mul(i.into()))) + .saturating_add(DbWeight::get().writes(5)) + .saturating_add(DbWeight::get().writes((2_u64).saturating_mul(i.into()))) } // Storage: Identity KeyRecords (r:2 w:1) // Storage: Instance2Group ActiveMembers (r:1 w:0) @@ -83,13 +86,15 @@ impl pallet_test_utils::WeightInfo for WeightInfo { // Storage: Identity Claims (r:1 w:1) // Storage: Identity DidKeys (r:0 w:1) fn mock_cdd_register_did() -> Weight { - (1_037_389_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 613_513 nanoseconds. + Weight::from_ref_time(615_026_000) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(5)) } // Storage: Identity KeyRecords (r:1 w:0) fn get_my_did() -> Weight { - (26_158_000 as Weight).saturating_add(DbWeight::get().reads(1 as Weight)) + // Minimum execution time: 27_520 nanoseconds. + Weight::from_ref_time(28_131_000).saturating_add(DbWeight::get().reads(1)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) @@ -97,6 +102,7 @@ impl pallet_test_utils::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn get_cdd_of() -> Weight { - (63_088_000 as Weight).saturating_add(DbWeight::get().reads(6 as Weight)) + // Minimum execution time: 49_261 nanoseconds. + Weight::from_ref_time(50_162_000).saturating_add(DbWeight::get().reads(6)) } } diff --git a/pallets/weights/src/pallet_timestamp.rs b/pallets/weights/src/pallet_timestamp.rs index 7b4955ccc4..5e245099ba 100644 --- a/pallets/weights/src/pallet_timestamp.rs +++ b/pallets/weights/src/pallet_timestamp.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-10, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-25, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,16 +51,18 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_timestamp using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_timestamp::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_timestamp::WeightInfo for SubstrateWeight { // Storage: Timestamp Now (r:1 w:1) // Storage: Babe CurrentSlot (r:1 w:0) fn set() -> Weight { - (23_061_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 12_774 nanoseconds. + Weight::from_ref_time(13_205_000) + .saturating_add(DbWeight::get().reads(2)) + .saturating_add(DbWeight::get().writes(1)) } fn on_finalize() -> Weight { - (4_985_000 as Weight) + // Minimum execution time: 5_350 nanoseconds. + Weight::from_ref_time(5_490_000) } } diff --git a/pallets/weights/src/pallet_treasury.rs b/pallets/weights/src/pallet_treasury.rs index c48f171685..03ca87ff6d 100644 --- a/pallets/weights/src/pallet_treasury.rs +++ b/pallets/weights/src/pallet_treasury.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for pallet_treasury //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,8 +51,8 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for pallet_treasury using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_treasury::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_treasury::WeightInfo for SubstrateWeight { // Storage: Identity DidRecords (r:1 w:0) // Storage: System Account (r:2 w:2) // Storage: Identity KeyRecords (r:2 w:0) @@ -59,14 +60,16 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + /// The range of component `b` is `[1, 128]`. fn disbursement(b: u32) -> Weight { - (0 as Weight) - // Standard Error: 279_000 - .saturating_add((74_990_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(b as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(b as Weight))) + // Minimum execution time: 77_353 nanoseconds. + Weight::from_ref_time(58_807_555) + // Standard Error: 57_386 + .saturating_add(Weight::from_ref_time(37_389_745).saturating_mul(b.into())) + .saturating_add(DbWeight::get().reads(5)) + .saturating_add(DbWeight::get().reads((5_u64).saturating_mul(b.into()))) + .saturating_add(DbWeight::get().writes(1)) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(b.into()))) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) @@ -75,8 +78,9 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Storage: Identity Claims (r:2 w:0) // Storage: System Account (r:2 w:2) fn reimbursement() -> Weight { - (109_771_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 68_517 nanoseconds. + Weight::from_ref_time(69_749_000) + .saturating_add(DbWeight::get().reads(9)) + .saturating_add(DbWeight::get().writes(2)) } } diff --git a/pallets/weights/src/pallet_utility.rs b/pallets/weights/src/pallet_utility.rs index 88405b5cc6..25a4a4fa5c 100644 --- a/pallets/weights/src/pallet_utility.rs +++ b/pallets/weights/src/pallet_utility.rs @@ -51,28 +51,27 @@ use polymesh_runtime_common::GetDispatchInfo; use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; fn sum_weights(calls: &[impl GetDispatchInfo]) -> Weight { - let num_calls = calls.len() as Weight; + let num_calls = calls.len() as u64; calls .iter() .map(|call| call.get_dispatch_info().weight) - .fold(0 as Weight, |a: Weight, n| a.saturating_add(n)) + .fold(Weight::zero(), |a: Weight, n| a.saturating_add(n)) .saturating_add( // Each call has 2 reads and 2 writes overhead. - num_calls.saturating_mul( - DbWeight::get() - .reads(2 as Weight) - .saturating_add(DbWeight::get().writes(2 as Weight)), - ), + num_calls + * DbWeight::get() + .reads(2 as u64) + .saturating_add(DbWeight::get().writes(2 as u64)), ) } /// Weights for pallet_utility using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl pallet_utility::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl pallet_utility::WeightInfo for SubstrateWeight { // Storage: Permissions CurrentPalletName (r:1 w:1) // Storage: Permissions CurrentDispatchableName (r:1 w:1) fn batch(calls: &[impl GetDispatchInfo]) -> Weight { - (38_672_000 as Weight) + Weight::from_ref_time(38_672_000) // Standard Error: 438_000 .saturating_add(sum_weights(calls)) } @@ -80,16 +79,16 @@ impl pallet_utility::WeightInfo for WeightInfo { // Storage: Permissions CurrentPalletName (r:1 w:1) // Storage: Permissions CurrentDispatchableName (r:1 w:1) fn batch_atomic(calls: &[impl GetDispatchInfo]) -> Weight { - (49_113_000 as Weight) + Weight::from_ref_time(49_113_000) // Standard Error: 165_000 .saturating_add(sum_weights(calls)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(DbWeight::get().reads(1)) + .saturating_add(DbWeight::get().writes(1)) } // Storage: Permissions CurrentPalletName (r:1 w:1) // Storage: Permissions CurrentDispatchableName (r:1 w:1) fn batch_optimistic(calls: &[impl GetDispatchInfo]) -> Weight { - (27_520_000 as Weight) + Weight::from_ref_time(27_520_000) // Standard Error: 546_000 .saturating_add(sum_weights(calls)) } @@ -102,9 +101,9 @@ impl pallet_utility::WeightInfo for WeightInfo { // Storage: Permissions CurrentPalletName (r:1 w:1) // Storage: Permissions CurrentDispatchableName (r:1 w:1) fn relay_tx(call: &impl GetDispatchInfo) -> Weight { - (167_964_000 as Weight) + Weight::from_ref_time(167_964_000) .saturating_add(call.get_dispatch_info().weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + .saturating_add(DbWeight::get().reads(10)) + .saturating_add(DbWeight::get().writes(3)) } } diff --git a/pallets/weights/src/polymesh_contracts.rs b/pallets/weights/src/polymesh_contracts.rs index f7e462c9a2..c0e073e91a 100644 --- a/pallets/weights/src/polymesh_contracts.rs +++ b/pallets/weights/src/polymesh_contracts.rs @@ -18,8 +18,9 @@ //! Autogenerated weights for polymesh_contracts //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-02-20, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-26, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 512 +//! HOSTNAME: `dev-fsn001`, CPU: `AMD Ryzen 9 5950X 16-Core Processor` // Executed Command: // ./target/release/polymesh @@ -50,171 +51,189 @@ use polymesh_runtime_common::{RocksDbWeight as DbWeight, Weight}; /// Weights for polymesh_contracts using the Substrate node and recommended hardware. -pub struct WeightInfo; -impl polymesh_contracts::WeightInfo for WeightInfo { +pub struct SubstrateWeight; +impl polymesh_contracts::WeightInfo for SubstrateWeight { // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) // Storage: unknown [0x00] (r:1 w:0) + // Storage: System EventTopics (r:2 w:2) // Storage: unknown [0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f] (r:1 w:0) + /// The range of component `k` is `[1, 8192]`. + /// The range of component `v` is `[1, 8192]`. fn chain_extension_read_storage(k: u32, v: u32) -> Weight { - (575_457_000 as Weight) - // Standard Error: 3_000 - .saturating_add((5_000 as Weight).saturating_mul(k as Weight)) - // Standard Error: 3_000 - .saturating_add((6_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 347_332 nanoseconds. + Weight::from_ref_time(351_172_435) + // Standard Error: 345 + .saturating_add(Weight::from_ref_time(4_831).saturating_mul(k.into())) + // Standard Error: 345 + .saturating_add(Weight::from_ref_time(516).saturating_mul(v.into())) + .saturating_add(DbWeight::get().reads(14)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `r` is `[0, 20]`. fn chain_extension_get_version(r: u32) -> Weight { - (549_682_000 as Weight) - // Standard Error: 9_429_000 - .saturating_add((169_925_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 328_206 nanoseconds. + Weight::from_ref_time(337_724_520) + // Standard Error: 104_122 + .saturating_add(Weight::from_ref_time(41_328_968).saturating_mul(r.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:3 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `r` is `[1, 20]`. fn chain_extension_get_key_did(r: u32) -> Weight { - (54_268_000 as Weight) - // Standard Error: 31_131_000 - .saturating_add((495_788_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 507_377 nanoseconds. + Weight::from_ref_time(295_838_386) + // Standard Error: 293_521 + .saturating_add(Weight::from_ref_time(177_423_672).saturating_mul(r.into())) + .saturating_add(DbWeight::get().reads(14)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `r` is `[0, 20]`. fn chain_extension_hash_twox_64(r: u32) -> Weight { - (447_236_000 as Weight) - // Standard Error: 6_822_000 - .saturating_add((199_156_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 340_168 nanoseconds. + Weight::from_ref_time(359_665_012) + // Standard Error: 155_209 + .saturating_add(Weight::from_ref_time(55_417_519).saturating_mul(r.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `n` is `[0, 64]`. fn chain_extension_hash_twox_64_per_kb(n: u32) -> Weight { - (802_237_000 as Weight) - // Standard Error: 1_150_000 - .saturating_add((45_973_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 396_021 nanoseconds. + Weight::from_ref_time(411_427_942) + // Standard Error: 41_027 + .saturating_add(Weight::from_ref_time(27_975_923).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `r` is `[0, 20]`. fn chain_extension_hash_twox_128(r: u32) -> Weight { - (487_844_000 as Weight) - // Standard Error: 3_113_000 - .saturating_add((191_807_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 339_177 nanoseconds. + Weight::from_ref_time(342_453_106) + // Standard Error: 88_907 + .saturating_add(Weight::from_ref_time(57_426_349).saturating_mul(r.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `n` is `[0, 64]`. fn chain_extension_hash_twox_128_per_kb(n: u32) -> Weight { - (857_838_000 as Weight) - // Standard Error: 1_631_000 - .saturating_add((56_482_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 404_507 nanoseconds. + Weight::from_ref_time(432_268_343) + // Standard Error: 89_675 + .saturating_add(Weight::from_ref_time(33_381_322).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `r` is `[0, 20]`. fn chain_extension_hash_twox_256(r: u32) -> Weight { - (701_465_000 as Weight) - // Standard Error: 6_087_000 - .saturating_add((192_876_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 340_499 nanoseconds. + Weight::from_ref_time(357_889_957) + // Standard Error: 79_880 + .saturating_add(Weight::from_ref_time(60_023_880).saturating_mul(r.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `n` is `[0, 64]`. fn chain_extension_hash_twox_256_per_kb(n: u32) -> Weight { - (704_307_000 as Weight) - // Standard Error: 1_778_000 - .saturating_add((79_365_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 406_601 nanoseconds. + Weight::from_ref_time(410_262_449) + // Standard Error: 41_323 + .saturating_add(Weight::from_ref_time(45_367_218).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) @@ -224,33 +243,40 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Identity CurrentDid (r:1 w:1) // Storage: Permissions CurrentPalletName (r:1 w:1) // Storage: Permissions CurrentDispatchableName (r:1 w:1) + // Storage: System EventTopics (r:2 w:2) + /// The range of component `n` is `[1, 8188]`. fn chain_extension_call_runtime(n: u32) -> Weight { - (585_436_000 as Weight) - // Standard Error: 3_000 - .saturating_add((4_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(17 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 366_697 nanoseconds. + Weight::from_ref_time(373_448_528) + // Standard Error: 341 + .saturating_add(Weight::from_ref_time(2_048).saturating_mul(n.into())) + .saturating_add(DbWeight::get().reads(18)) + .saturating_add(DbWeight::get().writes(7)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) // Storage: Contracts ContractInfoOf (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Identity IsDidFrozen (r:1 w:0) // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:2 w:2) fn dummy_contract() -> Weight { - (282_229_000 as Weight) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 207_864 nanoseconds. + Weight::from_ref_time(208_786_000) + .saturating_add(DbWeight::get().reads(13)) + .saturating_add(DbWeight::get().writes(3)) } - fn basic_runtime_call(_n: u32) -> Weight { - (1_570_000 as Weight) + /// The range of component `n` is `[1, 8188]`. + fn basic_runtime_call(n: u32) -> Weight { + // Minimum execution time: 5_831 nanoseconds. + Weight::from_ref_time(6_621_456) + // Standard Error: 3 + .saturating_add(Weight::from_ref_time(11).saturating_mul(n.into())) } // Storage: Identity KeyRecords (r:2 w:1) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:1) // Storage: System Account (r:2 w:2) // Storage: Contracts Nonce (r:1 w:1) @@ -261,16 +287,18 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) // Storage: Contracts OwnerInfoOf (r:1 w:1) + // Storage: System EventTopics (r:2 w:2) // Storage: Identity DidKeys (r:0 w:1) + /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_hash_perms(s: u32) -> Weight { - (877_160_000 as Weight) - // Standard Error: 0 - .saturating_add((5_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(15 as Weight)) - .saturating_add(DbWeight::get().writes(9 as Weight)) + // Minimum execution time: 308_280 nanoseconds. + Weight::from_ref_time(315_207_860) + // Standard Error: 13 + .saturating_add(Weight::from_ref_time(2_628).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(16)) + .saturating_add(DbWeight::get().writes(10)) } // Storage: Identity KeyRecords (r:2 w:1) - // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) // Storage: Contracts CodeStorage (r:1 w:1) // Storage: System Account (r:2 w:2) // Storage: Contracts Nonce (r:1 w:1) @@ -280,23 +308,29 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group ActiveMembers (r:1 w:0) // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) + // Storage: System EventTopics (r:3 w:3) // Storage: Identity DidKeys (r:0 w:1) // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) + /// The range of component `c` is `[0, 64226]`. + /// The range of component `s` is `[0, 1048576]`. fn instantiate_with_code_perms(c: u32, s: u32) -> Weight { - (359_632_000 as Weight) - // Standard Error: 3_000 - .saturating_add((315_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 0 - .saturating_add((6_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(10 as Weight)) + // Minimum execution time: 3_277_423 nanoseconds. + Weight::from_ref_time(481_656_529) + // Standard Error: 218 + .saturating_add(Weight::from_ref_time(97_176).saturating_mul(c.into())) + // Standard Error: 13 + .saturating_add(Weight::from_ref_time(2_801).saturating_mul(s.into())) + .saturating_add(DbWeight::get().reads(16)) + .saturating_add(DbWeight::get().writes(12)) } // Storage: Contracts CallRuntimeWhitelist (r:0 w:20) + /// The range of component `u` is `[0, 2000]`. fn update_call_runtime_whitelist(u: u32) -> Weight { - (305_906_000 as Weight) - // Standard Error: 76_000 - .saturating_add((1_756_000 as Weight).saturating_mul(u as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(u as Weight))) + // Minimum execution time: 6_392 nanoseconds. + Weight::from_ref_time(6_402_000) + // Standard Error: 2_915 + .saturating_add(Weight::from_ref_time(1_258_445).saturating_mul(u.into())) + .saturating_add(DbWeight::get().writes((1_u64).saturating_mul(u.into()))) } } diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index 179f6a0fc2..1a7acf1863 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -20,8 +20,8 @@ polymesh-primitives-derive = { version = "0.1.0", path = "../primitives_derive", # Crypto blake2 = { version = "0.10.2", default-features = false } -confidential_identity_v1 = { version = "1.0.1", default-features = false } -confidential_identity_v2 = { version = "2.0.1", default-features = false } +confidential_identity_v1 = { version = "1.1.0", default-features = false } +confidential_identity_v2 = { version = "2.1.0", default-features = false } schnorrkel = { version = "0.10.1", default-features = false } # Substrate @@ -29,13 +29,13 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = frame-support = { version = "4.0.0-dev", default-features = false } frame-system = { version = "4.0.0-dev", default-features = false } scale-info = { version = "2.0", default-features = false, features = ["derive", "decode"] } -sp-application-crypto = { version = "6.0.0", default-features = false, optional = true } -sp-arithmetic = { version = "5.0.0", default-features = false } -sp-core = { version = "6.0.0", default-features = false } -sp-io = { version = "6.0.0", default-features = false } -sp-runtime = { version = "6.0.0", default-features = false } -sp-runtime-interface = { version = "6.0.0", default-features = false } -sp-std = { version = "4.0.0", default-features = false } +sp-application-crypto = { version = "7.0.0", default-features = false, optional = true } +sp-arithmetic = { version = "6.0.0", default-features = false } +sp-core = { version = "7.0.0", default-features = false } +sp-io = { version = "7.0.0", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-runtime-interface = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default-features = false } sp-version = { version = "5.0.0", default-features = false } libsecp256k1 = { version = "0.6", default-features = false, features = ["hmac", "static-context"] } diff --git a/primitives/src/migrate.rs b/primitives/src/migrate.rs index a033da1384..413d971f14 100644 --- a/primitives/src/migrate.rs +++ b/primitives/src/migrate.rs @@ -17,7 +17,7 @@ use codec::{Decode, Encode}; use frame_support::migration::{put_storage_value, storage_iter, storage_key_iter}; -use frame_support::storage::unhashed::kill_prefix; +use frame_support::storage::unhashed; use frame_support::{ReversibleStorageHasher, StorageHasher, Twox128}; use sp_std::vec::Vec; @@ -235,7 +235,8 @@ pub fn kill_item(module: &[u8], item: &[u8]) { let mut prefix = [0u8; 32]; prefix[0..16].copy_from_slice(&Twox128::hash(module)); prefix[16..32].copy_from_slice(&Twox128::hash(item)); - kill_prefix(&prefix, None); + #[allow(deprecated)] + unhashed::kill_prefix(&prefix, None); } /// Moves a single or double map storage item under a new module prefix and removes the map from diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 0a5fc89031..bf682e68c8 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -4,7 +4,22 @@ version = "0.1.0" authors = ["Polymath"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0" } +jsonrpsee = { version = "0.15.1", features = ["server", "macros"] } +sp-api = { version = "4.0.0-dev", default_features = false } +sp-blockchain = { version = "4.0.0-dev" } +sp-core = { version = "7.0.0", default_features = false } +sp-rpc = { version = "6.0.0" } +sp-runtime = { version = "7.0.0", default_features = false } +sp-std = {version = "5.0.0", default_features = false } +sp-weights = { version = "4.0.0", default_features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } + node-rpc-runtime-api = { path = "./runtime-api", default-features = false } pallet-compliance-manager = { path = "../pallets/compliance-manager", default-features = false } @@ -15,21 +30,7 @@ pallet-portfolio = { path = "../pallets/portfolio", default-features = false } pallet-identity = { path = "../pallets/identity", default-features = false } pallet-transaction-payment = { path = "../pallets/transaction-payment", default-features = false } -# Substrate -codec = { package = "parity-scale-codec", version = "3.0.0" } -sp-core = {version = "6.0.0", default_features = false } -sp-std = {version = "4.0.0", default_features = false } -sp-runtime = { version = "6.0.0", default-features = false } -sp-api = { version = "4.0.0-dev", default-features = false } -sp-blockchain = { version = "4.0.0-dev" } -sp-rpc = { version = "6.0.0" } -frame-support = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "4.0.0-dev", default-features = false } - # Others -jsonrpc-core = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-core-client = { version = "18.0.0", features = ["arbitrary_precision"] } -jsonrpc-derive = "18.0.0" serde = { version = "1.0.104", optional = true, features = ["derive"] } [features] @@ -49,4 +50,5 @@ std = [ "sp-core/std", "sp-runtime/std", "sp-std/std", + "sp-weights/std", ] diff --git a/rpc/runtime-api/Cargo.toml b/rpc/runtime-api/Cargo.toml index aef32a6c11..542f7b03c3 100644 --- a/rpc/runtime-api/Cargo.toml +++ b/rpc/runtime-api/Cargo.toml @@ -4,7 +4,18 @@ version = "0.1.0" authors = ["Polymath"] edition = "2021" +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + [dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } +sp-api = { version = "4.0.0-dev", default-features = false } +sp-runtime = { version = "7.0.0", default-features = false } +sp-std = { version = "5.0.0", default_features = false } +sp-weights = { version = "4.0.0", default_features = false } +frame-support = { version = "4.0.0-dev", default-features = false } +frame-system = { version = "4.0.0-dev", default-features = false } + # Our pallets polymesh-primitives = { path = "../../primitives", default-features = false } pallet-compliance-manager = { path = "../../pallets/compliance-manager", default-features = false } @@ -16,14 +27,6 @@ pallet-transaction-payment = { path = "../../pallets/transaction-payment", defau # Other serde = { version = "1.0.104", optional = true, features = ["derive"] } -# Substrate -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -sp-api = { version = "4.0.0-dev", default_features = false } -sp-std = { version = "4.0.0", default_features = false } -sp-runtime = { version = "6.0.0", default_features = false } -frame-support = { version = "4.0.0-dev", default-features = false } -frame-system = { version = "4.0.0-dev", default-features = false } - [dev-dependencies] serde_json = "1.0.41" @@ -43,4 +46,5 @@ std = [ "sp-api/std", "sp-runtime/std", "sp-std/std", + "sp-weights/std", ] diff --git a/rpc/runtime-api/src/transaction_payment.rs b/rpc/runtime-api/src/transaction_payment.rs index 3d9903d355..a14fe1a244 100644 --- a/rpc/runtime-api/src/transaction_payment.rs +++ b/rpc/runtime-api/src/transaction_payment.rs @@ -1,10 +1,27 @@ +use codec::Codec; + pub use pallet_transaction_payment::{FeeDetails, InclusionFee, RuntimeDispatchInfo}; use polymesh_primitives::Balance; sp_api::decl_runtime_apis! { + #[api_version(2)] pub trait TransactionPaymentApi { + #[changed_in(2)] + fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo; fn query_info(uxt: Block::Extrinsic, len: u32) -> RuntimeDispatchInfo; fn query_fee_details(uxt: Block::Extrinsic, len: u32) -> FeeDetails; } + + #[api_version(2)] + pub trait TransactionPaymentCallApi + where + Call: Codec, + { + /// Query information of a dispatch class, weight, and fee of a given encoded `Call`. + fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo; + + /// Query fee details of a given encoded `Call`. + fn query_call_fee_details(call: Call, len: u32) -> FeeDetails; + } } diff --git a/rpc/src/asset.rs b/rpc/src/asset.rs index e8a8d99131..6e42bedf91 100644 --- a/rpc/src/asset.rs +++ b/rpc/src/asset.rs @@ -14,23 +14,26 @@ // along with this program. If not, see . pub use node_rpc_runtime_api::asset::{AssetApi as AssetRuntimeApi, CanTransferResult}; -use polymesh_primitives::{IdentityId, PortfolioId, Ticker}; -use jsonrpc_core::{Error, Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use std::{convert::TryInto, sync::Arc}; +use crate::Error; use codec::Codec; +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorCode, ErrorObject}, +}; use polymesh_primitives::asset::GranularCanTransferResult; +use polymesh_primitives::{IdentityId, PortfolioId, Ticker}; use sp_api::{ApiExt, ApiRef, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_rpc::number; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; -use std::convert::TryInto; -use std::sync::Arc; -#[rpc] +#[rpc(client, server)] pub trait AssetApi { - #[rpc(name = "asset_canTransfer")] + #[method(name = "asset_canTransfer")] fn can_transfer( &self, sender: AccountId, @@ -41,9 +44,9 @@ pub trait AssetApi { ticker: Ticker, value: number::NumberOrHex, at: Option, - ) -> Result; + ) -> RpcResult; - #[rpc(name = "asset_canTransferGranular")] + #[method(name = "asset_canTransferGranular")] fn can_transfer_granular( &self, from_custodian: Option, @@ -53,7 +56,7 @@ pub trait AssetApi { ticker: Ticker, value: number::NumberOrHex, at: Option, - ) -> Result; + ) -> RpcResult; } /// An implementation of asset specific RPC methods. @@ -72,12 +75,10 @@ impl Asset { } } -impl AssetApi<::Hash, AccountId> for Asset +impl AssetApiServer<::Hash, AccountId> for Asset where Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: AssetRuntimeApi, AccountId: Codec, { @@ -91,12 +92,14 @@ where ticker: Ticker, value: number::NumberOrHex, at: Option<::Hash>, - ) -> Result { + ) -> RpcResult { // Make sure that value fits into 64 bits. - let value: u64 = value.try_into().map_err(|_| Error { - code: ErrorCode::InvalidParams, - message: format!("{:?} doesn't fit in 64 bit unsigned value", value), - data: None, + let value: u64 = value.try_into().map_err(|_| { + CallError::Custom(ErrorObject::owned( + ErrorCode::InvalidParams.code(), + format!("{:?} doesn't fit in 64 bit unsigned value", value), + None::<()>, + )) })?; rpc_forward_call!( self, @@ -124,21 +127,25 @@ where ticker: Ticker, value: number::NumberOrHex, at: Option<::Hash>, - ) -> Result { + ) -> RpcResult { // Make sure that value fits into 64 bits. - let value: u64 = value.try_into().map_err(|_| Error { - code: ErrorCode::InvalidParams, - message: format!("{:?} doesn't fit in 64 bit unsigned value", value), - data: None, + let value: u64 = value.try_into().map_err(|_| { + CallError::Custom(ErrorObject::owned( + ErrorCode::InvalidParams.code(), + format!("{:?} doesn't fit in 64 bit unsigned value", value), + None::<()>, + )) })?; let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); let api_version = api .api_version::>(&at) - .map_err(|e| RpcError { - code: ErrorCode::ServerError(crate::Error::RuntimeError as i64), - message: "Unable to check transfer".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to check transfer", + Some(e.to_string()), + )) })?; match api_version { @@ -166,17 +173,21 @@ where .map(|res| res.into()) } _ => { - return Err(Error { - code: ErrorCode::MethodNotFound, - message: format!("Cannot find `AssetApi` for block {:?}", at), - data: None, - }); + return Err(CallError::Custom(ErrorObject::owned( + ErrorCode::MethodNotFound.code(), + format!("Cannot find `AssetApi` for block {:?}", at), + None::<()>, + )) + .into()); } } - .map_err(|e| RpcError { - code: ErrorCode::ServerError(crate::Error::RuntimeError as i64), - message: "Unable to check transfer".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to check transfer", + Some(e.to_string()), + )) + .into() }) } } diff --git a/rpc/src/compliance_manager.rs b/rpc/src/compliance_manager.rs index 56b68ae0e2..5af34e53f2 100644 --- a/rpc/src/compliance_manager.rs +++ b/rpc/src/compliance_manager.rs @@ -15,15 +15,20 @@ pub use node_rpc_runtime_api::compliance_manager::ComplianceManagerApi as ComplianceManagerRuntimeApi; +use std::sync::Arc; + +use crate::Error; use codec::Codec; use frame_support::traits::Currency; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorObject}, +}; use polymesh_primitives::{compliance_manager::AssetComplianceResult, IdentityId, Ticker}; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; -use std::sync::Arc; pub trait Trait: frame_system::Config { type Currency: Currency; @@ -32,16 +37,16 @@ pub trait Trait: frame_system::Config { pub type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -#[rpc] +#[rpc(client, server)] pub trait ComplianceManagerApi { - #[rpc(name = "compliance_canTransfer")] + #[method(name = "compliance_canTransfer")] fn can_transfer( &self, ticker: Ticker, from_did: Option, to_did: Option, at: Option, - ) -> Result; + ) -> RpcResult; } /// An implementation of Compliance manager specific RPC methods. @@ -60,13 +65,11 @@ impl ComplianceManager { } } -impl ComplianceManagerApi<::Hash, AccountId> +impl ComplianceManagerApiServer<::Hash, AccountId> for ComplianceManager where Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: ComplianceManagerRuntimeApi, AccountId: Codec, { @@ -76,17 +79,20 @@ where from_did: Option, to_did: Option, at: Option<::Hash>, - ) -> Result { + ) -> RpcResult { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| // If the block hash is not supplied assume the best block. self.client.info().best_hash)); api.can_transfer(&at, ticker, from_did, to_did) - .map_err(|e| RpcError { - code: ErrorCode::ServerError(1), - message: "Unable to fetch transfer status from compliance manager.".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch transfer status from compliance manager.", + Some(e.to_string()), + )) + .into() }) } } diff --git a/rpc/src/identity.rs b/rpc/src/identity.rs index 0066274813..3d5c4a55f2 100644 --- a/rpc/src/identity.rs +++ b/rpc/src/identity.rs @@ -5,60 +5,65 @@ use polymesh_primitives::{Authorization, AuthorizationType, Signatory}; pub use node_rpc_runtime_api::identity::IdentityApi as IdentityRuntimeApi; +use std::{convert::TryInto, sync::Arc}; + +use super::Error; use codec::Codec; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorCode, ErrorObject}, +}; use sp_api::{ApiExt, ApiRef, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_runtime::{ generic::BlockId, traits::{Block as BlockT, Zero}, }; -use std::{convert::TryInto, sync::Arc}; const MAX_IDENTITIES_ALLOWED_TO_QUERY: u32 = 500; /// Identity RPC methods -#[rpc] +#[rpc(client, server)] pub trait IdentityApi { /// Below function use to tell whether the given did has valid cdd claim or not - #[rpc(name = "identity_isIdentityHasValidCdd")] + #[method(name = "identity_isIdentityHasValidCdd")] fn is_identity_has_valid_cdd( &self, did: IdentityId, buffer_time: Option, at: Option, - ) -> Result; + ) -> RpcResult; /// Below function is used to query the given ticker DID. - #[rpc(name = "identity_getAssetDid")] - fn get_asset_did(&self, ticker: Ticker, at: Option) -> Result; + #[method(name = "identity_getAssetDid")] + fn get_asset_did(&self, ticker: Ticker, at: Option) -> RpcResult; /// DidRecords for a `did` - #[rpc(name = "identity_getDidRecords")] + #[method(name = "identity_getDidRecords")] fn get_did_records( &self, did: IdentityId, at: Option, - ) -> Result>; + ) -> RpcResult>; /// Retrieve the list of authorizations for a given signatory. - #[rpc(name = "identity_getFilteredAuthorizations")] + #[method(name = "identity_getFilteredAuthorizations")] fn get_filtered_authorizations( &self, signatory: Signatory, allow_expired: bool, auth_type: Option, at: Option, - ) -> Result>>; + ) -> RpcResult>>; /// Provide the status of a given DID - #[rpc(name = "identity_getDidStatus")] + #[method(name = "identity_getDidStatus")] fn get_did_status( &self, dids: Vec, at: Option, - ) -> Result>; + ) -> RpcResult>; /// Provide the `KeyIdentityData` from a given `AccountId`, including: /// - the corresponding DID, @@ -66,12 +71,12 @@ pub trait IdentityApi { /// - any permissions related to the key. /// /// This is an aggregate call provided for UX convenience. - #[rpc(name = "identity_getKeyIdentityData")] + #[method(name = "identity_getKeyIdentityData")] fn get_key_identity_data( &self, acc: AccountId, at: Option, - ) -> Result>>; + ) -> RpcResult>>; } /// A struct that implements the [`IdentityApi`]. @@ -90,22 +95,12 @@ impl Identity { } } -/// Error type of this RPC api. -pub enum Error { - /// The transaction was not decodable. - DecodeError, - /// The call to runtime failed. - RuntimeError, -} - impl - IdentityApi<::Hash, IdentityId, Ticker, AccountId, Moment> + IdentityApiServer<::Hash, IdentityId, Ticker, AccountId, Moment> for Identity where Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: IdentityRuntimeApi, IdentityId: Codec, Ticker: Codec, @@ -117,16 +112,19 @@ where did: IdentityId, buffer_time: Option, at: Option<::Hash>, - ) -> Result { + ) -> RpcResult { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| // If the block hash is not supplied assume the best block. self.client.info().best_hash)); api.is_identity_has_valid_cdd(&at, did, buffer_time) - .map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Either cdd claim not exist or Identity.".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Either cdd claim not exist or Identity.", + Some(e.to_string()), + )) + .into() }) } @@ -134,15 +132,18 @@ where &self, ticker: Ticker, at: Option<::Hash>, - ) -> Result { + ) -> RpcResult { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| // If the block hash is not supplied assume the best block. self.client.info().best_hash)); - api.get_asset_did(&at, ticker).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch did of the given ticker".into(), - data: Some(format!("{:?}", e).into()), + api.get_asset_did(&at, ticker).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch did of the given ticker", + Some(e.to_string()), + )) + .into() }) } @@ -150,17 +151,19 @@ where &self, did: IdentityId, at: Option<::Hash>, - ) -> Result> { + ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); let api_version = api .api_version::>( &at, ) - .map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch DID records".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch DID records", + Some(e.to_string()), + )) })?; match api_version { @@ -176,17 +179,21 @@ where .map(|rec| rec.into()) } _ => { - return Err(RpcError { - code: ErrorCode::MethodNotFound, - message: format!("Cannot find `IdentityApi` for block {:?}", at), - data: None, - }) + return Err(CallError::Custom(ErrorObject::owned( + ErrorCode::MethodNotFound.code(), + format!("Cannot find `IdentityApi` for block {:?}", at), + None::<()>, + )) + .into()); } } - .map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch DID records".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch DID records", + Some(e.to_string()), + )) + .into() }) } @@ -196,15 +203,18 @@ where allow_expired: bool, auth_type: Option, at: Option<::Hash>, - ) -> Result>> { + ) -> RpcResult>> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); api.get_filtered_authorizations(&at, signatory, allow_expired, auth_type) - .map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch authorizations data".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch authorizations data", + Some(e.to_string()), + )) + .into() }) } @@ -212,31 +222,32 @@ where &self, dids: Vec, at: Option<::Hash>, - ) -> Result> { + ) -> RpcResult> { if dids.len() > MAX_IDENTITIES_ALLOWED_TO_QUERY .try_into() .unwrap_or_else(|_| Zero::zero()) { - return Err(RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch dids status".into(), - data: Some( - format!( - "Provided vector length is more than the maximum allowed length i.e {:?}", - MAX_IDENTITIES_ALLOWED_TO_QUERY - ) - .into(), - ), - }); + return Err(CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch dids status", + Some(format!( + "Provided vector length is more than the maximum allowed length i.e {:?}", + MAX_IDENTITIES_ALLOWED_TO_QUERY + )), + )) + .into()); } let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); - api.get_did_status(&at, dids).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError as i64), - message: "Unable to fetch dids status".into(), - data: Some(format!("{:?}", e).into()), + api.get_did_status(&at, dids).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to fetch dids status", + Some(e.to_string()), + )) + .into() }) } @@ -244,7 +255,7 @@ where &self, acc: AccountId, at: Option<::Hash>, - ) -> Result>> { + ) -> RpcResult>> { rpc_forward_call!( self, at, diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 59a6d299b2..a8d72d19f2 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -21,6 +21,15 @@ pub enum Error { RuntimeError, } +impl From for i32 { + fn from(e: Error) -> i32 { + match e { + Error::RuntimeError => 1, + Error::DecodeError => 2, + } + } +} + /// Helper macro to forward call to Api. /// It also maps any error into an `RpcError`. macro_rules! rpc_forward_call { @@ -28,10 +37,12 @@ macro_rules! rpc_forward_call { let api = $self.client.runtime_api(); let at = BlockId::hash($at.unwrap_or_else(|| $self.client.info().best_hash)); - let result = $f(api, &at).map_err(|e| RpcError { - code: ErrorCode::ServerError($crate::Error::RuntimeError as i64), - message: $err_msg.into(), - data: Some(format!("{:?}", e).into()), + let result = $f(api, &at).map_err(|e| { + CallError::Custom(ErrorObject::owned( + crate::Error::RuntimeError.into(), + $err_msg, + Some(e.to_string()), + )) })?; Ok(result) diff --git a/rpc/src/nft.rs b/rpc/src/nft.rs index 32461b2d99..65179242c4 100644 --- a/rpc/src/nft.rs +++ b/rpc/src/nft.rs @@ -15,9 +15,14 @@ use std::sync::Arc; +use crate::Error; +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorObject}, +}; + use frame_support::dispatch::DispatchResult; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_runtime::generic::BlockId; @@ -26,16 +31,16 @@ use sp_runtime::traits::Block as BlockT; pub use node_rpc_runtime_api::nft::NFTApi as NFTRuntimeApi; use polymesh_primitives::{NFTs, PortfolioId}; -#[rpc] +#[rpc(client, server)] pub trait NFTApi { - #[rpc(name = "nft_validateNFTTransfer")] + #[method(name = "nft_validateNFTTransfer")] fn validate_nft_transfer( &self, sender_portfolio: PortfolioId, receiver_portfolio: PortfolioId, nfts: NFTs, at: Option, - ) -> Result; + ) -> RpcResult; } /// An implementation of NFT specific RPC methods. @@ -54,12 +59,10 @@ impl NFT { } } -impl NFTApi<::Hash> for NFT +impl NFTApiServer<::Hash> for NFT where Block: BlockT, - T: Send + Sync + 'static, - T: ProvideRuntimeApi, - T: HeaderBackend, + T: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, T::Api: NFTRuntimeApi, { fn validate_nft_transfer( @@ -68,16 +71,19 @@ where receiver_portfolio: PortfolioId, nfts: NFTs, at: Option<::Hash>, - ) -> Result { + ) -> RpcResult { let api = self.client.runtime_api(); // If the block hash is not supplied assume the best block. let at = BlockId::hash(at.unwrap_or_else(|| self.client.info().best_hash)); api.validate_nft_transfer(&at, &sender_portfolio, &receiver_portfolio, &nfts) - .map_err(|e| RpcError { - code: ErrorCode::ServerError(crate::Error::RuntimeError as i64), - message: "Unable to call validate_nft_transfer runtime".into(), - data: Some(format!("{:?}", e).into()), + .map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to call validate_nft_transfer runtime", + Some(e.to_string()), + )) + .into() }) } } diff --git a/rpc/src/pips.rs b/rpc/src/pips.rs index 60dad8f4c6..c6a2c48fe1 100644 --- a/rpc/src/pips.rs +++ b/rpc/src/pips.rs @@ -13,9 +13,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use std::sync::Arc; + use codec::Codec; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use jsonrpsee::{ + core::RpcResult, + proc_macros::rpc, + types::error::{CallError, ErrorObject}, +}; pub use node_rpc_runtime_api::pips::{ self as runtime_api, capped::{Vote, VoteCount}, @@ -26,23 +31,22 @@ use sp_api::{ApiRef, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; use sp_std::{prelude::*, vec::Vec}; -use std::sync::Arc; /// Pips RPC methods. -#[rpc] +#[rpc(client, server)] pub trait PipsApi { /// Summary of votes of the proposal given by `id`. - #[rpc(name = "pips_getVotes")] - fn get_votes(&self, id: PipId, at: Option) -> Result; + #[method(name = "pips_getVotes")] + fn get_votes(&self, id: PipId, at: Option) -> RpcResult; /// Retrieves proposal indices started by `address`. - #[rpc(name = "pips_proposedBy")] - fn proposed_by(&self, address: AccountId, at: Option) -> Result>; + #[method(name = "pips_proposedBy")] + fn proposed_by(&self, address: AccountId, at: Option) -> RpcResult>; /// Retrieves proposal `address` indices voted on - #[rpc(name = "pips_votedOn")] - fn voted_on(&self, address: AccountId, at: Option) -> Result>; + #[method(name = "pips_votedOn")] + fn voted_on(&self, address: AccountId, at: Option) -> RpcResult>; } /// An implementation of pips specific RPC methods. @@ -61,16 +65,14 @@ impl Pips { } } -impl PipsApi<::Hash, AccountId> for Pips +impl PipsApiServer<::Hash, AccountId> for Pips where Block: BlockT, - C: Send + Sync + 'static, - C: ProvideRuntimeApi, - C: HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: PipsRuntimeApi, AccountId: Codec, { - fn get_votes(&self, id: PipId, at: Option<::Hash>) -> Result { + fn get_votes(&self, id: PipId, at: Option<::Hash>) -> RpcResult { rpc_forward_call!( self, at, @@ -84,7 +86,7 @@ where &self, address: AccountId, at: Option<::Hash>, - ) -> Result> { + ) -> RpcResult> { rpc_forward_call!( self, at, @@ -97,7 +99,7 @@ where &self, address: AccountId, at: Option<::Hash>, - ) -> Result> { + ) -> RpcResult> { rpc_forward_call!( self, at, diff --git a/rpc/src/transaction_payment.rs b/rpc/src/transaction_payment.rs index b7bb5b7cf0..aa959c56f4 100644 --- a/rpc/src/transaction_payment.rs +++ b/rpc/src/transaction_payment.rs @@ -16,42 +16,48 @@ //! RPC interface for the transaction payment module. -pub use self::gen_client::Client as TransactionPaymentClient; +use std::{convert::TryInto, sync::Arc}; + +use super::Error; use codec::Decode; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result}; -use jsonrpc_derive::rpc; +use jsonrpsee::{ + core::{Error as JsonRpseeError, RpcResult}, + proc_macros::rpc, + types::error::{CallError, ErrorCode, ErrorObject}, +}; pub use node_rpc_runtime_api::transaction_payment::{ FeeDetails, InclusionFee, RuntimeDispatchInfo, TransactionPaymentApi as TransactionPaymentRuntimeApi, }; use polymesh_primitives::Balance; -use sp_api::ProvideRuntimeApi; +use sp_api::{ApiExt, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_core::Bytes; use sp_rpc::number::NumberOrHex; use sp_runtime::{generic::BlockId, traits::Block as BlockT}; -use std::sync::Arc; -#[rpc] +#[rpc(client, server)] pub trait TransactionPaymentApi { - #[rpc(name = "payment_queryInfo")] - fn query_info(&self, encoded_xt: Bytes, at: Option) -> Result; - #[rpc(name = "payment_queryFeeDetails")] + #[method(name = "payment_queryInfo")] + fn query_info(&self, encoded_xt: Bytes, at: Option) -> RpcResult; + + #[method(name = "payment_queryFeeDetails")] fn query_fee_details( &self, encoded_xt: Bytes, at: Option, - ) -> Result>; + ) -> RpcResult>; } -/// A struct that implements the [`TransactionPaymentApi`]. +/// Provides RPC methods to query a dispatchable's class, weight and fee. pub struct TransactionPayment { + /// Shared reference to the client. client: Arc, _marker: std::marker::PhantomData

, } impl TransactionPayment { - /// Create new `TransactionPayment` with the given reference to the client. + /// Creates a new instance of the TransactionPayment Rpc helper. pub fn new(client: Arc) -> Self { Self { client, @@ -60,35 +66,21 @@ impl TransactionPayment { } } -/// Error type of this RPC api. -pub enum Error { - /// The transaction was not decodable. - DecodeError, - /// The call to runtime failed. - RuntimeError, -} - -impl From for i64 { - fn from(e: Error) -> i64 { - match e { - Error::RuntimeError => 1, - Error::DecodeError => 2, - } - } -} - -impl TransactionPaymentApi<::Hash, RuntimeDispatchInfo> - for TransactionPayment +impl + TransactionPaymentApiServer< + ::Hash, + RuntimeDispatchInfo, + > for TransactionPayment where Block: BlockT, - C: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend, + C: ProvideRuntimeApi + HeaderBackend + Send + Sync + 'static, C::Api: TransactionPaymentRuntimeApi, { fn query_info( &self, encoded_xt: Bytes, at: Option<::Hash>, - ) -> Result> { + ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| { // If the block hash is not supplied assume the best block. @@ -97,23 +89,55 @@ where let encoded_len = encoded_xt.len() as u32; - let uxt: Block::Extrinsic = Decode::decode(&mut &*encoded_xt).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::DecodeError.into()), - message: "Unable to query dispatch info.".into(), - data: Some(format!("{:?}", e).into()), + let uxt: Block::Extrinsic = Decode::decode(&mut &*encoded_xt).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::DecodeError.into(), + "Unable to query dispatch info.", + Some(format!("{:?}", e)), + )) })?; - api.query_info(&at, uxt, encoded_len).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError.into()), - message: "Unable to query dispatch info.".into(), - data: Some(e.to_string().into()), - }) + + fn map_err(error: impl ToString, desc: &'static str) -> CallError { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + desc, + Some(error.to_string()), + )) + } + + let api_version = api + .api_version::>(&at) + .map_err(|e| map_err(e, "Failed to get transaction payment runtime api version"))? + .ok_or_else(|| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Transaction payment runtime api wasn't found in the runtime", + None::, + )) + })?; + + if api_version < 2 { + #[allow(deprecated)] + api.query_info_before_version_2(&at, uxt, encoded_len) + .map_err(|e| map_err(e, "Unable to query dispatch info.").into()) + } else { + let res = api + .query_info(&at, uxt, encoded_len) + .map_err(|e| map_err(e, "Unable to query dispatch info."))?; + + Ok(RuntimeDispatchInfo { + weight: sp_weights::OldWeight(res.weight.ref_time()), + class: res.class, + partial_fee: res.partial_fee, + }) + } } fn query_fee_details( &self, encoded_xt: Bytes, at: Option<::Hash>, - ) -> Result> { + ) -> RpcResult> { let api = self.client.runtime_api(); let at = BlockId::hash(at.unwrap_or_else(|| { // If the block hash is not supplied assume the best block. @@ -121,24 +145,28 @@ where })); let encoded_len = encoded_xt.len() as u32; - let uxt: Block::Extrinsic = Decode::decode(&mut &*encoded_xt).map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::DecodeError.into()), - message: "Unable to query fee details.".into(), - data: Some(format!("{:?}", e).into()), + let uxt: Block::Extrinsic = Decode::decode(&mut &*encoded_xt).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::DecodeError.into(), + "Unable to query fee details.", + Some(format!("{:?}", e)), + )) + })?; + let fee_details = api.query_fee_details(&at, uxt, encoded_len).map_err(|e| { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + "Unable to query fee details.", + Some(e.to_string()), + )) })?; - let fee_details = api - .query_fee_details(&at, uxt, encoded_len) - .map_err(|e| RpcError { - code: ErrorCode::ServerError(Error::RuntimeError.into()), - message: "Unable to query fee details.".into(), - data: Some(e.to_string().into()), - })?; let try_into_rpc_balance = |value: Balance| { - value.try_into().map_err(|_| RpcError { - code: ErrorCode::InvalidParams, - message: format!("{} doesn't fit in NumberOrHex representation", value), - data: None, + value.try_into().map_err(|_| { + JsonRpseeError::Call(CallError::Custom(ErrorObject::owned( + ErrorCode::InvalidParams.code(), + format!("{} doesn't fit in NumberOrHex representation", value), + None::<()>, + ))) }) }; diff --git a/src/chain_spec.rs b/src/chain_spec.rs index 270ef71e90..ee4d5ab324 100644 --- a/src/chain_spec.rs +++ b/src/chain_spec.rs @@ -385,14 +385,14 @@ fn genesis_processed_data( complete_txs.push(BridgeTx { nonce: treasury_bridge_lock.nonce, - recipient: TREASURY_PALLET_ID.into_account(), + recipient: TREASURY_PALLET_ID.into_account_truncating(), amount: treasury_bridge_lock.amount, tx_hash: treasury_bridge_lock.tx_hash, }); complete_txs.push(BridgeTx { nonce: rewards_bridge_lock.nonce, - recipient: REWARDS_PALLET_ID.into_account(), + recipient: REWARDS_PALLET_ID.into_account_truncating(), amount: rewards_bridge_lock.amount, tx_hash: rewards_bridge_lock.tx_hash, }); @@ -459,14 +459,14 @@ fn dev_genesis_processed_data( complete_txs.push(BridgeTx { nonce: treasury_bridge_lock.nonce, - recipient: TREASURY_PALLET_ID.into_account(), + recipient: TREASURY_PALLET_ID.into_account_truncating(), amount: BOOTSTRAP_TREASURY, tx_hash: treasury_bridge_lock.tx_hash, }); complete_txs.push(BridgeTx { nonce: rewards_bridge_lock.nonce, - recipient: REWARDS_PALLET_ID.into_account(), + recipient: REWARDS_PALLET_ID.into_account_truncating(), amount: itn_rewards().into_iter().map(|(_, b)| b + ONE_POLY).sum(), tx_hash: rewards_bridge_lock.tx_hash, }); diff --git a/src/command.rs b/src/command.rs index 3de73c346f..098c07d4f8 100644 --- a/src/command.rs +++ b/src/command.rs @@ -203,6 +203,12 @@ pub fn run() -> Result<()> { )?; cmd.run(client) } + #[cfg(not(feature = "runtime-benchmarks"))] + (BenchmarkCmd::Storage(_), Network::Other) => Err( + "Storage benchmarking can be enabled with `--features runtime-benchmarks`." + .into(), + ), + #[cfg(feature = "runtime-benchmarks")] (BenchmarkCmd::Storage(cmd), Network::Other) => { let FullServiceComponents { client, backend, .. diff --git a/src/service.rs b/src/service.rs index c0d96feead..30276b76e1 100644 --- a/src/service.rs +++ b/src/service.rs @@ -15,18 +15,18 @@ pub use polymesh_runtime_mainnet; pub use polymesh_runtime_testnet; use prometheus_endpoint::Registry; pub use sc_client_api::backend::Backend; -use sc_client_api::{BlockBackend, ExecutorProvider}; +use sc_client_api::BlockBackend; pub use sc_consensus::LongestChain; use sc_consensus_slots::SlotProportion; use sc_executor::NativeElseWasmExecutor; pub use sc_executor::{NativeExecutionDispatch, RuntimeVersionOf}; -use sc_network::{Event, NetworkService}; -use sc_service::TaskManager; +use sc_network::NetworkService; +use sc_network_common::{protocol::event::Event, service::NetworkEventStream}; +use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager}; pub use sc_service::{ config::{PrometheusConfig, Role}, - error::Error as ServiceError, - ChainSpec, Configuration, Error, PruningMode, RuntimeGenesis, TFullBackend, TFullCallExecutor, - TFullClient, TransactionPoolOptions, + ChainSpec, Error, PruningMode, RuntimeGenesis, TFullBackend, TFullCallExecutor, TFullClient, + TransactionPoolOptions, }; use sc_telemetry::{Telemetry, TelemetryWorker}; pub use sp_api::{ConstructRuntimeApi, Core as CoreApi, ProvideRuntimeApi, StateBackend}; @@ -102,7 +102,6 @@ pub trait RuntimeApiCollection: + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi - + pallet_contracts_rpc_runtime_api::ContractsApi + pallet_staking_rpc_runtime_api::StakingApi + node_rpc_runtime_api::pips::PipsApi + node_rpc_runtime_api::identity::IdentityApi @@ -129,7 +128,6 @@ where + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + sp_authority_discovery::AuthorityDiscoveryApi - + pallet_contracts_rpc_runtime_api::ContractsApi + pallet_staking_rpc_runtime_api::StakingApi + node_rpc_runtime_api::pips::PipsApi + node_rpc_runtime_api::identity::IdentityApi @@ -152,32 +150,31 @@ fn set_prometheus_registry(config: &mut Configuration) -> Result<(), ServiceErro } type BabeLink = sc_consensus_babe::BabeLink; -type IoHandler = jsonrpc_core::IoHandler; type FullLinkHalf = grandpa::LinkHalf, FullSelectChain>; -pub type FullClient = sc_service::TFullClient>; +pub type FullClient = sc_service::TFullClient>; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; -type FullGrandpaBlockImport = - grandpa::GrandpaBlockImport, FullSelectChain>; -type FullBabeImportQueue = sc_consensus::DefaultImportQueue>; +type FullGrandpaBlockImport = + grandpa::GrandpaBlockImport, FullSelectChain>; +type FullBabeImportQueue = sc_consensus::DefaultImportQueue>; type FullStateBackend = sc_client_api::StateBackendFor; -type FullPool = sc_transaction_pool::FullPool>; -pub type FullServiceComponents = sc_service::PartialComponents< - FullClient, +type FullPool = sc_transaction_pool::FullPool>; +pub type FullServiceComponents = sc_service::PartialComponents< + FullClient, FullBackend, FullSelectChain, - FullBabeImportQueue, - FullPool, + FullBabeImportQueue, + FullPool, ( F, - (FullBabeBlockImport, FullLinkHalf, BabeLink), + (FullBabeBlockImport, FullLinkHalf, BabeLink), grandpa::SharedVoterState, Option, ), >; -type FullBabeBlockImport = - sc_consensus_babe::BabeBlockImport, FullGrandpaBlockImport>; +type FullBabeBlockImport = + sc_consensus_babe::BabeBlockImport, FullGrandpaBlockImport>; pub fn new_partial( config: &mut Configuration, @@ -185,7 +182,10 @@ pub fn new_partial( FullServiceComponents< R, D, - impl Fn(sc_rpc::DenyUnsafe, sc_rpc::SubscriptionTaskExecutor) -> Result, + impl Fn( + sc_rpc::DenyUnsafe, + sc_rpc::SubscriptionTaskExecutor, + ) -> Result, Error>, >, Error, > @@ -248,7 +248,7 @@ where let justification_import = grandpa_block_import.clone(); let (block_import, babe_link) = sc_consensus_babe::block_import( - sc_consensus_babe::Config::get(&*client)?, + sc_consensus_babe::configuration(&*client)?, grandpa_block_import, client.clone(), )?; @@ -272,11 +272,10 @@ where let uncles = sp_authorship::InherentDataProvider::<::Header>::check_inherents(); - Ok((timestamp, slot, uncles)) + Ok((slot, timestamp, uncles)) }, &task_manager.spawn_essential_handle(), config.prometheus_registry(), - sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()), telemetry.as_ref().map(|x| x.handle()), )?; @@ -288,9 +287,6 @@ where let justification_stream = grandpa_link.justification_stream(); let shared_authority_set = grandpa_link.shared_authority_set().clone(); let shared_voter_state = grandpa::SharedVoterState::empty(); - // let finality_proof_provider = - // GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone()); - // let rpc_setup = (shared_voter_state.clone(), finality_proof_provider.clone()); let rpc_setup = shared_voter_state.clone(); let finality_proof_provider = grandpa::FinalityProofProvider::new_for_service( @@ -307,6 +303,7 @@ where let keystore = keystore_container.sync_keystore(); let chain_spec = config.chain_spec.cloned_box(); + let rpc_backend = backend.clone(); let rpc_extensions_builder = move |deny_unsafe, subscription_executor| { let deps = node_rpc::FullDeps { client: client.clone(), @@ -328,7 +325,7 @@ where }, }; - node_rpc::create_full(deps).map_err(Into::into) + node_rpc::create_full(deps, rpc_backend.clone()).map_err(Into::into) }; (rpc_extensions_builder, rpc_setup) @@ -352,10 +349,16 @@ where R::RuntimeApi: RuntimeApiCollection, D: NativeExecutionDispatch + 'static, { + /// The task manager of the node. pub task_manager: TaskManager, + /// The client instance of the node. pub client: Arc>, + /// The networking service of the node. pub network: Arc::Hash>>, + /// The transaction pool of the node. pub transaction_pool: Arc>, + /// The rpc handlers of the node. + pub rpc_handlers: RpcHandlers, } /// Creates a full service from the configuration. @@ -377,7 +380,7 @@ where keystore_container, select_chain, transaction_pool, - other: (rpc_extensions_builder, import_setup, rpc_setup, mut telemetry), + other: (rpc_builder, import_setup, rpc_setup, mut telemetry), } = new_partial(&mut config)?; let shared_voter_state = rpc_setup; @@ -412,7 +415,7 @@ where ), ); - 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(), @@ -440,16 +443,17 @@ where let enable_grandpa = !config.disable_grandpa; let prometheus_registry = config.prometheus_registry().cloned(); - let _rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { + let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams { config, backend, client: client.clone(), keystore: keystore_container.sync_keystore(), network: network.clone(), - rpc_extensions_builder: Box::new(rpc_extensions_builder), + rpc_builder: Box::new(rpc_builder), transaction_pool: transaction_pool.clone(), task_manager: &mut task_manager, system_rpc_tx, + tx_handler_controller, telemetry: telemetry.as_mut(), })?; @@ -466,9 +470,6 @@ where telemetry.as_ref().map(|x| x.handle()), ); - let can_author_with = - sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()); - let client_clone = client.clone(); let slot_duration = babe_link.config().slot_duration(); let babe_config = sc_consensus_babe::BabeParams { @@ -490,10 +491,10 @@ where let timestamp = sp_timestamp::InherentDataProvider::from_system_time(); let slot = - sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_slot_duration( - *timestamp, - slot_duration, - ); + sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_slot_duration( + *timestamp, + slot_duration, + ); let storage_proof = sp_transaction_storage_proof::registration::new_data_provider( @@ -501,13 +502,12 @@ where &parent, )?; - Ok((timestamp, slot, uncles, storage_proof)) + Ok((slot, timestamp, uncles, storage_proof)) } }, force_authoring, backoff_authoring_blocks, babe_link, - can_author_with, block_proposal_slot_portion: SlotProportion::new(0.5), max_block_proposal_slot_portion: None, telemetry: telemetry.as_ref().map(|x| x.handle()), @@ -606,6 +606,7 @@ where client, network, transaction_pool, + rpc_handlers, }) }