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/frame-weight-template.hbs b/.maintain/frame-weight-template.hbs index b37875046f..e26bcea573 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}} as u64) {{#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}} as u64).saturating_mul({{cw.name}} as u64)) {{/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}} as u64)) {{/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}} as u64).saturating_mul({{cr.name}} as u64))) {{/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}} as u64)) {{/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}} as u64).saturating_mul({{cw.name}} as u64))) {{/each}} } {{/each}} diff --git a/Cargo.lock b/Cargo.lock index 6549ec7a5b..b7f294c512 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", @@ -303,41 +309,19 @@ dependencies = [ "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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", ] -[[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", @@ -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]] @@ -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]] @@ -841,7 +858,7 @@ checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" dependencies = [ "glob 0.3.0", "libc", - "libloading 0.7.3", + "libloading", ] [[package]] @@ -863,8 +880,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 +889,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 +939,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 +957,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" @@ -993,6 +1068,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 +1125,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 +1188,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 +1207,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", @@ -1328,15 +1418,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 +1437,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 +1490,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" @@ -1468,6 +1582,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 +1636,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 +1643,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 +1654,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 +1668,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" @@ -1648,6 +1763,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" @@ -1678,19 +1807,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 +1859,7 @@ checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ "errno-dragonfly", "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -1761,7 +1884,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e43f2f1833d64e33f15592464d6fdd70f349dda7b1a53088eb83cd94014008c5" dependencies = [ - "futures 0.3.24", + "futures", ] [[package]] @@ -1814,27 +1937,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", @@ -1859,6 +1994,15 @@ dependencies = [ "miniz_oxide", ] +[[package]] +name = "float-cmp" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1868,7 +2012,7 @@ 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", ] @@ -1879,13 +2023,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "frame-system", @@ -1897,6 +2047,7 @@ dependencies = [ "serde", "sp-api", "sp-application-crypto", + "sp-core", "sp-io", "sp-runtime", "sp-runtime-interface", @@ -1907,17 +2058,19 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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 +2078,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", @@ -1957,7 +2109,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -1968,7 +2120,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -1984,7 +2136,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "frame-system", @@ -2012,7 +2164,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "bitflags", "frame-metadata", @@ -2026,6 +2178,7 @@ dependencies = [ "scale-info", "serde", "smallvec", + "sp-api", "sp-arithmetic", "sp-core", "sp-core-hashing-proc-macro", @@ -2036,16 +2189,19 @@ dependencies = [ "sp-state-machine", "sp-std", "sp-tracing", + "sp-weights", "tt-call", ] [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "Inflector", + "cfg-expr", "frame-support-procedural-tools", + "itertools", "proc-macro2", "quote", "syn", @@ -2054,7 +2210,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate 1.2.1", @@ -2066,7 +2222,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro2", "quote", @@ -2076,7 +2232,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "log", @@ -2088,12 +2244,13 @@ dependencies = [ "sp-runtime", "sp-std", "sp-version", + "sp-weights", ] [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-05-2#9a08d1f2d81d4993dc88f0a1a57caa0771d80a4b" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -2108,24 +2265,12 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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 +2278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2143,24 +2288,8 @@ 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" +name = "funty" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" @@ -2174,12 +2303,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 +2385,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 +2413,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 +2453,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" @@ -2441,7 +2573,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 +2582,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.4", + "tokio-util", "tracing", ] @@ -2498,15 +2630,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 +2645,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 +2685,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" @@ -2598,7 +2724,7 @@ checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" dependencies = [ "libc", "match_cfg", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -2621,7 +2747,7 @@ 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", ] @@ -2632,7 +2758,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 +2796,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", @@ -2690,19 +2816,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 +2839,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 +2870,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", @@ -2789,9 +2902,9 @@ dependencies = [ [[package]] name = "impl-serde" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" dependencies = [ "serde", ] @@ -2857,17 +2970,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 +2998,7 @@ checksum = "723519edce41262b05d4143ceb95050e4c614f483e78e9fd9e39a8275a84ad98" dependencies = [ "socket2", "widestring", - "winapi 0.3.9", + "winapi", "winreg", ] @@ -2894,6 +3008,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" @@ -2934,135 +3060,110 @@ 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]] @@ -3083,16 +3184,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 +3195,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 +3205,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 +3216,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", @@ -3168,16 +3257,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 +3264,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 +3275,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,179 +3294,100 @@ 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", "log", - "lru", + "lru 0.8.1", "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 +3395,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 +3426,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 +3480,53 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.35.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf57a3c2e821331dda9fe612d4654d676ab6e33d18d9434a18cced72630df6ad" +checksum = "7228b9318d34689521349a86eb39a3c3a802c9efc99a0568062ffb80913e3f91" dependencies = [ - "futures 0.3.24", + "futures", "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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd0baab894c5b84da510b915d53264d566c3c35889f09931fe9edbd2a773bee" -dependencies = [ - "asynchronous-codec 0.6.0", - "bimap", - "futures 0.3.24", - "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 +3534,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 +3575,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 +3608,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 +3728,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 +3764,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 +3796,18 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.8" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "lru" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ "hashbrown", ] @@ -3981,12 +3907,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 +3935,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 +3946,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 +3989,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 +4002,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 +4038,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 +4059,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 +4096,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]] @@ -4269,17 +4146,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 +4190,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 +4206,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 +4236,7 @@ dependencies = [ "clap 3.2.22", "derive_more", "fs_extra", - "futures 0.3.24", + "futures", "hash-db", "hex", "kvdb", @@ -4378,7 +4244,7 @@ dependencies = [ "lazy_static", "log", "node-testing", - "parity-db 0.2.4", + "parity-db", "parity-util-mem", "polymesh-primitives", "polymesh-runtime-testnet", @@ -4440,9 +4306,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", @@ -4458,6 +4322,7 @@ dependencies = [ "sp-rpc", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] @@ -4478,6 +4343,7 @@ dependencies = [ "sp-api", "sp-runtime", "sp-std", + "sp-weights", ] [[package]] @@ -4488,7 +4354,7 @@ dependencies = [ "frame-support", "frame-system", "fs_extra", - "futures 0.3.24", + "futures", "log", "node-executor", "pallet-balances 0.1.0", @@ -4547,6 +4413,12 @@ 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" @@ -4558,6 +4430,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-complex" version = "0.4.2" @@ -4594,7 +4477,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ "autocfg", - "num-bigint", + "num-bigint 0.2.6", "num-integer", "num-traits", ] @@ -4606,6 +4489,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", + "num-bigint 0.4.3", "num-integer", "num-traits", ] @@ -4626,27 +4510,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 +4562,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" @@ -4735,7 +4602,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "frame-system", @@ -4751,7 +4618,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "frame-system", @@ -4766,7 +4633,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -4816,7 +4683,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -4927,12 +4794,13 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "bitflags", "frame-benchmarking", "frame-support", "frame-system", + "impl-trait-for-tuples", "log", "pallet-contracts-primitives", "pallet-contracts-proc-macro", @@ -4942,6 +4810,7 @@ dependencies = [ "scale-info", "serde", "smallvec", + "sp-api", "sp-core", "sp-io", "sp-runtime", @@ -4954,60 +4823,25 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "bitflags", "parity-scale-codec 3.2.1", - "scale-info", - "serde", - "sp-core", - "sp-rpc", "sp-runtime", "sp-std", + "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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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" @@ -5063,7 +4897,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -5110,15 +4944,18 @@ 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", "substrate-test-runtime-client", @@ -5132,9 +4969,7 @@ dependencies = [ "polymesh-common-utilities", "polymesh-primitives", "serde", - "serde_json", "sp-api", - "sp-runtime", "sp-std", ] @@ -5171,7 +5006,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -5191,7 +5026,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -5230,7 +5065,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "frame-system", @@ -5317,11 +5152,12 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", + "log", "parity-scale-codec 3.2.1", "scale-info", "sp-core", @@ -5353,27 +5189,29 @@ dependencies = [ 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", ] [[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", ] @@ -5381,7 +5219,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "frame-system", @@ -5431,7 +5269,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -5447,7 +5285,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-support", "frame-system", @@ -5533,7 +5371,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -5545,15 +5383,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", ] [[package]] @@ -5561,7 +5403,6 @@ name = "pallet-staking-rpc-runtime-api" version = "2.0.0" dependencies = [ "frame-support", - "serde_json", "sp-api", "sp-runtime", ] @@ -5663,7 +5504,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "frame-benchmarking", "frame-support", @@ -5724,8 +5565,9 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ + "frame-benchmarking", "frame-support", "frame-system", "impl-trait-for-tuples", @@ -5759,23 +5601,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "parity-db" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e337f62db341435f0da05b8f6b97e984ef4ea5800510cd07c2d624688c40b47" -dependencies = [ - "blake2-rfc", - "crc32fast", - "fs2", - "hex", - "libc", - "log", - "memmap2 0.2.3", - "parking_lot 0.11.2", - "rand 0.8.5", -] - [[package]] name = "parity-db" version = "0.3.17" @@ -5789,7 +5614,7 @@ dependencies = [ "libc", "log", "lz4", - "memmap2 0.5.7", + "memmap2", "parking_lot 0.12.1", "rand 0.8.5", "snap", @@ -5817,6 +5642,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", @@ -5852,25 +5678,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", @@ -5879,7 +5691,7 @@ dependencies = [ "parking_lot 0.12.1", "primitive-types", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5895,36 +5707,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" @@ -5962,9 +5747,9 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -5975,7 +5760,7 @@ checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "smallvec", "windows-sys 0.36.1", ] @@ -6010,12 +5795,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" @@ -6158,33 +5937,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]] @@ -6216,6 +5975,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" +dependencies = [ + "der", + "spki", + "zeroize", +] + [[package]] name = "pkg-config" version = "0.3.25" @@ -6261,7 +6031,7 @@ dependencies = [ "libc", "log", "wepoll-ffi", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -6280,15 +6050,15 @@ name = "polymesh" version = "5.2.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", @@ -6297,7 +6067,6 @@ dependencies = [ "pallet-balances 0.1.0", "pallet-bridge", "pallet-committee", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-group", @@ -6339,6 +6108,7 @@ dependencies = [ "sc-executor", "sc-finality-grandpa", "sc-network", + "sc-network-common", "sc-rpc", "sc-service", "sc-sync-state-rpc", @@ -6416,13 +6186,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", + "wasm-instrument", ] [[package]] @@ -6454,13 +6224,11 @@ dependencies = [ 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", @@ -6469,9 +6237,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", @@ -6482,6 +6250,7 @@ dependencies = [ "sp-keystore", "sp-runtime", "substrate-frame-rpc-system", + "substrate-state-trie-migration-rpc", ] [[package]] @@ -6583,7 +6352,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6667,7 +6435,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6752,7 +6519,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6846,7 +6612,6 @@ dependencies = [ "pallet-compliance-manager", "pallet-contracts", "pallet-contracts-primitives", - "pallet-contracts-rpc-runtime-api", "pallet-corporate-actions", "pallet-external-agents", "pallet-grandpa", @@ -6970,36 +6735,62 @@ dependencies = [ ] [[package]] -name = "ppv-lite86" -version = "0.2.16" +name = "ppv-lite86" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "predicates" +version = "2.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" +dependencies = [ + "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 = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "72f883590242d3c6fc5bf50299011695fa6590c2c70eac95ee1bdb9a733ad1a2" [[package]] -name = "precomputed-hash" -version = "0.1.1" +name = "predicates-tree" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +checksum = "54ff541861505aabf6ea722d2131ee980b8276e10a1297b94e896dd8b621850d" +dependencies = [ + "predicates-core", + "termtree", +] [[package]] -name = "prettytable-rs" -version = "0.8.0" +name = "prettyplease" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fd04b170004fa2daccf418a7f8253aaf033c27760b5f225889024cf66d7ac2e" +checksum = "e97e3215779627f01ee256d2fad52f3d95e8e1c11e9fc6fd08f7cd455d5d5c78" dependencies = [ - "atty", - "csv", - "encode_unicode", - "lazy_static", - "term", - "unicode-width", + "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", @@ -7060,9 +6851,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", ] @@ -7083,21 +6874,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", + "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", @@ -7106,39 +6897,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", @@ -7149,11 +6955,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", ] @@ -7166,17 +6972,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" @@ -7345,12 +7140,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" @@ -7360,17 +7149,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" @@ -7378,7 +7156,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", ] @@ -7403,13 +7181,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", ] @@ -7439,25 +7218,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]] @@ -7470,12 +7237,6 @@ 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" @@ -7499,14 +7260,14 @@ dependencies = [ "spin", "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", @@ -7514,12 +7275,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]] @@ -7529,7 +7291,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", @@ -7538,15 +7300,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]] @@ -7587,29 +7347,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]] @@ -7620,22 +7381,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" @@ -7644,12 +7414,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", ] @@ -7668,15 +7438,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" @@ -7689,7 +7450,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "log", "sp-core", @@ -7700,10 +7461,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "ip_network", "libp2p", @@ -7713,7 +7474,7 @@ dependencies = [ "prost-build", "rand 0.7.3", "sc-client-api", - "sc-network", + "sc-network-common", "sp-api", "sp-authority-discovery", "sp-blockchain", @@ -7727,9 +7488,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "futures", "futures-timer", "log", "parity-scale-codec 3.2.1", @@ -7750,7 +7511,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "sc-client-api", @@ -7766,13 +7527,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -7783,7 +7544,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -7794,13 +7555,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ + "array-bytes", "chrono", - "clap 3.2.22", + "clap 4.1.0", "fdlimit", - "futures 0.3.24", - "hex", + "futures", "libp2p", "log", "names", @@ -7812,6 +7573,7 @@ dependencies = [ "sc-client-db", "sc-keystore", "sc-network", + "sc-network-common", "sc-service", "sc-telemetry", "sc-tracing", @@ -7833,10 +7595,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "fnv", - "futures 0.3.24", + "futures", "hash-db", "log", "parity-scale-codec 3.2.1", @@ -7861,7 +7623,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "hash-db", "kvdb", @@ -7869,7 +7631,7 @@ dependencies = [ "kvdb-rocksdb", "linked-hash-map", "log", - "parity-db 0.3.17", + "parity-db", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", "sc-client-api", @@ -7886,10 +7648,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "libp2p", "log", @@ -7910,20 +7672,19 @@ 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", "fork-tree", - "futures 0.3.24", + "futures", "log", "merlin 2.0.1", - "num-bigint", + "num-bigint 0.2.6", "num-rational 0.2.4", "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", @@ -7953,12 +7714,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "futures", + "jsonrpsee", "sc-consensus-babe", "sc-consensus-epochs", "sc-rpc-api", @@ -7977,7 +7736,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "fork-tree", "parity-scale-codec 3.2.1", @@ -7990,10 +7749,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "log", "parity-scale-codec 3.2.1", @@ -8008,14 +7767,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "sc-client-api", "sp-authorship", @@ -8026,10 +7784,10 @@ 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "lazy_static", - "lru", + "lru 0.7.8", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", "sc-executor-common", @@ -8053,14 +7811,13 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "environmental", "parity-scale-codec 3.2.1", "sc-allocator", "sp-maybe-compressed-blob", "sp-sandbox", - "sp-serializer", "sp-wasm-interface", "thiserror", "wasm-instrument", @@ -8070,7 +7827,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "log", "parity-scale-codec 3.2.1", @@ -8085,13 +7842,15 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8103,16 +7862,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8123,6 +7882,7 @@ dependencies = [ "sc-consensus", "sc-keystore", "sc-network", + "sc-network-common", "sc-network-gossip", "sc-telemetry", "sc-utils", @@ -8143,14 +7903,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8167,15 +7924,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8184,10 +7941,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ + "array-bytes", "async-trait", - "hex", "parking_lot 0.12.1", "serde_json", "sp-application-crypto", @@ -8199,34 +7956,34 @@ 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", "linked_hash_set", "log", - "lru", + "lru 0.7.8", "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", @@ -8236,51 +7993,168 @@ 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "ahash", - "futures 0.3.24", + "futures", "futures-timer", "libp2p", "log", - "lru", - "sc-network", + "lru 0.7.8", + "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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +dependencies = [ + "array-bytes", + "fork-tree", + "futures", + "libp2p", + "log", + "lru 0.7.8", + "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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8293,9 +8167,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "futures", "libp2p", "log", "sc-utils", @@ -8306,7 +8180,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -8315,12 +8189,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8346,13 +8219,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8372,38 +8242,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8414,9 +8298,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", @@ -8443,6 +8333,7 @@ dependencies = [ "sp-transaction-storage-proof", "sp-trie", "sp-version", + "static_init", "substrate-prometheus-endpoint", "tempfile", "thiserror", @@ -8454,7 +8345,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "log", "parity-scale-codec 3.2.1", @@ -8468,11 +8359,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", + "jsonrpsee", "parity-scale-codec 3.2.1", "sc-chain-spec", "sc-client-api", @@ -8489,9 +8378,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "futures", "libc", "log", "rand 0.7.3", @@ -8508,14 +8397,14 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8526,7 +8415,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "ansi_term", "atty", @@ -8557,7 +8446,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -8568,16 +8457,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -8595,9 +8484,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "async-trait", + "futures", "log", "serde", "sp-blockchain", @@ -8608,9 +8498,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "futures", "futures-timer", "lazy_static", "log", @@ -8714,14 +8604,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" @@ -8741,24 +8627,25 @@ checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" dependencies = [ "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", ] @@ -8917,18 +8804,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" @@ -9082,6 +8957,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" @@ -9118,7 +8999,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -9128,19 +9009,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "hash-db", "log", @@ -9150,6 +9031,7 @@ dependencies = [ "sp-runtime", "sp-state-machine", "sp-std", + "sp-trie", "sp-version", "thiserror", ] @@ -9157,7 +9039,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "blake2", "proc-macro-crate 1.2.1", @@ -9169,7 +9051,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9182,7 +9064,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "integer-sqrt", "num-traits", @@ -9197,7 +9079,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9210,7 +9092,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", "parity-scale-codec 3.2.1", @@ -9222,7 +9104,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "sp-api", @@ -9234,11 +9116,11 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "futures", "log", - "lru", + "lru 0.7.8", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", "sp-api", @@ -9252,10 +9134,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "futures-timer", "log", "parity-scale-codec 3.2.1", @@ -9271,7 +9153,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", "parity-scale-codec 3.2.1", @@ -9289,7 +9171,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", "merlin 2.0.1", @@ -9312,7 +9194,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9326,9 +9208,10 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", + "scale-info", "schnorrkel 0.9.1", "sp-core", "sp-runtime", @@ -9338,18 +9221,18 @@ dependencies = [ [[package]] name = "sp-core" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", "lazy_static", "libsecp256k1 0.7.1", @@ -9384,7 +9267,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "blake2", "byteorder", @@ -9398,7 +9281,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro2", "quote", @@ -9409,7 +9292,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -9418,7 +9301,7 @@ 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 = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro2", "quote", @@ -9428,7 +9311,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "environmental", "parity-scale-codec 3.2.1", @@ -9439,7 +9322,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "finality-grandpa", "log", @@ -9457,7 +9340,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -9471,9 +9354,10 @@ dependencies = [ [[package]] name = "sp-io" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "bytes", + "futures", "hash-db", "libsecp256k1 0.7.1", "log", @@ -9496,7 +9380,7 @@ dependencies = [ [[package]] name = "sp-keyring" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "lazy_static", "sp-core", @@ -9507,10 +9391,10 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", - "futures 0.3.24", + "futures", "merlin 2.0.1", "parity-scale-codec 3.2.1", "parking_lot 0.12.1", @@ -9524,16 +9408,32 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "thiserror", "zstd", ] +[[package]] +name = "sp-mmr-primitives" +version = "4.0.0-dev" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +dependencies = [ + "log", + "parity-scale-codec 3.2.1", + "scale-info", + "serde", + "sp-api", + "sp-core", + "sp-debug-derive", + "sp-runtime", + "sp-std", +] + [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9547,7 +9447,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "sp-api", "sp-core", @@ -9557,7 +9457,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "backtrace", "lazy_static", @@ -9567,7 +9467,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "rustc-hash", "serde", @@ -9577,7 +9477,7 @@ dependencies = [ [[package]] name = "sp-runtime" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "either", "hash256-std-hasher", @@ -9594,13 +9494,15 @@ dependencies = [ "sp-core", "sp-io", "sp-std", + "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" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ + "bytes", "impl-trait-for-tuples", "parity-scale-codec 3.2.1", "primitive-types", @@ -9616,7 +9518,7 @@ dependencies = [ [[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" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "Inflector", "proc-macro-crate 1.2.1", @@ -9628,7 +9530,7 @@ 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "log", "parity-scale-codec 3.2.1", @@ -9639,19 +9541,10 @@ dependencies = [ "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", -] - [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9665,7 +9558,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "scale-info", @@ -9676,7 +9569,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "hash-db", "log", @@ -9698,12 +9591,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" [[package]] name = "sp-storage" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "impl-serde", "parity-scale-codec 3.2.1", @@ -9716,7 +9609,7 @@ dependencies = [ [[package]] name = "sp-tasks" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "log", "sp-core", @@ -9729,7 +9622,7 @@ dependencies = [ [[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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", "futures-timer", @@ -9745,7 +9638,7 @@ dependencies = [ [[package]] name = "sp-tracing" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "sp-std", @@ -9757,7 +9650,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "sp-api", "sp-runtime", @@ -9766,7 +9659,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "async-trait", "log", @@ -9782,15 +9675,22 @@ dependencies = [ [[package]] name = "sp-trie" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ + "ahash", "hash-db", + "hashbrown", + "lazy_static", + "lru 0.7.8", "memory-db", + "nohash-hasher", "parity-scale-codec 3.2.1", + "parking_lot 0.12.1", "scale-info", "sp-core", "sp-std", "thiserror", + "tracing", "trie-db", "trie-root 0.17.0", ] @@ -9798,11 +9698,11 @@ 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "impl-serde", "parity-scale-codec 3.2.1", - "parity-wasm 0.42.2", + "parity-wasm", "scale-info", "serde", "sp-core-hashing-proc-macro", @@ -9815,7 +9715,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "parity-scale-codec 3.2.1", "proc-macro2", @@ -9826,7 +9726,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" 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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "impl-trait-for-tuples", "log", @@ -9836,12 +9736,38 @@ dependencies = [ "wasmtime", ] +[[package]] +name = "sp-weights" +version = "4.0.0" +source = "git+https://github.com/PolymeshAssociation/substrate?branch=polymesh-monthly-2022-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +dependencies = [ + "impl-trait-for-tuples", + "parity-scale-codec 3.2.1", + "scale-info", + "serde", + "smallvec", + "sp-arithmetic", + "sp-core", + "sp-debug-derive", + "sp-std", +] + [[package]] name = "spin" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spki" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "ss58-registry" version = "1.29.1" @@ -9869,6 +9795,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" @@ -9916,20 +9870,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", @@ -9952,18 +9906,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" 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", @@ -9974,7 +9927,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "futures-util", "hyper", @@ -9984,14 +9937,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" +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", + "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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ + "array-bytes", "async-trait", - "futures 0.3.24", - "hex", + "futures", "parity-scale-codec 3.2.1", "sc-client-api", "sc-client-db", @@ -10013,8 +9987,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ + "beefy-merkle-tree", "beefy-primitives", "cfg-if 1.0.0", "frame-support", @@ -10056,9 +10031,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "futures", "parity-scale-codec 3.2.1", "sc-block-builder", "sc-client-api", @@ -10075,9 +10050,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ - "futures 0.3.24", + "futures", "substrate-test-utils-derive", "tokio", ] @@ -10085,7 +10060,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "proc-macro-crate 1.2.1", "proc-macro2", @@ -10096,17 +10071,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-11#2b6f28b100e730c9a399625c70bb6468abf0bf34" dependencies = [ "ansi_term", "build-helper", "cargo_metadata", + "filetime", "sp-maybe-compressed-blob", "strum", "tempfile", "toml", "walkdir", - "wasm-gc-api", + "wasm-opt", ] [[package]] @@ -10123,9 +10099,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", @@ -10186,9 +10162,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]] @@ -10202,17 +10178,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" @@ -10222,6 +10187,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" @@ -10289,9 +10260,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", @@ -10306,7 +10277,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", + "winapi", ] [[package]] @@ -10369,10 +10340,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae" 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", @@ -10395,13 +10366,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]] @@ -10415,28 +10386,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", @@ -10483,11 +10441,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", ] @@ -10497,7 +10455,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", ] @@ -10507,10 +10465,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", ] @@ -10549,9 +10505,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", @@ -10580,9 +10536,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", @@ -10594,30 +10550,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", ] @@ -10641,7 +10597,7 @@ checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ "cfg-if 0.1.10", "digest 0.10.5", - "rand 0.7.3", + "rand 0.8.5", "static_assertions", ] @@ -10719,12 +10675,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" @@ -10747,32 +10697,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", ] @@ -10783,17 +10715,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" @@ -10802,7 +10723,7 @@ checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" dependencies = [ "form_urlencoded", "idna 0.3.0", - "percent-encoding 2.2.0", + "percent-encoding", ] [[package]] @@ -10892,7 +10813,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" dependencies = [ "same-file", - "winapi 0.3.9", + "winapi", "winapi-util", ] @@ -11000,23 +10921,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]] @@ -11025,7 +10976,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", @@ -11036,56 +10987,63 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.9.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" +checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" dependencies = [ - "downcast-rs", - "errno", - "libc", - "libm", - "memory_units", - "num-rational 0.2.4", - "num-traits", - "parity-wasm 0.42.2", + "parity-wasm", "wasmi-validation", + "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.4.1" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +dependencies = [ + "parity-wasm", +] + +[[package]] +name = "wasmi_core" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" +checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" dependencies = [ - "parity-wasm 0.42.2", + "downcast-rs", + "libm", + "memory_units", + "num-rational 0.4.1", + "num-traits", ] [[package]] name = "wasmparser" -version = "0.83.0" +version = "0.89.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" +checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +dependencies = [ + "indexmap", +] [[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", @@ -11094,14 +11052,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", @@ -11109,19 +11076,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", @@ -11131,8 +11098,7 @@ dependencies = [ "cranelift-wasm", "gimli", "log", - "more-asserts", - "object 0.27.1", + "object", "target-lexicon", "thiserror", "wasmparser", @@ -11141,17 +11107,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", @@ -11161,9 +11126,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", @@ -11172,60 +11137,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", @@ -11264,16 +11228,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" @@ -11290,7 +11244,7 @@ version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" dependencies = [ - "webpki 0.22.0", + "webpki", ] [[package]] @@ -11319,12 +11273,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" @@ -11335,12 +11283,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" @@ -11353,7 +11295,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] @@ -11511,17 +11453,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]] @@ -11550,7 +11482,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", @@ -11581,18 +11513,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", @@ -11600,10 +11532,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 f2a2a4a118..693c291407 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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-11" } +frame-benchmarking-cli = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +frame-executive = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +frame-support = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +frame-election-provider-support = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +frame-system = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +frame-system-benchmarking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +frame-system-rpc-runtime-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-balances = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-contracts = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-contracts-primitives = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-im-online = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-indices = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-offences = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-preimage = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-randomness-collective-flip = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-scheduler = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-session = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-staking-reward-curve = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-timestamp = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +pallet-treasury = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-basic-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-block-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-chain-spec = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-cli = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-client-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-client-db = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-consensus = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-consensus-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-consensus-babe-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-consensus-epochs = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-consensus-slots = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-consensus-uncles = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-executor = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-finality-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-finality-grandpa-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-keystore = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-network = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-network-common = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-rpc-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-rpc-spec-v2 = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-service = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-telemetry = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-transaction-pool = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-transaction-pool-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sc-sync-state-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-api = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-application-crypto = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-arithmetic = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-authority-discovery = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-authorship = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-block-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-blockchain = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-consensus = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-consensus-babe = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-consensus-slots = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-core = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-externalities = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-finality-grandpa = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-inherents = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-io = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-keystore = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-keyring = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-npos-elections = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-offchain = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-runtime = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-weights = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-runtime-interface = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-session = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-staking = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-state-machine = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-std = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-storage = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-timestamp = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-tracing = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-transaction-pool = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-transaction-storage-proof = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-trie = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +sp-version = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +substrate-frame-rpc-system = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +substrate-state-trie-migration-rpc = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +substrate-prometheus-endpoint = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +substrate-test-runtime-client = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +substrate-test-utils = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +substrate-test-utils-derive = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } +substrate-wasm-builder = { git = "https://github.com/PolymeshAssociation/substrate", branch = "polymesh-monthly-2022-11" } bulletproofs = { version = "4.0.0", git = "https://github.com/PolymeshAssociation/bulletproofs", branch = "polymesh" } @@ -200,16 +201,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" } @@ -217,7 +218,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" @@ -228,13 +228,14 @@ sc-basic-authorship = "0.10.0-dev" sc-chain-spec = "4.0.0-dev" sc-cli = { version = "0.10.0-dev", features = ["wasmtime"] } 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-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-telemetry = "4.0.0-dev" @@ -269,7 +270,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..ad2144661a 100644 --- a/bin/bench/Cargo.toml +++ b/bin/bench/Cargo.toml @@ -22,8 +22,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" +kvdb = "0.12" +kvdb-rocksdb = "0.16.0" sp-trie = { version = "6.0.0" } sp-core = { version = "6.0.0" } sp-consensus = { 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/executor/Cargo.toml b/bin/executor/Cargo.toml index d94292340a..6f05008089 100644 --- a/bin/executor/Cargo.toml +++ b/bin/executor/Cargo.toml @@ -41,16 +41,13 @@ pallet-treasury = { version = "4.0.0-dev" } sp-application-crypto = { version = "6.0.0" } sp-runtime = { version = "6.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-11" } 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..249dd2a864 100644 --- a/bin/testing/Cargo.toml +++ b/bin/testing/Cargo.toml @@ -23,8 +23,8 @@ pallet-staking = { path = "../../pallets/staking" } pallet-balances = { path = "../../pallets/balances" } node-executor = { path = "../executor", features = ["wasmtime"] } -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", "wasmtime"] } +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" } @@ -39,7 +39,7 @@ sp-runtime = { version = "6.0.0" } sc-executor = { version = "0.10.0-dev", features = ["wasmtime"] } 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-11" } pallet-timestamp = { version = "4.0.0-dev" } pallet-treasury = { version = "4.0.0-dev" } wabt = "0.10.0" diff --git a/node-rpc/Cargo.toml b/node-rpc/Cargo.toml index 81c4d06b2c..9f1e3682c6 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.12.0" } +sp-runtime = { version = "6.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 544c84a6f2..f3e86a000f 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, @@ -123,22 +122,25 @@ 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}, - pips::{Pips, PipsApi}, - transaction_payment::{TransactionPayment, TransactionPaymentApi}, + asset::{Asset, AssetApiServer}, + identity::{Identity, IdentityApiServer}, + 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, @@ -162,57 +164,62 @@ 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, - ))); + )? + .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).into_rpc())?; Ok(io) } 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 5471f2ddc8..98ab2e4c0d 100644 --- a/pallets/asset/src/lib.rs +++ b/pallets/asset/src/lib.rs @@ -88,7 +88,7 @@ use core::result::Result as StdResult; use currency::*; use frame_support::{ decl_error, decl_module, decl_storage, - dispatch::{DispatchError, DispatchResult}, + dispatch::{DispatchError, DispatchResult, Weight}, ensure, fail, traits::Get, }; @@ -358,7 +358,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; @@ -375,13 +375,13 @@ decl_module! { fn on_runtime_upgrade() -> frame_support::weights::Weight { use frame_support::weights::constants::WEIGHT_PER_MICROS; // Keep track of upgrade cost. - let mut weight = 0u64; + let mut weight = Weight::zero(); storage_migrate_on!(StorageVersion, 1, { - let mut total_len = 0u64; + let mut total_len = Weight::zero(); // Get list of assets with invalid asset_types. let fix_list = Tokens::iter() .filter(|(_, token)| { - total_len += 1; + total_len += Weight::from_ref_time(1); // Check if the asset_type is invalid. Self::ensure_asset_type_valid(token.asset_type).is_err() }).map(|(ticker, _)| ticker).collect::>(); @@ -389,11 +389,11 @@ decl_module! { // Calculate weight based on the number of assets // and how many need to be fixed. // Based on storage read/write cost: read 50 micros, write 200 micros. - let fix_len = fix_list.len() as u64; + let fix_len = Weight::from_ref_time(fix_list.len() as u64); weight = weight - .saturating_add(total_len.saturating_mul(50 * WEIGHT_PER_MICROS)) - .saturating_add(fix_len.saturating_mul(50 * WEIGHT_PER_MICROS)) - .saturating_add(fix_len.saturating_mul(200 * WEIGHT_PER_MICROS)); + .saturating_add(total_len.saturating_mul(50u64 * WEIGHT_PER_MICROS.ref_time())) + .saturating_add(fix_len.saturating_mul(50u64 * WEIGHT_PER_MICROS.ref_time())) + .saturating_add(fix_len.saturating_mul(200u64 * WEIGHT_PER_MICROS.ref_time())); // Replace invalid asset_types with the default AssetType. for ticker in fix_list { @@ -987,7 +987,7 @@ decl_error! { } } -impl AssetFnTrait for Module { +impl AssetFnTrait for Module { fn ensure_granular(ticker: &Ticker, value: Balance) -> DispatchResult { Self::ensure_granular(ticker, value) } @@ -998,7 +998,7 @@ impl AssetFnTrait for Module { } fn create_asset( - origin: T::Origin, + origin: T::RuntimeOrigin, name: AssetName, ticker: Ticker, divisible: bool, @@ -1019,7 +1019,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) } @@ -1044,7 +1044,7 @@ 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) } } @@ -1129,7 +1129,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() @@ -1150,7 +1150,7 @@ impl Module { } fn ensure_agent_with_custody_and_perms( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, portfolio_kind: PortfolioKind, ) -> Result { @@ -1581,7 +1581,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)); @@ -1606,7 +1606,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)); @@ -1723,7 +1723,7 @@ impl Module { } fn base_create_asset( - origin: T::Origin, + origin: T::RuntimeOrigin, name: AssetName, ticker: Ticker, divisible: bool, @@ -1867,7 +1867,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)?; @@ -1886,7 +1886,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)?; @@ -1906,7 +1910,7 @@ impl Module { } fn base_redeem( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, value: Balance, portfolio_kind: PortfolioKind, @@ -1975,7 +1979,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 { @@ -1988,7 +1992,7 @@ impl Module { } fn base_add_documents( - origin: T::Origin, + origin: T::RuntimeOrigin, docs: Vec, ticker: Ticker, ) -> DispatchResult { @@ -2020,7 +2024,7 @@ impl Module { } fn base_remove_documents( - origin: T::Origin, + origin: T::RuntimeOrigin, ids: Vec, ticker: Ticker, ) -> DispatchResult { @@ -2033,7 +2037,7 @@ impl Module { } fn base_set_funding_round( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, name: FundingRoundName, ) -> DispatchResult { @@ -2055,7 +2059,7 @@ impl Module { } fn base_update_identifiers( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, identifiers: Vec, ) -> DispatchResult { @@ -2110,7 +2114,7 @@ impl Module { } fn base_set_asset_metadata( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, key: AssetMetadataKey, value: AssetMetadataValue, @@ -2157,7 +2161,7 @@ impl Module { } fn base_set_asset_metadata_details( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, key: AssetMetadataKey, detail: AssetMetadataValueDetail, @@ -2185,7 +2189,7 @@ impl Module { } fn base_register_and_set_local_asset_metadata( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec, @@ -2202,7 +2206,7 @@ impl Module { } fn base_register_asset_metadata_local_type( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, name: AssetMetadataName, spec: AssetMetadataSpec, @@ -2245,7 +2249,7 @@ impl Module { } fn base_register_asset_metadata_global_type( - origin: T::Origin, + origin: T::RuntimeOrigin, name: AssetMetadataName, spec: AssetMetadataSpec, ) -> DispatchResult { @@ -2276,7 +2280,7 @@ impl Module { } fn base_claim_classic_ticker( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, ethereum_signature: ethereum::EcdsaSignature, ) -> DispatchResult { @@ -2321,7 +2325,7 @@ impl Module { } fn base_reserve_classic_ticker( - origin: T::Origin, + origin: T::RuntimeOrigin, classic_ticker_import: ClassicTickerImport, contract_did: IdentityId, config: TickerRegistrationConfig, @@ -2351,7 +2355,7 @@ impl Module { } fn base_controller_transfer( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, value: Balance, from_portfolio: PortfolioId, @@ -2536,7 +2540,7 @@ impl Module { } fn base_register_custom_asset_type( - origin: T::Origin, + origin: T::RuntimeOrigin, ty: Vec, ) -> Result { let did = Identity::::ensure_perms(origin)?; @@ -2565,7 +2569,7 @@ impl Module { } fn base_update_asset_type( - origin: T::Origin, + origin: T::RuntimeOrigin, ticker: Ticker, asset_type: AssetType, ) -> DispatchResult { diff --git a/pallets/balances/Cargo.toml b/pallets/balances/Cargo.toml index db9c7aa858..dc0ac74999 100644 --- a/pallets/balances/Cargo.toml +++ b/pallets/balances/Cargo.toml @@ -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-11", 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..13ebb6abbb 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-11" } +sp-std = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-11" } +sp-io = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-11" } +sp-runtime = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-11" } +sp-version = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-11" } +sp-api = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-11" } +frame-system = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-11" } +frame-support = { git = "https://github.com/PolymeshAssociation/substrate", default-features = false, branch = "polymesh-monthly-2022-11" } [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/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/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 ef366c0ec7..86ca862400 100644 --- a/pallets/common/Cargo.toml +++ b/pallets/common/Cargo.toml @@ -33,7 +33,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-11" } [features] default = ["std", "equalize"] diff --git a/pallets/common/src/benchs/asset.rs b/pallets/common/src/benchs/asset.rs index 1330b31ffd..b911c52819 100644 --- a/pallets/common/src/benchs/asset.rs +++ b/pallets/common/src/benchs/asset.rs @@ -12,7 +12,7 @@ use sp_std::{convert::TryFrom, 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::try_from(name).expect("Invalid ticker name"), _ => Ticker::repeating(b'A'), diff --git a/pallets/common/src/traits/asset.rs b/pallets/common/src/traits/asset.rs index 589264a5be..48a36592b7 100644 --- a/pallets/common/src/traits/asset.rs +++ b/pallets/common/src/traits/asset.rs @@ -118,9 +118,9 @@ pub trait Config: + portfolio::Config { /// The overarching event type. - type Event: From> + type RuntimeEvent: From> + From - + Into<::Event>; + + Into<::RuntimeEvent>; type Currency: Currency; @@ -144,7 +144,7 @@ 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; 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 a32e4496ce..6d88ce013b 100644 --- a/pallets/common/src/traits/mod.rs +++ b/pallets/common/src/traits/mod.rs @@ -67,7 +67,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/portfolio.rs b/pallets/common/src/traits/portfolio.rs index 25eb4110fb..db0b510da6 100644 --- a/pallets/common/src/traits/portfolio.rs +++ b/pallets/common/src/traits/portfolio.rs @@ -76,9 +76,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; } 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/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..75c766508f 100644 --- a/pallets/contracts/Cargo.toml +++ b/pallets/contracts/Cargo.toml @@ -7,7 +7,7 @@ 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 } @@ -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 2d454a9200..9e24d4bc7e 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; @@ -391,7 +390,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)?; @@ -416,7 +415,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, @@ -432,7 +431,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, @@ -448,7 +447,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, @@ -486,7 +485,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/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 7f2c5f7919..ac0ba10fae 100644 --- a/pallets/corporate-actions/src/benchmarking.rs +++ b/pallets/corporate-actions/src/benchmarking.rs @@ -87,7 +87,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(); @@ -99,7 +99,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, @@ -277,7 +277,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/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/rpc/Cargo.toml b/pallets/group/rpc/Cargo.toml index b78793d057..4493aee6a4 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 = "6.0.0", default_features = false } +sp-rpc = { version = "6.0.0" } +sp-runtime = { version = "6.0.0", default_features = false } +sp-std = {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 } + # 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-11"} diff --git a/pallets/group/rpc/runtime-api/Cargo.toml b/pallets/group/rpc/runtime-api/Cargo.toml index 8fbbf90556..df81f9104d 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} @@ -16,10 +19,6 @@ serde = { version = "1.0.104", optional = true, features = ["derive"] } 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" [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/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 c42d46faeb..6fa17c9613 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, Weight, + DispatchResult, Pays, Weight, }, + traits::{ChangeMembers, Currency, EnsureOrigin, Get, InitializeMembers}, }; use frame_system::ensure_root; pub use polymesh_common_utilities::traits::identity::WeightInfo; @@ -244,7 +243,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; @@ -263,7 +262,7 @@ decl_module! { migration::migrate_v2::(); }); - 0 + Weight::zero() } /// Register `target_account` with a new Identity. @@ -791,7 +790,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, @@ -823,7 +822,7 @@ pub mod migration { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { } + pub struct Module for enum Call where origin: T::RuntimeOrigin { } } } @@ -856,7 +855,7 @@ pub mod migration { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { } + pub struct Module for enum Call where origin: T::RuntimeOrigin { } } } @@ -907,6 +906,7 @@ pub mod migration { log::info!(" >>> Removing KeyToIdentityIds..."); use frame_support::storage::child::KillStorageResult::*; + #[allow(deprecated)] let (num_removed, all_removed) = match v1::KeyToIdentityIds::::remove_all(None) { AllRemoved(removed) => (removed, true), SomeRemaining(removed) => (removed, 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 dc615f19f2..6e5fbd9940 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,6 +256,9 @@ 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()) } @@ -271,7 +273,7 @@ decl_module! { }); //TODO placeholder weight - 1_000 + Weight::from_ref_time(1_000) } /// Creates a multisig @@ -691,13 +693,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()) } @@ -711,7 +715,7 @@ impl Module { } fn ensure_ms_creator( - origin: T::Origin, + origin: T::RuntimeOrigin, multisig: &T::AccountId, ) -> Result { let (sender, did) = Identity::::ensure_did(origin)?; @@ -1160,7 +1164,7 @@ mod migration { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { } + pub struct Module for enum Call where origin: T::RuntimeOrigin { } } } @@ -1175,7 +1179,7 @@ mod migration { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { } + pub struct Module for enum Call where origin: T::RuntimeOrigin { } } } 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/src/lib.rs b/pallets/pips/src/lib.rs index a55ba1dc4f..99e1e71e9e 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}; @@ -413,19 +412,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; @@ -647,7 +646,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; @@ -659,7 +658,7 @@ decl_module! { migration::migrate_v2::(); }); - 0 + Weight::zero() } /// Change whether completed PIPs are pruned. @@ -1149,7 +1148,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, @@ -1171,7 +1170,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) => { @@ -1202,11 +1201,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)); } @@ -1250,6 +1251,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) { @@ -1336,7 +1338,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`. @@ -1629,7 +1631,7 @@ pub mod migration { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { } + pub struct Module for enum Call where origin: T::RuntimeOrigin { } } } diff --git a/pallets/portfolio/src/lib.rs b/pallets/portfolio/src/lib.rs index f67766f502..769f44c31e 100644 --- a/pallets/portfolio/src/lib.rs +++ b/pallets/portfolio/src/lib.rs @@ -66,7 +66,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; @@ -158,7 +158,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. @@ -206,7 +206,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); @@ -369,7 +371,7 @@ decl_module! { ); }); - 0 + Weight::zero() } } } @@ -599,7 +601,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)); diff --git a/pallets/protocol-fee/rpc/Cargo.toml b/pallets/protocol-fee/rpc/Cargo.toml index 8a63d6f63c..96b27b4a8a 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 = "6.0.0", default_features = false } +sp-rpc = { version = "6.0.0" } +sp-runtime = { version = "6.0.0", default_features = false } +sp-std = {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 = { 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..d7f9c70bfb 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 } @@ -14,10 +17,6 @@ serde = { version = "1.0.104", optional = true, features = ["derive"] } 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" [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/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/src/lib.rs b/pallets/rewards/src/lib.rs index b4929e72f2..6b89f98b87 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; @@ -112,9 +112,10 @@ decl_module! { sp_runtime::runtime_logger::RuntimeLogger::init(); log::info!(" >>> Removing reward pallet storage"); let reward_prefix = hashing::twox_128(b"Rewards"); + #[allow(deprecated)] let _ = frame_support::storage::unhashed::kill_prefix(&reward_prefix, None); log::info!(" >>> Reward pallet storage removed"); - 1_000 + Weight::from_ref_time(1_000) } /// Claim an ITN reward. 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 add605f696..482bffb848 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,46 +268,46 @@ 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; } 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; @@ -316,22 +317,22 @@ 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; } 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, @@ -342,56 +343,57 @@ 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>; } 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! { @@ -401,17 +403,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; } @@ -420,21 +421,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; @@ -449,28 +448,30 @@ 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 MaxLegsInInstruction = MaxLegsInInstruction; } 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 { @@ -479,16 +480,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() @@ -529,10 +533,10 @@ 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; } }; } @@ -571,11 +575,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, @@ -583,44 +587,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 { @@ -713,17 +686,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, } @@ -777,7 +750,7 @@ macro_rules! runtime_apis { } } - impl pallet_contracts_rpc_runtime_api::ContractsApi< + impl pallet_contracts::ContractsApi< Block, polymesh_primitives::AccountId, Balance, @@ -788,22 +761,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) } @@ -811,13 +786,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) } @@ -835,6 +811,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 aaa8fc654a..f849505f10 100644 --- a/pallets/runtime/develop/Cargo.toml +++ b/pallets/runtime/develop/Cargo.toml @@ -94,7 +94,6 @@ confidential_identity_core = { version = "1.0.1", default-features = false } 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 } @@ -126,9 +125,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", @@ -142,7 +142,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", @@ -203,7 +202,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 3375309c06..814807cd88 100644 --- a/pallets/runtime/develop/src/runtime.rs +++ b/pallets/runtime/develop/src/runtime.rs @@ -122,14 +122,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; @@ -182,19 +181,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; @@ -205,7 +204,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; @@ -213,17 +212,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; @@ -231,22 +230,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... @@ -257,7 +256,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; } }; } @@ -271,15 +270,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; @@ -288,12 +287,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`. @@ -307,6 +306,48 @@ 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] + ); +} + construct_runtime!( pub enum Runtime where Block = Block, @@ -323,7 +364,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}, @@ -406,12 +447,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![ @@ -431,43 +474,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); - - if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } + add_benchmarks!(params, batches); Ok(batches) } @@ -475,47 +482,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_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); 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 7378bf9195..767fa7e9c4 100644 --- a/pallets/runtime/mainnet/Cargo.toml +++ b/pallets/runtime/mainnet/Cargo.toml @@ -48,7 +48,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" @@ -129,7 +128,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 8389c5028f..7b1c2aaf4f 100644 --- a/pallets/runtime/mainnet/src/runtime.rs +++ b/pallets/runtime/mainnet/src/runtime.rs @@ -119,14 +119,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; @@ -183,8 +182,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; @@ -195,7 +194,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; @@ -203,17 +202,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; @@ -221,22 +220,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... @@ -247,7 +246,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; } }; } @@ -261,15 +260,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; @@ -277,7 +276,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!( @@ -296,7 +295,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 bcc82db40d..65fc164e28 100644 --- a/pallets/runtime/testnet/Cargo.toml +++ b/pallets/runtime/testnet/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 } # Crypto confidential_identity_core = { version = "1.0.1", 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/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 f23bb35bd8..1d460395c9 100644 --- a/pallets/runtime/testnet/src/runtime.rs +++ b/pallets/runtime/testnet/src/runtime.rs @@ -125,14 +125,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; @@ -185,19 +184,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; @@ -208,7 +207,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; @@ -216,17 +215,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; @@ -234,22 +233,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... @@ -260,7 +259,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; } }; } @@ -274,15 +273,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; @@ -290,12 +289,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; @@ -317,7 +316,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 ffe879174a..0b8e71e4ef 100644 --- a/pallets/runtime/tests/Cargo.toml +++ b/pallets/runtime/tests/Cargo.toml @@ -71,7 +71,6 @@ 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-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 } @@ -101,7 +100,7 @@ sp-std = { version = "4.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-11", 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 a573046fa0..9981807e04 100644 --- a/pallets/runtime/tests/src/asset_test.rs +++ b/pallets/runtime/tests/src/asset_test.rs @@ -65,7 +65,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 9c79eb8bc2..c53d0f648d 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 = 838956000; -const WEIGHT_EXPECTED_2: u64 = 1818942000; +const WEIGHT_EXPECTED_1: Weight = Weight::from_ref_time(1_036_197_402); +const WEIGHT_EXPECTED_2: Weight = Weight::from_ref_time(2_581_061_664); 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 1174c0641c..8a69e39da3 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; @@ -16,7 +18,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 0e8c5ca517..5c07eb3601 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, TryFrom}; @@ -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/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 94165c322a..6038c472af 100644 --- a/pallets/runtime/tests/src/portfolio.rs +++ b/pallets/runtime/tests/src/portfolio.rs @@ -19,7 +19,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; fn create_portfolio() -> (User, PortfolioNumber) { diff --git a/pallets/runtime/tests/src/relayer_test.rs b/pallets/runtime/tests/src/relayer_test.rs index fe4c4b3452..f862b7627f 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}, @@ -36,45 +36,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::try_from(name).unwrap(); - 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, } } @@ -563,7 +563,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 ffbd9e5a5a..62755eed2f 100644 --- a/pallets/runtime/tests/src/settlement_test.rs +++ b/pallets/runtime/tests/src/settlement_test.rs @@ -42,7 +42,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 801ab5c2f3..cd0131cbac 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 { @@ -601,7 +600,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; @@ -612,14 +611,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; @@ -635,7 +634,7 @@ impl frame_system::offchain::SendTransactionTypes for Test where Call: From, { - type OverarchingCall = Call; + type OverarchingCall = RuntimeCall; type Extrinsic = Extrinsic; } @@ -1569,7 +1568,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 @@ -1588,7 +1587,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) } @@ -1597,7 +1596,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 87d9bae8a1..7f3b69dc0b 100644 --- a/pallets/runtime/tests/src/sto_test.rs +++ b/pallets/runtime/tests/src/sto_test.rs @@ -19,7 +19,7 @@ use sp_runtime::DispatchError; use sp_std::convert::TryFrom; 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 e178e4134f..b061d56481 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; @@ -196,7 +196,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, @@ -327,8 +327,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 { @@ -358,7 +358,7 @@ impl User { } } -pub type EventTest = Event; +pub type EventTest = RuntimeEvent; type Hash = H256; type Hashing = BlakeTwo256; @@ -369,14 +369,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, @@ -421,7 +418,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; @@ -430,7 +426,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; @@ -451,9 +447,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(); @@ -490,7 +486,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; @@ -498,11 +494,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; @@ -510,11 +506,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; @@ -522,11 +518,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; @@ -534,41 +530,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; @@ -579,7 +575,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; @@ -631,15 +627,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!(); @@ -653,7 +649,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) } @@ -670,7 +672,7 @@ pub fn make_account_with_scope( cdd_provider: AccountId, ) -> Result< ( - ::Origin, + ::RuntimeOrigin, IdentityId, ScopeId, ), @@ -685,7 +687,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) } @@ -694,8 +702,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. @@ -703,14 +717,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 } @@ -726,8 +744,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)) @@ -765,7 +789,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) { @@ -800,12 +824,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()) } @@ -869,7 +895,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, @@ -907,7 +933,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( @@ -930,8 +956,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) { @@ -940,8 +966,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() @@ -1006,8 +1032,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 3dc7bf3bb4..fe3543a183 100644 --- a/pallets/runtime/tests/src/transfer_compliance_test.rs +++ b/pallets/runtime/tests/src/transfer_compliance_test.rs @@ -18,7 +18,7 @@ use sp_std::convert::TryFrom; 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/src/lib.rs b/pallets/settlement/src/lib.rs index 095d0c6ef3..943103d0c8 100644 --- a/pallets/settlement/src/lib.rs +++ b/pallets/settlement/src/lib.rs @@ -97,7 +97,7 @@ pub trait Config: + pallet_compliance_manager::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>; @@ -556,7 +556,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; @@ -1061,7 +1061,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 { @@ -1393,8 +1393,10 @@ impl Module { let legs = InstructionLegs::drain_prefix(id).collect::>(); 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 @@ -1585,7 +1587,7 @@ impl Module { } pub fn base_affirm_with_receipts( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, receipt_details: Vec>, portfolios: Vec, @@ -1701,7 +1703,7 @@ impl Module { } pub fn base_affirm_instruction( - origin: ::Origin, + origin: ::RuntimeOrigin, id: InstructionId, portfolios: impl Iterator, max_legs_count: u32, @@ -1716,7 +1718,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, @@ -1737,7 +1739,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, max_legs_count: u32, @@ -1752,7 +1754,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, diff --git a/pallets/staking/rpc/Cargo.toml b/pallets/staking/rpc/Cargo.toml index 79ef2ed949..05502603e8 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" } -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" +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 = "6.0.0", default_features = false } +sp-rpc = { version = "6.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} +sp-std = {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 } + +# General +serde = { version = "1.0.104", features = ["derive"] } +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..8daf422ef2 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} 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..3f697276dd 100644 --- a/pallets/statistics/Cargo.toml +++ b/pallets/statistics/Cargo.toml @@ -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-11", 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 31728c94cc..5b19e90fc1 100644 --- a/pallets/statistics/src/lib.rs +++ b/pallets/statistics/src/lib.rs @@ -35,7 +35,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; @@ -67,7 +67,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 @@ -78,7 +78,7 @@ decl_module! { migration::migrate_v1::(); }); - 0 + Weight::zero() } const MaxStatsPerAsset: u32 = T::MaxStatsPerAsset::get(); @@ -167,7 +167,7 @@ decl_module! { impl Module { fn ensure_asset_perms( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, ) -> Result { match asset { @@ -180,7 +180,7 @@ impl Module { } fn base_set_active_asset_stats( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, stat_types: BTreeSet, ) -> DispatchResult { @@ -219,6 +219,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, @@ -242,7 +243,7 @@ impl Module { } fn base_batch_update_asset_stats( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, stat_type: StatType, values: BTreeSet, @@ -277,7 +278,7 @@ impl Module { } fn base_set_asset_transfer_compliance( - origin: T::Origin, + origin: T::RuntimeOrigin, asset: AssetScope, transfer_conditions: BTreeSet, ) -> DispatchResult { @@ -319,7 +320,7 @@ impl Module { } fn base_set_entities_exempt( - origin: T::Origin, + origin: T::RuntimeOrigin, is_exempt: bool, exempt_key: TransferConditionExemptKey, entities: BTreeSet, @@ -854,7 +855,7 @@ mod migration { } decl_module! { - pub struct Module for enum Call where origin: T::Origin { } + pub struct Module for enum Call where origin: T::RuntimeOrigin { } } } diff --git a/pallets/sto/src/lib.rs b/pallets/sto/src/lib.rs index 8c3eb5828f..2982eb48ef 100644 --- a/pallets/sto/src/lib.rs +++ b/pallets/sto/src/lib.rs @@ -173,7 +173,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; } @@ -267,7 +267,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; @@ -596,7 +596,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/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/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/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/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/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/src/frame_system.rs b/pallets/weights/src/frame_system.rs index 021ba774a7..aff63cb0bc 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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,55 @@ 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 { - (0 as Weight) + // Minimum execution time: 4_799 nanoseconds. + Weight::from_ref_time(3_782_975 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 { - (0 as Weight) - // Standard Error: 0 - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + // Minimum execution time: 16_020 nanoseconds. + Weight::from_ref_time(16_641_000 as u64) + // Standard Error: 1 + .saturating_add(Weight::from_ref_time(1_189 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 { - (6_757_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 15_829 nanoseconds. + Weight::from_ref_time(16_020_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. fn set_storage(i: u32) -> Weight { - (0 as Weight) - // Standard Error: 22_000 - .saturating_add((1_224_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 7_974 nanoseconds. + Weight::from_ref_time(7_995_000 as u64) + // Standard Error: 1_116 + .saturating_add(Weight::from_ref_time(714_164 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `i` is `[0, 1000]`. fn kill_storage(i: u32) -> Weight { - (0 as Weight) - // Standard Error: 16_000 - .saturating_add((790_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + // Minimum execution time: 5_210 nanoseconds. + Weight::from_ref_time(5_320_000 as u64) + // Standard Error: 1_136 + .saturating_add(Weight::from_ref_time(582_206 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } // Storage: Skipped Metadata (r:0 w:0) + /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32) -> Weight { - (0 as Weight) - // Standard Error: 23_000 - .saturating_add((1_696_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_894 nanoseconds. + Weight::from_ref_time(8_045_000 as u64) + // Standard Error: 1_207 + .saturating_add(Weight::from_ref_time(1_127_154 as u64).saturating_mul(p as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(p as u64))) } } diff --git a/pallets/weights/src/pallet_asset.rs b/pallets/weights/src/pallet_asset.rs index d5615ea361..58a18b289f 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: 2022-09-09, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (100_490_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 54_641 nanoseconds. + Weight::from_ref_time(55_533_000 as u64) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (95_460_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 60_773 nanoseconds. + Weight::from_ref_time(61_334_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // 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 { - (136_741_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 74_889 nanoseconds. + Weight::from_ref_time(75_259_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // 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 { - (207_235_000 as Weight) - // Standard Error: 10_000 - .saturating_add((66_000 as Weight).saturating_mul(i as Weight)) - // Standard Error: 41_000 - .saturating_add((100_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: 101_888 nanoseconds. + Weight::from_ref_time(112_043_427 as u64) + // Manually set weight for `n` + .saturating_add(Weight::from_ref_time(100_000 as u64).saturating_mul(n as u64)) + // Standard Error: 1_471 + .saturating_add(Weight::from_ref_time(61_131 as u64).saturating_mul(i as u64)) + // Manually set weight for `f` + .saturating_add(Weight::from_ref_time(100_000 as u64).saturating_mul(f as u64)) + .saturating_add(DbWeight::get().reads(11 as u64)) + .saturating_add(DbWeight::get().writes(12 as u64)) } // 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 { - (72_089_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 46_055 nanoseconds. + Weight::from_ref_time(47_027_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (122_650_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 47_287 nanoseconds. + Weight::from_ref_time(47_467_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (73_085_000 as Weight) - // Standard Error: 19_000 - .saturating_add((17_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: 44_322 nanoseconds. + Weight::from_ref_time(45_444_006 as u64) + // Standard Error: 4_704 + .saturating_add(Weight::from_ref_time(24_293 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (163_636_000 as Weight) - .saturating_add(DbWeight::get().reads(18 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 96_609 nanoseconds. + Weight::from_ref_time(97_019_000 as u64) + .saturating_add(DbWeight::get().reads(17 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (153_000_000 as Weight) - .saturating_add(DbWeight::get().reads(16 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 91_429 nanoseconds. + Weight::from_ref_time(92_241_000 as u64) + .saturating_add(DbWeight::get().reads(15 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // 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 { - (66_421_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 44_703 nanoseconds. + Weight::from_ref_time(45_614_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (118_263_000 as Weight) - // Standard Error: 485_000 - .saturating_add((21_058_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: 58_468 nanoseconds. + Weight::from_ref_time(49_199_372 as u64) + // Standard Error: 17_722 + .saturating_add(Weight::from_ref_time(10_352_194 as u64).saturating_mul(d as u64)) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(d as u64))) } // 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 { - (58_929_000 as Weight) - // Standard Error: 295_000 - .saturating_add((9_941_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_818 nanoseconds. + Weight::from_ref_time(37_876_737 as u64) + // Standard Error: 11_578 + .saturating_add(Weight::from_ref_time(5_187_795 as u64).saturating_mul(d as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(d as u64))) } // 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 { - (67_184_000 as Weight) - // Standard Error: 16_000 - .saturating_add((3_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: 40_194 nanoseconds. + Weight::from_ref_time(41_865_116 as u64) + // Standard Error: 4_099 + .saturating_add(Weight::from_ref_time(8_874 as u64).saturating_mul(f as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (74_457_000 as Weight) - // Standard Error: 7_000 - .saturating_add((94_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: 41_326 nanoseconds. + Weight::from_ref_time(43_841_505 as u64) + // Standard Error: 1_150 + .saturating_add(Weight::from_ref_time(51_787 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (164_988_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 92_851 nanoseconds. + Weight::from_ref_time(93_442_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (59_811_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 42_428 nanoseconds. + Weight::from_ref_time(42_859_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -299,20 +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 { - (199_491_000 as Weight) - .saturating_add(DbWeight::get().reads(19 as Weight)) - .saturating_add(DbWeight::get().writes(9 as Weight)) + // Minimum execution time: 113_660 nanoseconds. + Weight::from_ref_time(114_702_000 as u64) + .saturating_add(DbWeight::get().reads(19 as u64)) + .saturating_add(DbWeight::get().writes(9 as u64)) } // 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) + /// The range of component `n` is `[1, 2048]`. fn register_custom_asset_type(n: u32) -> Weight { - (71_836_000 as Weight) - // Standard Error: 1_000 - .saturating_add((6_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: 35_916 nanoseconds. + Weight::from_ref_time(37_435_562 as u64) + // Standard Error: 83 + .saturating_add(Weight::from_ref_time(4_797 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -322,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 { - (89_506_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 57_446 nanoseconds. + Weight::from_ref_time(60_181_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -333,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 { - (70_423_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 47_858 nanoseconds. + Weight::from_ref_time(48_770_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -348,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 { - (163_104_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 88_784 nanoseconds. + Weight::from_ref_time(90_026_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -361,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 { - (116_836_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 68_657 nanoseconds. + Weight::from_ref_time(69_328_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (70_226_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 44_071 nanoseconds. + Weight::from_ref_time(45_363_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -381,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) @@ -394,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 { - (170_323_000 as Weight) - .saturating_add(DbWeight::get().reads(18 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 100_696 nanoseconds. + Weight::from_ref_time(100_866_000 as u64) + .saturating_add(DbWeight::get().reads(17 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // Storage: Asset Tokens (r:1 w:1) // Storage: Identity KeyRecords (r:1 w:0) @@ -404,8 +437,9 @@ 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 { - (51_841_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 47_288 nanoseconds. + Weight::from_ref_time(47_578_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 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 61e6ae35b2..41e1af406f 100644 --- a/pallets/weights/src/pallet_balances.rs +++ b/pallets/weights/src/pallet_balances.rs @@ -50,8 +50,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 +59,9 @@ impl pallet_balances::WeightInfo for WeightInfo { // Storage: Identity Claims (r:2 w:0) // Storage: System Account (r:2 w:2) fn transfer() -> Weight { - (209_604_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(209_604_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) @@ -70,38 +70,38 @@ 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 { - (145_217_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(145_217_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:2 w:2) fn deposit_block_reward_reserve_balance() -> Weight { - (154_228_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(154_228_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (126_335_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(126_335_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: System Account (r:2 w:2) // Storage: Identity KeyRecords (r:2 w:0) fn force_transfer() -> Weight { - (70_921_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(70_921_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (60_874_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(60_874_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_capital_distribution.rs b/pallets/weights/src/pallet_capital_distribution.rs index 6cdae37b17..93633f0cbd 100644 --- a/pallets/weights/src/pallet_capital_distribution.rs +++ b/pallets/weights/src/pallet_capital_distribution.rs @@ -50,8 +50,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) @@ -65,9 +65,9 @@ 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 { - (116_871_000 as Weight) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(116_871_000 as u64) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: CapitalDistribution HolderPaid (r:1 w:1) @@ -92,13 +92,13 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Checkpoint CheckpointIdSequence (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:0 w:2) fn claim(t: u32, w: u32) -> Weight { - (516_215_000 as Weight) + Weight::from_ref_time(516_215_000 as u64) // Standard Error: 7_000 - .saturating_add((159_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(Weight::from_ref_time(159_000 as u64).saturating_mul(t as u64)) // Standard Error: 7_000 - .saturating_add((81_000 as Weight).saturating_mul(w as Weight)) - .saturating_add(DbWeight::get().reads(27 as Weight)) - .saturating_add(DbWeight::get().writes(12 as Weight)) + .saturating_add(Weight::from_ref_time(81_000 as u64).saturating_mul(w as u64)) + .saturating_add(DbWeight::get().reads(27 as u64)) + .saturating_add(DbWeight::get().writes(12 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -126,13 +126,13 @@ impl pallet_corporate_actions::distribution::WeightInfo for WeightInfo { // Storage: Checkpoint CheckpointIdSequence (r:1 w:0) // Storage: Asset BalanceOfAtScope (r:0 w:2) fn push_benefit(t: u32, w: u32) -> Weight { - (517_263_000 as Weight) + Weight::from_ref_time(517_263_000 as u64) // Standard Error: 8_000 - .saturating_add((205_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(Weight::from_ref_time(205_000 as u64).saturating_mul(t as u64)) // Standard Error: 8_000 - .saturating_add((95_000 as Weight).saturating_mul(w as Weight)) - .saturating_add(DbWeight::get().reads(30 as Weight)) - .saturating_add(DbWeight::get().writes(12 as Weight)) + .saturating_add(Weight::from_ref_time(95_000 as u64).saturating_mul(w as u64)) + .saturating_add(DbWeight::get().reads(30 as u64)) + .saturating_add(DbWeight::get().writes(12 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -143,9 +143,9 @@ 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 { - (101_522_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(101_522_000 as u64) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -155,8 +155,8 @@ 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 { - (96_594_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(96_594_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } } diff --git a/pallets/weights/src/pallet_checkpoint.rs b/pallets/weights/src/pallet_checkpoint.rs index 6c8eeec141..c28413d41f 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (22_014_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_713 nanoseconds. + Weight::from_ref_time(18_424_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (80_449_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 53_509 nanoseconds. + Weight::from_ref_time(54_550_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -86,12 +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) + /// The range of component `s` is `[1, 52]`. fn create_schedule(s: u32) -> Weight { - (137_723_000 as Weight) - // Standard Error: 106_000 - .saturating_add((518_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 79_597 nanoseconds. + Weight::from_ref_time(82_521_401 as u64) + // Standard Error: 3_167 + .saturating_add(Weight::from_ref_time(100_649 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(7 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -99,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 { - (85_362_000 as Weight) - // Standard Error: 91_000 - .saturating_add((332_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: 49_030 nanoseconds. + Weight::from_ref_time(52_146_579 as u64) + // Standard Error: 6_090 + .saturating_add(Weight::from_ref_time(165_419 as u64).saturating_mul(s 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_committee.rs b/pallets/weights/src/pallet_committee.rs index db036c6b7b..8b8c453e22 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (20_972_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_322 nanoseconds. + Weight::from_ref_time(18_153_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Instance1Committee Members (r:1 w:0) // Storage: Instance1Committee ReleaseCoordinator (r:0 w:1) fn set_release_coordinator() -> Weight { - (166_590_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 121_574 nanoseconds. + Weight::from_ref_time(133_636_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Instance1Committee ExpiresAfter (r:0 w:1) fn set_expires_after() -> Weight { - (24_033_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 21_139 nanoseconds. + Weight::from_ref_time(21_850_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (396_265_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 281_019 nanoseconds. + Weight::from_ref_time(284_926_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (309_183_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 263_446 nanoseconds. + Weight::from_ref_time(266_863_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (550_119_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 366_677 nanoseconds. + Weight::from_ref_time(370_605_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (332_290_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 239_021 nanoseconds. + Weight::from_ref_time(250_753_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_compliance_manager.rs b/pallets/weights/src/pallet_compliance_manager.rs index 917fc1f116..89b9acec25 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: 2022-06-28, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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: 522_000 - .saturating_add((9_579_000 as Weight).saturating_mul(a as Weight)) - // Standard Error: 522_000 - .saturating_add((5_484_000 as Weight).saturating_mul(b as Weight)) - // Standard Error: 522_000 - .saturating_add((5_395_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 522_000 - .saturating_add((968_000 as Weight).saturating_mul(d as Weight)) + // Minimum execution time: 7_874 nanoseconds. + Weight::from_ref_time(8_095_000 as u64) + // Standard Error: 39_414 + .saturating_add(Weight::from_ref_time(2_955_380 as u64).saturating_mul(a as u64)) + // Standard Error: 39_414 + .saturating_add(Weight::from_ref_time(476_194 as u64).saturating_mul(b as u64)) + // Standard Error: 39_414 + .saturating_add(Weight::from_ref_time(721_394 as u64).saturating_mul(c as u64)) + // Manually set for `d` + .saturating_add(Weight::from_ref_time(721_394 as u64).saturating_mul(d as u64)) } // 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 { - (115_178_000 as Weight) - // Standard Error: 1_087_000 - .saturating_add((387_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: 60_372 nanoseconds. + Weight::from_ref_time(63_026_589 as u64) + // Standard Error: 46_582 + .saturating_add(Weight::from_ref_time(540_810 as u64).saturating_mul(c as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (85_598_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 51_265 nanoseconds. + Weight::from_ref_time(51_766_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (108_303_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 52_668 nanoseconds. + Weight::from_ref_time(53_188_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (74_689_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 49_812 nanoseconds. + Weight::from_ref_time(54_541_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (89_973_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 56_625 nanoseconds. + Weight::from_ref_time(57_235_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (73_911_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 49_361 nanoseconds. + Weight::from_ref_time(49_752_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (100_696_000 as Weight) - // Standard Error: 1_115_000 - .saturating_add((1_832_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_863 nanoseconds. + Weight::from_ref_time(56_861_754 as u64) + // Standard Error: 30_721 + .saturating_add(Weight::from_ref_time(737_109 as u64).saturating_mul(c as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (103_333_000 as Weight) - // Standard Error: 2_864_000 - .saturating_add((10_787_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: 52_056 nanoseconds. + Weight::from_ref_time(54_555_106 as u64) + // Standard Error: 62_685 + .saturating_add(Weight::from_ref_time(6_376_676 as u64).saturating_mul(c as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (69_229_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 43_210 nanoseconds. + Weight::from_ref_time(43_600_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_corporate_actions.rs b/pallets/weights/src/pallet_corporate_actions.rs index a55e337ada..53ea6a5a62 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (42_777_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 18_084 nanoseconds. + Weight::from_ref_time(18_644_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (125_321_000 as Weight) - // Standard Error: 19_000 - .saturating_add((745_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_452 nanoseconds. + Weight::from_ref_time(61_539_704 as u64) + // Standard Error: 3_639 + .saturating_add(Weight::from_ref_time(397_960 as u64).saturating_mul(t as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (66_114_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 43_400 nanoseconds. + Weight::from_ref_time(44_302_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (148_501_000 as Weight) - // Standard Error: 6_000 - .saturating_add((203_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: 47_147 nanoseconds. + Weight::from_ref_time(67_165_215 as u64) + // Standard Error: 1_849 + .saturating_add(Weight::from_ref_time(205_765 as u64).saturating_mul(w as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (317_619_000 as Weight) - // Standard Error: 9_000 - .saturating_add((218_000 as Weight).saturating_mul(w as Weight)) - // Standard Error: 19_000 - .saturating_add((155_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: 213_725 nanoseconds. + Weight::from_ref_time(201_311_207 as u64) + // Standard Error: 2_642 + .saturating_add(Weight::from_ref_time(181_785 as u64).saturating_mul(w as u64)) + // Standard Error: 5_282 + .saturating_add(Weight::from_ref_time(4_618 as u64).saturating_mul(t as u64)) + .saturating_add(DbWeight::get().reads(15 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // 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 { - (320_024_000 as Weight) - // Standard Error: 13_000 - .saturating_add((443_000 as Weight).saturating_mul(w as Weight)) - // Standard Error: 27_000 - .saturating_add((524_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: 328_516 nanoseconds. + Weight::from_ref_time(228_960_175 as u64) + // Standard Error: 2_737 + .saturating_add(Weight::from_ref_time(265_836 as u64).saturating_mul(w as u64)) + // Standard Error: 5_472 + .saturating_add(Weight::from_ref_time(170_404 as u64).saturating_mul(t as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // 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: 141_000 - .saturating_add((11_060_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: 50_022 nanoseconds. + Weight::from_ref_time(43_234_892 as u64) + // Standard Error: 10_312 + .saturating_add(Weight::from_ref_time(2_678_891 as u64).saturating_mul(d as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(d as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (148_969_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) + // Minimum execution time: 76_051 nanoseconds. + Weight::from_ref_time(77_222_000 as u64) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(8 as u64)) } // 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 { - (133_199_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 82_913 nanoseconds. + Weight::from_ref_time(83_644_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // 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 { - (247_549_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 92_782 nanoseconds. + Weight::from_ref_time(93_413_000 as u64) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // 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 { - (167_270_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 95_286 nanoseconds. + Weight::from_ref_time(96_608_000 as u64) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } } diff --git a/pallets/weights/src/pallet_corporate_ballot.rs b/pallets/weights/src/pallet_corporate_ballot.rs index adf976321e..6dbbb7451e 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (118_293_000 as Weight) - // Standard Error: 9_000 - .saturating_add((109_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: 66_924 nanoseconds. + Weight::from_ref_time(68_942_016 as u64) + // Standard Error: 1_588 + .saturating_add(Weight::from_ref_time(34_271 as u64).saturating_mul(c as u64)) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (132_433_000 as Weight) - // Standard Error: 9_000 - .saturating_add((233_000 as Weight).saturating_mul(c as Weight)) - // Standard Error: 9_000 - .saturating_add((254_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: 116_224 nanoseconds. + Weight::from_ref_time(46_507_296 as u64) + // Standard Error: 3_137 + .saturating_add(Weight::from_ref_time(94_302 as u64).saturating_mul(c as u64)) + // Standard Error: 3_137 + .saturating_add(Weight::from_ref_time(221_389 as u64).saturating_mul(t as u64)) + .saturating_add(DbWeight::get().reads(10 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (130_412_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 51_445 nanoseconds. + Weight::from_ref_time(53_549_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (76_724_000 as Weight) - // Standard Error: 8_000 - .saturating_add((124_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_648 nanoseconds. + Weight::from_ref_time(58_720_245 as u64) + // Standard Error: 2_777 + .saturating_add(Weight::from_ref_time(42_176 as u64).saturating_mul(c as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (74_809_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 51_666 nanoseconds. + Weight::from_ref_time(53_719_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (81_801_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 56_133 nanoseconds. + Weight::from_ref_time(69_789_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } } diff --git a/pallets/weights/src/pallet_external_agents.rs b/pallets/weights/src/pallet_external_agents.rs index 48a5e4b9f8..a0ddb6fc1c 100644 --- a/pallets/weights/src/pallet_external_agents.rs +++ b/pallets/weights/src/pallet_external_agents.rs @@ -50,8 +50,8 @@ 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) @@ -59,11 +59,11 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: ExternalAgents AGIdSequence (r:1 w:1) // Storage: ExternalAgents GroupPermissions (r:0 w:1) fn create_group(p: u32) -> Weight { - (75_988_000 as Weight) + Weight::from_ref_time(75_988_000 as u64) // Standard Error: 285_000 - .saturating_add((631_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(631_000 as u64).saturating_mul(p as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -72,11 +72,11 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: ExternalAgents AGIdSequence (r:1 w:0) // Storage: ExternalAgents GroupPermissions (r:0 w:1) fn set_group_permissions(p: u32) -> Weight { - (66_758_000 as Weight) + Weight::from_ref_time(66_758_000 as u64) // Standard Error: 157_000 - .saturating_add((1_041_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(1_041_000 as u64).saturating_mul(p as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:2 w:1) @@ -85,18 +85,18 @@ 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 { - (79_259_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(79_259_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (69_603_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(69_603_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:2 w:1) @@ -105,9 +105,9 @@ 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 { - (78_347_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(78_347_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:2 w:1) @@ -115,9 +115,9 @@ 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 { - (78_211_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(78_211_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -128,9 +128,9 @@ 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_508_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(102_508_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -142,19 +142,19 @@ impl pallet_external_agents::WeightInfo for WeightInfo { // Storage: Identity Authorizations (r:0 w:1) // Storage: ExternalAgents GroupPermissions (r:0 w:1) fn create_group_and_add_auth(p: u32) -> Weight { - (88_904_000 as Weight) + Weight::from_ref_time(88_904_000 as u64) // Standard Error: 287_000 - .saturating_add((1_828_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + .saturating_add(Weight::from_ref_time(1_828_000 as u64).saturating_mul(p as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Manually added - sum of create group and change custom group fn create_and_change_custom_group(p: u32) -> Weight { - (154_335_000 as Weight) + Weight::from_ref_time(154_335_000 as u64) // Standard Error: 285_000 - .saturating_add((631_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + .saturating_add(Weight::from_ref_time(631_000 as u64).saturating_mul(p as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } } diff --git a/pallets/weights/src/pallet_grandpa.rs b/pallets/weights/src/pallet_grandpa.rs index 66c6e18b34..0bf406b67f 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 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_group.rs b/pallets/weights/src/pallet_group.rs index 3d308c1d08..334c3934fc 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (30_672_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 20_097 nanoseconds. + Weight::from_ref_time(21_179_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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_528_157_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 809_956 nanoseconds. + Weight::from_ref_time(815_536_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (325_770_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 229_423 nanoseconds. + Weight::from_ref_time(234_724_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (281_008_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 282_612 nanoseconds. + Weight::from_ref_time(288_954_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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_554_960_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 813_462 nanoseconds. + Weight::from_ref_time(849_529_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (3_401_075_000 as Weight) - // Standard Error: 5_538_000 - .saturating_add((1_322_473_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: 571_896 nanoseconds. + Weight::from_ref_time(572_527_000 as u64) + // Standard Error: 1_726_909 + .saturating_add(Weight::from_ref_time(567_049_257 as u64).saturating_mul(m as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(m as u64))) + .saturating_add(DbWeight::get().writes(2 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(m as u64))) } // 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 { - (378_008_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 299_644 nanoseconds. + Weight::from_ref_time(307_458_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } } diff --git a/pallets/weights/src/pallet_identity.rs b/pallets/weights/src/pallet_identity.rs index 8dee8c9bcb..09a09ff3e8 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: 2022-06-28, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (87_207_000 as Weight) - // Standard Error: 277_000 - .saturating_add((21_687_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: 51_996 nanoseconds. + Weight::from_ref_time(59_054_925 as u64) + // Standard Error: 15_903 + .saturating_add(Weight::from_ref_time(10_439_179 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(i as u64))) + .saturating_add(DbWeight::get().writes(4 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(i as u64))) } // 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 { - (91_475_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 58_899 nanoseconds. + Weight::from_ref_time(59_851_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (0 as Weight) - // Standard Error: 541_000 - .saturating_add((33_882_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: 26_659 nanoseconds. + Weight::from_ref_time(37_221_231 as u64) + // Standard Error: 12_322 + .saturating_add(Weight::from_ref_time(13_845_855 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().reads((4 as u64).saturating_mul(i as u64))) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(i as u64))) } // 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 { - (143_309_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(9 as Weight)) + // Minimum execution time: 86_480 nanoseconds. + Weight::from_ref_time(87_341_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(9 as u64)) } // 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 { - (127_719_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) + // Minimum execution time: 74_728 nanoseconds. + Weight::from_ref_time(75_449_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(8 as u64)) } // Storage: Identity CddAuthForPrimaryKeyRotation (r:0 w:1) fn change_cdd_requirement_for_mk_rotation() -> Weight { - (21_657_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_552 nanoseconds. + Weight::from_ref_time(18_124_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (115_020_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 73_546 nanoseconds. + Weight::from_ref_time(74_919_000 as u64) + .saturating_add(DbWeight::get().reads(10 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // 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 { - (63_942_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 44_883 nanoseconds. + Weight::from_ref_time(45_124_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (74_138_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 48_650 nanoseconds. + Weight::from_ref_time(49_311_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (93_044_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 45_033 nanoseconds. + Weight::from_ref_time(45_584_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (88_241_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 50_533 nanoseconds. + Weight::from_ref_time(51_044_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:2 w:1) fn set_secondary_key_permissions() -> Weight { - (53_854_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 35_666 nanoseconds. + Weight::from_ref_time(36_547_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } + /// 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: 60_000 - .saturating_add((301_000 as Weight).saturating_mul(p as Weight)) - // Standard Error: 607_000 - .saturating_add((37_546_000 as Weight).saturating_mul(l as Weight)) - // Standard Error: 607_000 - .saturating_add((36_844_000 as Weight).saturating_mul(e as Weight)) + // Minimum execution time: 185_843 nanoseconds. + Weight::from_ref_time(186_966_000 as u64) + // Manually set for `a` + .saturating_add(Weight::from_ref_time(100_000 as u64).saturating_mul(a as u64)) + // Manually set for `p` + .saturating_add(Weight::from_ref_time(100_000 as u64).saturating_mul(p as u64)) + // Standard Error: 157_629 + .saturating_add(Weight::from_ref_time(12_865_554 as u64).saturating_mul(l as u64)) + // Standard Error: 157_629 + .saturating_add(Weight::from_ref_time(12_133_724 as u64).saturating_mul(e as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity IsDidFrozen (r:0 w:1) fn freeze_secondary_keys() -> Weight { - (40_657_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 27_731 nanoseconds. + Weight::from_ref_time(28_112_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity IsDidFrozen (r:0 w:1) fn unfreeze_secondary_keys() -> Weight { - (36_631_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 26_970 nanoseconds. + Weight::from_ref_time(27_561_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (50_950_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 34_784 nanoseconds. + Weight::from_ref_time(35_415_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (51_898_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 36_177 nanoseconds. + Weight::from_ref_time(36_648_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (118_228_000 as Weight) - // Standard Error: 888_000 - .saturating_add((98_154_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: 39_563 nanoseconds. + Weight::from_ref_time(113_037_749 as u64) + // Standard Error: 76_645 + .saturating_add(Weight::from_ref_time(52_138_660 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(i as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(i as u64))) } // 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 { - (2_974_629_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 1_000_638 nanoseconds. + Weight::from_ref_time(1_009_965_000 as u64) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity DidRecords (r:1 w:0) @@ -271,20 +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 { - (4_439_255_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 1_899_157 nanoseconds. + Weight::from_ref_time(1_904_146_000 as u64) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } - // 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 { - (44_816_000 as Weight) - // Standard Error: 0 - .saturating_add((8_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_564 nanoseconds. + Weight::from_ref_time(35_697_157 as u64) + // Standard Error: 72 + .saturating_add(Weight::from_ref_time(5_617 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } } diff --git a/pallets/weights/src/pallet_im_online.rs b/pallets/weights/src/pallet_im_online.rs index 8f0bb518ce..9e749d2993 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (177_041_000 as Weight) - // Standard Error: 6_000 - .saturating_add((98_000 as Weight).saturating_mul(k as Weight)) - // Standard Error: 63_000 - .saturating_add((896_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: 111_166 nanoseconds. + Weight::from_ref_time(86_568_280 as u64) + // Standard Error: 1_204 + .saturating_add(Weight::from_ref_time(42_357 as u64).saturating_mul(k as u64)) + // Standard Error: 12_159 + .saturating_add(Weight::from_ref_time(439_483 as u64).saturating_mul(e as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_indices.rs b/pallets/weights/src/pallet_indices.rs index 0f5daf3802..782f293779 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (50_420_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 33_041 nanoseconds. + Weight::from_ref_time(33_792_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Indices Accounts (r:1 w:1) // Storage: System Account (r:1 w:1) fn transfer() -> Weight { - (61_433_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 39_964 nanoseconds. + Weight::from_ref_time(40_064_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Indices Accounts (r:1 w:1) fn free() -> Weight { - (67_322_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_323 nanoseconds. + Weight::from_ref_time(34_524_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Indices Accounts (r:1 w:1) // Storage: System Account (r:1 w:1) fn force_transfer() -> Weight { - (50_854_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 35_356 nanoseconds. + Weight::from_ref_time(35_957_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Indices Accounts (r:1 w:1) fn freeze() -> Weight { - (79_742_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 35_927 nanoseconds. + Weight::from_ref_time(36_147_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_multisig.rs b/pallets/weights/src/pallet_multisig.rs index 3cf831d02d..77ee92da96 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (94_723_000 as Weight) - // Standard Error: 219_000 - .saturating_add((17_265_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: 51_255 nanoseconds. + Weight::from_ref_time(51_635_000 as u64) + // Standard Error: 113_982 + .saturating_add(Weight::from_ref_time(10_247_213 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(i as u64))) } // 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 { - (191_998_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 94_124 nanoseconds. + Weight::from_ref_time(94_605_000 as u64) + .saturating_add(DbWeight::get().reads(10 as u64)) + .saturating_add(DbWeight::get().writes(7 as u64)) } // 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 { - (265_725_000 as Weight) - .saturating_add(DbWeight::get().reads(11 as Weight)) - .saturating_add(DbWeight::get().writes(7 as Weight)) + // Minimum execution time: 97_380 nanoseconds. + Weight::from_ref_time(98_372_000 as u64) + .saturating_add(DbWeight::get().reads(11 as u64)) + .saturating_add(DbWeight::get().writes(7 as u64)) } // 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 { - (147_361_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 86_971 nanoseconds. + Weight::from_ref_time(88_022_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // 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 { - (152_857_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) + // Minimum execution time: 92_842 nanoseconds. + Weight::from_ref_time(93_142_000 as u64) + .saturating_add(DbWeight::get().reads(10 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // 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 { - (147_117_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 78_305 nanoseconds. + Weight::from_ref_time(79_727_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (126_430_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 71_803 nanoseconds. + Weight::from_ref_time(72_313_000 as u64) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (117_515_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 60_402 nanoseconds. + Weight::from_ref_time(61_554_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (89_431_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 55_883 nanoseconds. + Weight::from_ref_time(56_153_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (96_603_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 60_050 nanoseconds. + Weight::from_ref_time(60_642_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (100_271_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 63_868 nanoseconds. + Weight::from_ref_time(64_719_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // 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 { - (68_606_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 43_991 nanoseconds. + Weight::from_ref_time(44_442_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (73_975_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 49_481 nanoseconds. + Weight::from_ref_time(49_842_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (165_799_000 as Weight) - // Standard Error: 273_000 - .saturating_add((23_626_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: 55_993 nanoseconds. + Weight::from_ref_time(30_436_528 as u64) + // Standard Error: 18_213 + .saturating_add(Weight::from_ref_time(13_122_879 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(i as u64))) } // 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 { - (24_806_000 as Weight) - // Standard Error: 367_000 - .saturating_add((32_285_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_685 nanoseconds. + Weight::from_ref_time(48_581_468 as u64) + // Standard Error: 31_534 + .saturating_add(Weight::from_ref_time(13_775_780 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(i as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(i as u64))) } // 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 { - (53_135_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 36_387 nanoseconds. + Weight::from_ref_time(36_898_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (67_282_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 43_300 nanoseconds. + Weight::from_ref_time(44_382_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Identity KeyRecords (r:2 w:2) @@ -288,22 +309,26 @@ 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 { - (100_028_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 59_369 nanoseconds. + Weight::from_ref_time(60_131_000 as u64) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Timestamp Now (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: Identity DidRecords (r:1 w:0) // Storage: MultiSig Proposals (r:1 w:0) // Storage: Permissions CurrentPalletName (r:1 w:1) // Storage: Permissions CurrentDispatchableName (r:1 w:1) // Storage: MultiSig ProposalDetail (r:1 w:1) // Storage: Identity CurrentDid (r:0 w:1) + // Storage: Identity CurrentPayer (r:0 w:1) fn execute_scheduled_proposal() -> Weight { - (110_785_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 70_601 nanoseconds. + Weight::from_ref_time(71_322_000 as u64) + .saturating_add(DbWeight::get().reads(10 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } } diff --git a/pallets/weights/src/pallet_pips.rs b/pallets/weights/src/pallet_pips.rs index 7fceef1e25..821a0b9f1d 100644 --- a/pallets/weights/src/pallet_pips.rs +++ b/pallets/weights/src/pallet_pips.rs @@ -50,43 +50,43 @@ 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 { - (27_104_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(27_104_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Pips MinimumProposalDeposit (r:1 w:1) fn set_min_proposal_deposit() -> Weight { - (26_912_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(26_912_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Pips DefaultEnactmentPeriod (r:1 w:1) fn set_default_enactment_period() -> Weight { - (25_513_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(25_513_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Pips PendingPipExpiry (r:1 w:1) fn set_pending_pip_expiry() -> Weight { - (26_616_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(26_616_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Pips MaxPipSkipCount (r:1 w:1) fn set_max_pip_skip_count() -> Weight { - (25_032_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(25_032_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Pips ActivePipLimit (r:1 w:1) fn set_active_pip_limit() -> Weight { - (25_431_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(25_431_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Pips PipIdSequence (r:1 w:1) @@ -106,9 +106,9 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips Deposits (r:0 w:1) // Storage: Pips Proposals (r:0 w:1) fn propose_from_community() -> Weight { - (203_106_000 as Weight) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(11 as Weight)) + Weight::from_ref_time(203_106_000 as u64) + .saturating_add(DbWeight::get().reads(14 as u64)) + .saturating_add(DbWeight::get().writes(11 as u64)) } // Storage: Identity CurrentDid (r:1 w:0) // Storage: Pips PipIdSequence (r:1 w:1) @@ -120,9 +120,9 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips ProposalMetadata (r:0 w:1) // Storage: Pips Proposals (r:0 w:1) fn propose_from_committee() -> Weight { - (109_791_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(109_791_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Pips Proposals (r:1 w:0) @@ -132,9 +132,9 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips ProposalVotes (r:1 w:1) // Storage: Pips LiveQueue (r:1 w:1) fn vote() -> Weight { - (238_241_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(238_241_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Pips Proposals (r:1 w:1) // Storage: Pips DefaultEnactmentPeriod (r:1 w:0) @@ -142,9 +142,9 @@ 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 { - (114_882_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(114_882_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // Storage: Pips Proposals (r:1 w:1) // Storage: Pips LiveQueue (r:1 w:1) @@ -159,9 +159,9 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips PipSkipCount (r:0 w:1) // Storage: Pips ProposalResult (r:0 w:1) fn reject_proposal() -> Weight { - (196_681_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(10 as Weight)) + Weight::from_ref_time(196_681_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(10 as u64)) } // Storage: Pips Proposals (r:1 w:1) // Storage: Pips Deposits (r:1 w:0) @@ -170,9 +170,9 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips PipSkipCount (r:0 w:1) // Storage: Pips ProposalResult (r:0 w:1) fn prune_proposal() -> Weight { - (99_211_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(99_211_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee ReleaseCoordinator (r:1 w:0) @@ -181,18 +181,18 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Scheduler Agenda (r:2 w:2) // Storage: Pips PipToSchedule (r:0 w:1) fn reschedule_execution() -> Weight { - (111_182_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(111_182_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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 { - (55_742_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(55_742_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Instance1Committee Members (r:1 w:0) @@ -201,9 +201,9 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Pips SnapshotQueue (r:0 w:1) // Storage: Pips SnapshotMeta (r:0 w:1) fn snapshot() -> Weight { - (1_049_777_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(1_049_777_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Pips MaxPipSkipCount (r:1 w:0) // Storage: Pips SnapshotQueue (r:1 w:1) @@ -221,19 +221,19 @@ impl pallet_pips::WeightInfo for WeightInfo { // Storage: Scheduler Agenda (r:1 w:1) // Storage: Pips PipToSchedule (r:0 w:1) fn enact_snapshot_results(a: u32, r: u32, s: u32) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 120_040_000 - .saturating_add((431_560_000 as Weight).saturating_mul(a as Weight)) + .saturating_add(Weight::from_ref_time(431_560_000 as u64).saturating_mul(a as u64)) // Standard Error: 120_040_000 - .saturating_add((17_425_641_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))) + .saturating_add(Weight::from_ref_time(17_425_641_000 as u64).saturating_mul(r as u64)) + .saturating_add(DbWeight::get().reads(689 as u64)) + .saturating_add(DbWeight::get().reads((3 as u64).saturating_mul(a as u64))) + .saturating_add(DbWeight::get().reads((405 as u64).saturating_mul(r as u64))) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(s as u64))) + .saturating_add(DbWeight::get().writes(685 as u64)) + .saturating_add(DbWeight::get().writes((4 as u64).saturating_mul(a as u64))) + .saturating_add(DbWeight::get().writes((404 as u64).saturating_mul(r as u64))) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(s as u64))) } // Storage: Pips Proposals (r:1 w:1) // Storage: Pips ActivePipCount (r:1 w:1) @@ -247,9 +247,9 @@ 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 { - (24_436_343_000 as Weight) - .saturating_add(DbWeight::get().reads(1204 as Weight)) - .saturating_add(DbWeight::get().writes(1606 as Weight)) + Weight::from_ref_time(24_436_343_000 as u64) + .saturating_add(DbWeight::get().reads(1204 as u64)) + .saturating_add(DbWeight::get().writes(1606 as u64)) } // Storage: Pips Proposals (r:1 w:1) // Storage: Pips LiveQueue (r:1 w:1) @@ -265,8 +265,8 @@ 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 { - (26_587_065_000 as Weight) - .saturating_add(DbWeight::get().reads(1207 as Weight)) - .saturating_add(DbWeight::get().writes(1607 as Weight)) + Weight::from_ref_time(26_587_065_000 as u64) + .saturating_add(DbWeight::get().reads(1207 as u64)) + .saturating_add(DbWeight::get().writes(1607 as u64)) } } diff --git a/pallets/weights/src/pallet_portfolio.rs b/pallets/weights/src/pallet_portfolio.rs index 19d182fabe..30946c6c3f 100644 --- a/pallets/weights/src/pallet_portfolio.rs +++ b/pallets/weights/src/pallet_portfolio.rs @@ -50,16 +50,16 @@ 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 { - (55_827_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(55_827_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio PortfolioAssetCount (r:1 w:1) @@ -68,9 +68,9 @@ impl pallet_portfolio::WeightInfo for WeightInfo { // Storage: Portfolio PortfoliosInCustody (r:0 w:1) // Storage: Portfolio NameToNumber (r:0 w:1) fn delete_portfolio() -> Weight { - (82_934_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(82_934_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio PortfolioCustodian (r:1 w:0) @@ -79,31 +79,31 @@ impl pallet_portfolio::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioLockedAssets (r:1 w:0) // Storage: Portfolio PortfolioAssetCount (r:2 w:2) fn move_portfolio_funds(a: u32) -> Weight { - (240_712_000 as Weight) + Weight::from_ref_time(240_712_000 as u64) // Standard Error: 397_000 - .saturating_add((38_563_000 as Weight).saturating_mul(a as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((3 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))) + .saturating_add(Weight::from_ref_time(38_563_000 as u64).saturating_mul(a as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((3 as u64).saturating_mul(a as u64))) + .saturating_add(DbWeight::get().writes(2 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(a as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Portfolio Portfolios (r:1 w:1) // Storage: Portfolio NameToNumber (r:1 w:1) fn rename_portfolio(i: u32) -> Weight { - (61_140_000 as Weight) + Weight::from_ref_time(61_140_000 as u64) // Standard Error: 3_000 - .saturating_add((17_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(17_000 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (51_711_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(51_711_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Identity Authorizations (r:1 w:1) @@ -111,8 +111,8 @@ 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_530_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + Weight::from_ref_time(75_530_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } } diff --git a/pallets/weights/src/pallet_preimage.rs b/pallets/weights/src/pallet_preimage.rs index 3477116685..10c2dd3768 100644 --- a/pallets/weights/src/pallet_preimage.rs +++ b/pallets/weights/src/pallet_preimage.rs @@ -44,91 +44,91 @@ 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 { +pub struct SubstrateWeight; +impl pallet_preimage::WeightInfo for SubstrateWeight { // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:1) fn note_preimage(s: u32, ) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // 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)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Preimage PreimageFor (r:1 w:1) // Storage: Preimage StatusFor (r:1 w:0) fn note_requested_preimage(s: u32, ) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // 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)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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) + Weight::from_ref_time(0 as u64) // 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)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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)) + Weight::from_ref_time(39_239_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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)) + Weight::from_ref_time(24_905_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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)) + Weight::from_ref_time(37_451_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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)) + Weight::from_ref_time(23_397_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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)) + Weight::from_ref_time(13_407_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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)) + Weight::from_ref_time(4_202_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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)) + Weight::from_ref_time(24_858_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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)) + Weight::from_ref_time(13_763_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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)) + Weight::from_ref_time(4_262_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_protocol_fee.rs b/pallets/weights/src/pallet_protocol_fee.rs index 69a210d02b..202dff04e2 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (27_515_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_312 nanoseconds. + Weight::from_ref_time(18_384_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: ProtocolFee BaseFees (r:0 w:1) fn change_base_fee() -> Weight { - (29_524_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 17_833 nanoseconds. + Weight::from_ref_time(18_334_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } } diff --git a/pallets/weights/src/pallet_relayer.rs b/pallets/weights/src/pallet_relayer.rs index be22f4a103..66a4e59dc9 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (115_227_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 38_822 nanoseconds. + Weight::from_ref_time(39_303_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // 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 { - (260_708_000 as Weight) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 83_113 nanoseconds. + Weight::from_ref_time(84_275_000 as u64) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // 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 { - (110_209_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + // Minimum execution time: 41_928 nanoseconds. + Weight::from_ref_time(43_570_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Relayer Subsidies (r:1 w:1) fn update_polyx_limit() -> Weight { - (90_477_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_593 nanoseconds. + Weight::from_ref_time(35_596_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Relayer Subsidies (r:1 w:1) fn increase_polyx_limit() -> Weight { - (68_388_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_664 nanoseconds. + Weight::from_ref_time(35_145_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Relayer Subsidies (r:1 w:1) fn decrease_polyx_limit() -> Weight { - (70_320_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 34_243 nanoseconds. + Weight::from_ref_time(35_435_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } } 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 5ba7dcc767..b0e5d43c6f 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (0 as Weight) - // Standard Error: 1_927_000 - .saturating_add((58_572_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_630 nanoseconds. + Weight::from_ref_time(5_671_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (22_146_000 as Weight) - // Standard Error: 1_383_000 - .saturating_add((44_138_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_959 nanoseconds. + Weight::from_ref_time(9_283_754 as u64) + // Standard Error: 5_002 + .saturating_add(Weight::from_ref_time(404_648 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } - // 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 { - (53_674_000 as Weight) - // Standard Error: 625_000 - .saturating_add((43_037_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: 11_731 nanoseconds. + Weight::from_ref_time(11_902_000 as u64) } - // 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 { - (9_347_000 as Weight) - // Standard Error: 484_000 - .saturating_add((37_986_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: 26_258 nanoseconds. + Weight::from_ref_time(26_438_000 as u64) + // Standard Error: 7 + .saturating_add(Weight::from_ref_time(884 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } - // 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 { - (35_051_000 as Weight) - // Standard Error: 657_000 - .saturating_add((18_647_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 { - (22_975_000 as Weight) - // Standard Error: 568_000 - .saturating_add((12_118_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: 14_046 nanoseconds. + Weight::from_ref_time(14_467_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } - // Storage: Scheduler Agenda (r:2 w:2) - // Storage: Scheduler Lookup (r:0 w:1) - fn on_initialize_periodic_named(s: u32) -> Weight { - (108_283_000 as Weight) - // Standard Error: 967_000 - .saturating_add((26_064_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_982 nanoseconds. + Weight::from_ref_time(12_503_000 as u64) } - // Storage: Scheduler Agenda (r:2 w:2) - fn on_initialize_periodic(s: u32) -> Weight { - (28_038_000 as Weight) - // Standard Error: 657_000 - .saturating_add((21_127_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_571 nanoseconds. + Weight::from_ref_time(6_171_000 as u64) } - // Storage: Scheduler Agenda (r:1 w:1) - // Storage: Scheduler Lookup (r:0 w:1) - fn on_initialize_named(s: u32) -> Weight { - (0 as Weight) - // Standard Error: 583_000 - .saturating_add((21_107_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 { - (76_662_000 as Weight) - // Standard Error: 302_000 - .saturating_add((12_294_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: 6_382 nanoseconds. + Weight::from_ref_time(8_936_000 as u64) } // Storage: Scheduler Agenda (r:1 w:1) + /// The range of component `s` is `[0, 49]`. fn schedule(s: u32) -> Weight { - (34_961_000 as Weight) - // Standard Error: 44_000 - .saturating_add((267_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: 22_301 nanoseconds. + Weight::from_ref_time(27_275_677 as u64) + // Standard Error: 37_452 + .saturating_add(Weight::from_ref_time(504_205 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (36_508_000 as Weight) - // Standard Error: 81_000 - .saturating_add((2_953_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: 22_151 nanoseconds. + Weight::from_ref_time(23_808_538 as u64) + // Standard Error: 9_116 + .saturating_add(Weight::from_ref_time(434_992 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (35_199_000 as Weight) - // Standard Error: 75_000 - .saturating_add((781_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: 25_106 nanoseconds. + Weight::from_ref_time(29_463_320 as u64) + // Standard Error: 7_941 + .saturating_add(Weight::from_ref_time(464_791 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (43_791_000 as Weight) - // Standard Error: 104_000 - .saturating_add((3_030_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_052 nanoseconds. + Weight::from_ref_time(25_629_402 as u64) + // Standard Error: 4_461 + .saturating_add(Weight::from_ref_time(412_230 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } } diff --git a/pallets/weights/src/pallet_session.rs b/pallets/weights/src/pallet_session.rs index 3b0721c2b5..9a63aeef4e 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (115_335_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 76_060 nanoseconds. + Weight::from_ref_time(77_362_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // 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 { - (83_793_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 66_783 nanoseconds. + Weight::from_ref_time(71_673_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } } diff --git a/pallets/weights/src/pallet_settlement.rs b/pallets/weights/src/pallet_settlement.rs index 85405fc204..9065a89512 100644 --- a/pallets/weights/src/pallet_settlement.rs +++ b/pallets/weights/src/pallet_settlement.rs @@ -50,8 +50,8 @@ 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) @@ -59,40 +59,40 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement Details (r:0 w:1) // Storage: Settlement VenueSigners (r:0 w:50) fn create_venue(d: u32, s: u32) -> Weight { - (58_414_000 as Weight) + Weight::from_ref_time(58_414_000 as u64) // Standard Error: 1_000 - .saturating_add((13_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(Weight::from_ref_time(13_000 as u64).saturating_mul(d as u64)) // Standard Error: 90_000 - .saturating_add((3_170_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))) + .saturating_add(Weight::from_ref_time(3_170_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) // Storage: Settlement Details (r:0 w:1) fn update_venue_details(d: u32) -> Weight { - (49_957_000 as Weight) + Weight::from_ref_time(49_957_000 as u64) // Standard Error: 1_000 - .saturating_add((4_000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(4_000 as u64).saturating_mul(d as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:1) fn update_venue_type() -> Weight { - (53_459_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(53_459_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueSigners (r:0 w:1) fn update_venue_signers(s: u32) -> Weight { - (41_479_000 as Weight) + Weight::from_ref_time(41_479_000 as u64) // Standard Error: 41_000 - .saturating_add((2_937_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_mul(s as Weight))) + .saturating_add(Weight::from_ref_time(2_937_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) @@ -105,13 +105,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionLegs (r:0 w:1) // Storage: Settlement UserAffirmations (r:0 w:2) fn add_instruction(l: u32) -> Weight { - (76_131_000 as Weight) + Weight::from_ref_time(76_131_000 as u64) // Standard Error: 1_647_000 - .saturating_add((17_712_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))) + .saturating_add(Weight::from_ref_time(17_712_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((3 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) @@ -126,13 +126,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionLegs (r:0 w:1) // Storage: Settlement UserAffirmations (r:0 w:2) fn add_instruction_with_settle_on_block_type(l: u32) -> Weight { - (141_490_000 as Weight) + Weight::from_ref_time(141_490_000 as u64) // Standard Error: 2_662_000 - .saturating_add((14_169_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))) + .saturating_add(Weight::from_ref_time(14_169_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(3 as u64)) + .saturating_add(DbWeight::get().writes((3 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) @@ -151,13 +151,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) fn add_and_affirm_instruction(l: u32) -> Weight { - (113_407_000 as Weight) + Weight::from_ref_time(113_407_000 as u64) // Standard Error: 3_107_000 - .saturating_add((74_336_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().reads((5 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))) + .saturating_add(Weight::from_ref_time(74_336_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().reads((5 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(5 as u64)) + .saturating_add(DbWeight::get().writes((6 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) @@ -178,13 +178,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) fn add_and_affirm_instruction_with_settle_on_block_type(l: u32) -> Weight { - (165_224_000 as Weight) + Weight::from_ref_time(165_224_000 as u64) // Standard Error: 1_879_000 - .saturating_add((69_521_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((5 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))) + .saturating_add(Weight::from_ref_time(69_521_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().reads((5 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(7 as u64)) + .saturating_add(DbWeight::get().writes((6 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -192,9 +192,9 @@ 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 { - (66_578_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(66_578_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -202,11 +202,11 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Settlement VenueAllowList (r:0 w:1) fn allow_venues(v: u32) -> Weight { - (61_220_000 as Weight) + Weight::from_ref_time(61_220_000 as u64) // Standard Error: 76_000 - .saturating_add((2_847_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))) + .saturating_add(Weight::from_ref_time(2_847_000 as u64).saturating_mul(v as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(v as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -214,11 +214,11 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Permissions CurrentDispatchableName (r:1 w:0) // Storage: Settlement VenueAllowList (r:0 w:1) fn disallow_venues(v: u32) -> Weight { - (57_240_000 as Weight) + Weight::from_ref_time(57_240_000 as u64) // Standard Error: 61_000 - .saturating_add((2_769_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))) + .saturating_add(Weight::from_ref_time(2_769_000 as u64).saturating_mul(v as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(v as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -231,13 +231,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) fn withdraw_affirmation(l: u32) -> Weight { - (72_919_000 as Weight) + Weight::from_ref_time(72_919_000 as u64) // Standard Error: 1_952_000 - .saturating_add((63_198_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))) + .saturating_add(Weight::from_ref_time(63_198_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((5 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((4 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -248,9 +248,9 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Settlement ReceiptsUsed (r:0 w:1) fn unclaim_receipt() -> Weight { - (94_830_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(94_830_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:1) @@ -264,13 +264,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement VenueInstructions (r:0 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) fn reject_instruction(l: u32) -> Weight { - (118_608_000 as Weight) + Weight::from_ref_time(118_608_000 as u64) // Standard Error: 1_149_000 - .saturating_add((48_590_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))) + .saturating_add(Weight::from_ref_time(48_590_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((3 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(3 as u64)) + .saturating_add(DbWeight::get().writes((6 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -283,13 +283,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Scheduler Agenda (r:1 w:1) // Storage: Settlement AffirmsReceived (r:0 w:1) fn affirm_instruction(l: u32) -> Weight { - (102_322_000 as Weight) + Weight::from_ref_time(102_322_000 as u64) // Standard Error: 760_000 - .saturating_add((40_582_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))) + .saturating_add(Weight::from_ref_time(40_582_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().reads((3 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(3 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -300,9 +300,9 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioCustodian (r:1 w:0) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) fn claim_receipt() -> Weight { - (212_979_000 as Weight) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(212_979_000 as u64) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:0) @@ -316,20 +316,20 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) fn affirm_with_receipts(r: u32) -> Weight { - (158_888_000 as Weight) + Weight::from_ref_time(158_888_000 as u64) // Standard Error: 2_345_000 - .saturating_add((144_616_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))) + .saturating_add(Weight::from_ref_time(144_616_000 as u64).saturating_mul(r as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().reads((4 as u64).saturating_mul(r as u64))) + .saturating_add(DbWeight::get().writes(2 as u64)) + .saturating_add(DbWeight::get().writes((4 as u64).saturating_mul(r as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement ReceiptsUsed (r:0 w:1) fn change_receipt_validity() -> Weight { - (38_811_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(38_811_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Settlement InstructionDetails (r:1 w:1) // Storage: Settlement InstructionLegs (r:1 w:0) @@ -361,13 +361,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:2) // Storage: Asset BalanceOfAtScope (r:0 w:2) fn execute_scheduled_instruction(l: u32) -> Weight { - (362_069_000 as Weight) + Weight::from_ref_time(362_069_000 as u64) // Standard Error: 6_743_000 - .saturating_add((839_685_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))) + .saturating_add(Weight::from_ref_time(839_685_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(39 as u64)) + .saturating_add(DbWeight::get().reads((30 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(5 as u64)) + .saturating_add(DbWeight::get().writes((16 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:1) @@ -375,9 +375,9 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Scheduler Lookup (r:1 w:1) // Storage: Scheduler Agenda (r:1 w:1) fn reschedule_instruction() -> Weight { - (236_748_000 as Weight) - .saturating_add(DbWeight::get().reads(15 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(236_748_000 as u64) + .saturating_add(DbWeight::get().reads(15 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement VenueInfo (r:1 w:0) @@ -393,13 +393,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement InstructionLegs (r:0 w:1) // Storage: Settlement UserAffirmations (r:0 w:2) fn add_instruction_with_memo_and_settle_on_block_type(l: u32) -> Weight { - (101_933_000 as Weight) + Weight::from_ref_time(101_933_000 as u64) // Standard Error: 4_522_000 - .saturating_add((52_343_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))) + .saturating_add(Weight::from_ref_time(52_343_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(4 as u64)) + .saturating_add(DbWeight::get().writes((3 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) @@ -421,13 +421,13 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:1) // Storage: Settlement InstructionLegStatus (r:0 w:1) fn add_and_affirm_instruction_with_memo_and_settle_on_block_type(l: u32) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 197_504_000 - .saturating_add((434_485_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(8 as Weight)) - .saturating_add(DbWeight::get().reads((5 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))) + .saturating_add(Weight::from_ref_time(434_485_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().reads((5 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(8 as u64)) + .saturating_add(DbWeight::get().writes((6 as u64).saturating_mul(l as u64))) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: Settlement InstructionDetails (r:1 w:1) @@ -461,12 +461,12 @@ impl pallet_settlement::WeightInfo for WeightInfo { // Storage: Settlement AffirmsReceived (r:0 w:2) // Storage: Asset BalanceOfAtScope (r:0 w:2) fn execute_manual_instruction(l: u32) -> Weight { - (214_454_000 as Weight) + Weight::from_ref_time(214_454_000 as u64) // Standard Error: 2_083_000 - .saturating_add((516_479_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))) + .saturating_add(Weight::from_ref_time(516_479_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(57 as u64)) + .saturating_add(DbWeight::get().reads((28 as u64).saturating_mul(l as u64))) + .saturating_add(DbWeight::get().writes(6 as u64)) + .saturating_add(DbWeight::get().writes((16 as u64).saturating_mul(l as u64))) } } diff --git a/pallets/weights/src/pallet_staking.rs b/pallets/weights/src/pallet_staking.rs index fbcd1b20ad..c766e2fa99 100644 --- a/pallets/weights/src/pallet_staking.rs +++ b/pallets/weights/src/pallet_staking.rs @@ -50,8 +50,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 +60,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: Staking Payee (r:0 w:1) fn bond() -> Weight { - (112_777_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + Weight::from_ref_time(112_777_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Bonded (r:1 w:0) @@ -70,9 +70,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Identity CurrentDid (r:1 w:0) // Storage: Balances Locks (r:1 w:1) fn bond_extra() -> Weight { - (95_227_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(95_227_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) @@ -81,9 +81,9 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Storage: Identity CurrentDid (r:1 w:0) fn unbond() -> Weight { - (92_495_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(92_495_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) @@ -91,11 +91,11 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded_update(s: u32) -> Weight { - (95_979_000 as Weight) + Weight::from_ref_time(95_979_000 as u64) // Standard Error: 38_000 - .saturating_add((73_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(73_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:1) @@ -109,12 +109,12 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Nominators (r:0 w:1) // Storage: Staking SpanSlash (r:0 w:1) fn withdraw_unbonded_kill(s: u32) -> Weight { - (133_202_000 as Weight) + Weight::from_ref_time(133_202_000 as u64) // Standard Error: 81_000 - .saturating_add((2_352_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))) + .saturating_add(Weight::from_ref_time(2_352_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(8 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:0) @@ -125,13 +125,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Validators (r:1 w:1) // Storage: Staking Nominators (r:0 w:1) fn validate() -> Weight { - (66_893_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(66_893_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Staking MinimumBondThreshold (r:0 w:1) fn set_min_bond_threshold() -> Weight { - (21_661_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(21_661_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking PermissionedIdentity (r:1 w:1) // Storage: Timestamp Now (r:1 w:0) @@ -140,26 +140,26 @@ 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 { - (79_290_000 as Weight) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(79_290_000 as u64) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking PermissionedIdentity (r:1 w:1) fn remove_permissioned_validator() -> Weight { - (40_726_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(40_726_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking ValidatorCommissionCap (r:1 w:1) // Storage: Staking Validators (r:2 w:1) fn set_commission_cap(m: u32) -> Weight { - (70_150_000 as Weight) + Weight::from_ref_time(70_150_000 as u64) // Standard Error: 166_000 - .saturating_add((16_378_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))) + .saturating_add(Weight::from_ref_time(16_378_000 as u64).saturating_mul(m as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(m as u64))) + .saturating_add(DbWeight::get().writes(2 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(m as u64))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking Ledger (r:1 w:0) @@ -172,61 +172,61 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Validators (r:2 w:1) // Storage: Staking CurrentEra (r:1 w:0) fn nominate(n: u32) -> Weight { - (147_545_000 as Weight) + Weight::from_ref_time(147_545_000 as u64) // Standard Error: 911_000 - .saturating_add((10_663_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)) + .saturating_add(Weight::from_ref_time(10_663_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(11 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(2 as u64)) } // 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 { - (37_337_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(37_337_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Staking Ledger (r:1 w:0) // Storage: Staking Payee (r:0 w:1) fn set_payee() -> Weight { - (48_978_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(48_978_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking Bonded (r:1 w:1) // Storage: Staking Ledger (r:2 w:2) fn set_controller() -> Weight { - (48_764_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + Weight::from_ref_time(48_764_000 as u64) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Staking ValidatorCount (r:0 w:1) fn set_validator_count(c: u32) -> Weight { - (3_184_000 as Weight) + Weight::from_ref_time(3_184_000 as u64) // Standard Error: 0 - .saturating_add((1_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(c as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking ForceEra (r:0 w:1) fn force_no_eras() -> Weight { - (3_245_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(3_245_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking ForceEra (r:0 w:1) fn force_new_era() -> Weight { - (3_161_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(3_161_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking ForceEra (r:0 w:1) fn force_new_era_always() -> Weight { - (5_301_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(5_301_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking Invulnerables (r:0 w:1) fn set_invulnerables(v: u32) -> Weight { - (5_572_000 as Weight) + Weight::from_ref_time(5_572_000 as u64) // Standard Error: 0 - .saturating_add((18_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + .saturating_add(Weight::from_ref_time(18_000 as u64).saturating_mul(v as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking Bonded (r:1 w:1) // Storage: Staking SlashingSpans (r:1 w:0) @@ -238,20 +238,20 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Nominators (r:0 w:1) // Storage: Staking SpanSlash (r:0 w:1) fn force_unstake(s: u32) -> Weight { - (85_526_000 as Weight) + Weight::from_ref_time(85_526_000 as u64) // Standard Error: 60_000 - .saturating_add((2_232_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))) + .saturating_add(Weight::from_ref_time(2_232_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(8 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Staking UnappliedSlashes (r:1 w:1) fn cancel_deferred_slash(s: u32) -> Weight { - (1_611_610_000 as Weight) + Weight::from_ref_time(1_611_610_000 as u64) // Standard Error: 169_000 - .saturating_add((8_614_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(Weight::from_ref_time(8_614_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -268,13 +268,13 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Identity KeyRecords (r:4 w:0) // Storage: Identity IsDidFrozen (r:1 w:0) fn payout_stakers(n: u32) -> Weight { - (1_802_272_000 as Weight) + Weight::from_ref_time(1_802_272_000 as u64) // Standard Error: 867_000 - .saturating_add((116_865_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))) + .saturating_add(Weight::from_ref_time(116_865_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(15 as u64)) + .saturating_add(DbWeight::get().reads((6 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(4 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(n as u64))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -290,24 +290,24 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:2 w:2) // Storage: Identity KeyRecords (r:3 w:0) fn payout_stakers_alive_controller(n: u32) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 1_074_000 - .saturating_add((134_736_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))) + .saturating_add(Weight::from_ref_time(134_736_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(15 as u64)) + .saturating_add(DbWeight::get().reads((6 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(4 as u64)) + .saturating_add(DbWeight::get().writes((3 as u64).saturating_mul(n as u64))) } // 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 { - (78_101_000 as Weight) + Weight::from_ref_time(78_101_000 as u64) // Standard Error: 2_000 - .saturating_add((1_000 as Weight).saturating_mul(u as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(1_000 as u64).saturating_mul(u as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Staking CurrentEra (r:1 w:0) // Storage: Staking HistoryDepth (r:1 w:1) @@ -319,12 +319,12 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking ErasTotalStake (r:0 w:1) // Storage: Staking ErasStartSessionIndex (r:0 w:1) fn set_history_depth(e: u32) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 762_000 - .saturating_add((49_163_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))) + .saturating_add(Weight::from_ref_time(49_163_000 as u64).saturating_mul(e as u64)) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) + .saturating_add(DbWeight::get().writes((7 as u64).saturating_mul(e as u64))) } // Storage: System Account (r:1 w:1) // Storage: Staking Bonded (r:1 w:1) @@ -336,12 +336,12 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Nominators (r:0 w:1) // Storage: Staking SpanSlash (r:0 w:1) fn reap_stash(s: u32) -> Weight { - (86_714_000 as Weight) + Weight::from_ref_time(86_714_000 as u64) // Standard Error: 72_000 - .saturating_add((2_368_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))) + .saturating_add(Weight::from_ref_time(2_368_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(8 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(s as u64))) } // Storage: Staking CurrentEra (r:1 w:1) // Storage: Staking HistoryDepth (r:1 w:0) @@ -371,16 +371,16 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking EraElectionStatus (r:0 w:1) // Storage: Staking SnapshotNominators (r:0 w:1) fn new_era(v: u32, n: u32) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 24_540_000 - .saturating_add((619_606_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(Weight::from_ref_time(619_606_000 as u64).saturating_mul(v as u64)) // Standard Error: 1_233_000 - .saturating_add((122_105_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))) + .saturating_add(Weight::from_ref_time(122_105_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(11 as u64)) + .saturating_add(DbWeight::get().reads((8 as u64).saturating_mul(v as u64))) + .saturating_add(DbWeight::get().reads((6 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(8 as u64)) + .saturating_add(DbWeight::get().writes((3 as u64).saturating_mul(v as u64))) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -396,28 +396,28 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Balances Locks (r:101 w:101) // Storage: Identity KeyRecords (r:102 w:0) fn payout_all(v: u32, n: u32) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 312_039_000 - .saturating_add((4_884_874_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(Weight::from_ref_time(4_884_874_000 as u64).saturating_mul(v as u64)) // Standard Error: 15_678_000 - .saturating_add((527_158_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))) + .saturating_add(Weight::from_ref_time(527_158_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(7 as u64)) + .saturating_add(DbWeight::get().reads((8 as u64).saturating_mul(v as u64))) + .saturating_add(DbWeight::get().reads((6 as u64).saturating_mul(n as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((3 as u64).saturating_mul(v as u64))) + .saturating_add(DbWeight::get().writes((3 as u64).saturating_mul(n as u64))) } // 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) fn do_slash(l: u32) -> Weight { - (97_397_000 as Weight) + Weight::from_ref_time(97_397_000 as u64) // Standard Error: 242_000 - .saturating_add((712_000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) + .saturating_add(Weight::from_ref_time(712_000 as u64).saturating_mul(l as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } // Storage: Staking EraElectionStatus (r:1 w:0) // Storage: Staking CurrentEra (r:1 w:0) @@ -432,42 +432,42 @@ impl pallet_staking::WeightInfo for WeightInfo { // 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) + Weight::from_ref_time(0 as u64) // Standard Error: 315_000 - .saturating_add((1_422_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(Weight::from_ref_time(1_422_000 as u64).saturating_mul(v as u64)) // Standard Error: 315_000 - .saturating_add((698_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(Weight::from_ref_time(698_000 as u64).saturating_mul(n as u64)) // Standard Error: 1_053_000 - .saturating_add((88_161_000 as Weight).saturating_mul(a as Weight)) + .saturating_add(Weight::from_ref_time(88_161_000 as u64).saturating_mul(a as u64)) // Standard Error: 3_953_000 - .saturating_add((8_812_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)) + .saturating_add(Weight::from_ref_time(8_812_000 as u64).saturating_mul(w as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().reads((4 as u64).saturating_mul(a as u64))) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(w as u64))) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Staking SlashingAllowedFor (r:0 w:1) fn change_slashing_allowed_for() -> Weight { - (23_375_000 as Weight).saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(23_375_000 as u64).saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking ValidatorCount (r:1 w:0) // Storage: Staking PermissionedIdentity (r:1 w:1) fn update_permissioned_validator_intended_count() -> Weight { - (26_164_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(26_164_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking ValidatorCount (r:1 w:1) fn increase_validator_count() -> Weight { - (8_676_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(8_676_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking ValidatorCount (r:1 w:1) fn scale_validator_count() -> Weight { - (9_012_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + Weight::from_ref_time(9_012_000 as u64) + .saturating_add(DbWeight::get().reads(1 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Staking EraElectionStatus (r:1 w:0) @@ -477,12 +477,12 @@ impl pallet_staking::WeightInfo for WeightInfo { // Storage: Staking Validators (r:1 w:1) // Storage: Staking Nominators (r:0 w:1) fn chill_from_governance(s: u32) -> Weight { - (5_655_000 as Weight) + Weight::from_ref_time(5_655_000 as u64) // Standard Error: 108_000 - .saturating_add((15_307_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(3 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))) + .saturating_add(Weight::from_ref_time(15_307_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(3 as u64)) + .saturating_add(DbWeight::get().reads((2 as u64).saturating_mul(s as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(s as u64))) } } diff --git a/pallets/weights/src/pallet_statistics.rs b/pallets/weights/src/pallet_statistics.rs index bb631a957e..43ab6c01f3 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (87_657_000 as Weight) - // Standard Error: 4_000 - .saturating_add((164_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: 47_658 nanoseconds. + Weight::from_ref_time(50_740_646 as u64) + // Standard Error: 1_632 + .saturating_add(Weight::from_ref_time(77_580 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (184_291_000 as Weight) - // Standard Error: 116_000 - .saturating_add((4_733_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: 106_186 nanoseconds. + Weight::from_ref_time(92_108_510 as u64) + // Standard Error: 19_748 + .saturating_add(Weight::from_ref_time(2_568_796 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } // 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_311_268_000 as Weight) - // Standard Error: 1_316_000 - .saturating_add((97_923_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: 101_076 nanoseconds. + Weight::from_ref_time(2_023_982_477 as u64) + // Standard Error: 365_652 + .saturating_add(Weight::from_ref_time(38_259_408 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (107_410_000 as Weight) - // Standard Error: 46_000 - .saturating_add((3_624_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: 40_665 nanoseconds. + Weight::from_ref_time(32_112_134 as u64) + // Standard Error: 20_346 + .saturating_add(Weight::from_ref_time(2_397_737 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(i as u64))) } } diff --git a/pallets/weights/src/pallet_sto.rs b/pallets/weights/src/pallet_sto.rs index 936151bd97..d3e2ac0361 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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) @@ -60,43 +61,45 @@ impl pallet_sto::WeightInfo for WeightInfo { // Storage: Portfolio PortfolioCustodian (r:1 w:0) // Storage: Timestamp Now (r:1 w:0) // Storage: Sto FundraiserCount (r:1 w:1) + // Storage: Asset Tokens (r:1 w:0) // Storage: Portfolio PortfolioAssetBalances (r:1 w:0) // Storage: Portfolio PortfolioLockedAssets (r:1 w:1) // Storage: Sto FundraiserNames (r:0 w:1) // Storage: Sto Fundraisers (r:0 w:1) + /// The range of component `i` is `[1, 10]`. fn create_fundraiser(i: u32) -> Weight { - (122_668_000 as Weight) - // Standard Error: 1_610_000 - .saturating_add((4_429_000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) + // Minimum execution time: 80_048 nanoseconds. + Weight::from_ref_time(84_704_248 as u64) + // Standard Error: 40_142 + .saturating_add(Weight::from_ref_time(44_496 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(11 as u64)) + .saturating_add(DbWeight::get().writes(4 as u64)) } // 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) // Storage: Settlement InstructionCounter (r:1 w:1) // Storage: Settlement InstructionLegs (r:3 w:2) + // Storage: Asset Tokens (r:2 w:0) // Storage: Portfolio PortfolioAssetBalances (r:4 w:4) // Storage: Asset Frozen (r:2 w:0) // Storage: Asset DisableInvestorUniqueness (r:2 w:0) // Storage: Identity Claims (r:54 w:0) // Storage: Asset ScopeIdOf (r:4 w:0) - // Storage: Asset Tokens (r:2 w:0) // Storage: Asset AggregateBalance (r:4 w:4) // Storage: Statistics AssetTransferCompliances (r:2 w:0) - // Storage: Statistics AssetStats (r:2 w:1) + // Storage: Statistics AssetStats (r:2 w:2) // Storage: Statistics TransferConditionExemptEntities (r:2 w:0) // Storage: ComplianceManager AssetCompliances (r:2 w:0) // Storage: Asset BalanceOf (r:4 w:4) // Storage: Checkpoint Schedules (r:2 w:0) // Storage: Checkpoint CheckpointIdSequence (r:2 w:0) - // Storage: Portfolio PortfolioAssetCount (r:1 w:1) - // Storage: Statistics ActiveAssetStats (r:1 w:0) + // Storage: Portfolio PortfolioAssetCount (r:2 w:2) + // Storage: Statistics ActiveAssetStats (r:2 w:0) // Storage: Settlement UserAffirmations (r:0 w:2) // Storage: Settlement InstructionAffirmsPending (r:0 w:1) // Storage: Settlement InstructionDetails (r:0 w:1) @@ -105,9 +108,10 @@ impl pallet_sto::WeightInfo for WeightInfo { // Storage: Settlement InstructionLegStatus (r:0 w:2) // Storage: Asset BalanceOfAtScope (r:0 w:2) fn invest() -> Weight { - (2_215_912_000 as Weight) - .saturating_add(DbWeight::get().reads(105 as Weight)) - .saturating_add(DbWeight::get().writes(32 as Weight)) + // Minimum execution time: 1_112_604 nanoseconds. + Weight::from_ref_time(1_127_803_000 as u64) + .saturating_add(DbWeight::get().reads(106 as u64)) + .saturating_add(DbWeight::get().writes(33 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -115,9 +119,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 { - (90_700_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 53_820 nanoseconds. + Weight::from_ref_time(54_470_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -125,9 +130,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 { - (84_669_000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 52_918 nanoseconds. + Weight::from_ref_time(53_158_000 as u64) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) // Storage: ExternalAgents GroupOfAgent (r:1 w:0) @@ -136,17 +142,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 { - (147_920_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 54_571 nanoseconds. + Weight::from_ref_time(55_272_000 as u64) + .saturating_add(DbWeight::get().reads(6 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 { - (84_482_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + // Minimum execution time: 53_619 nanoseconds. + Weight::from_ref_time(54_761_000 as u64) + .saturating_add(DbWeight::get().reads(4 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } } diff --git a/pallets/weights/src/pallet_test_utils.rs b/pallets/weights/src/pallet_test_utils.rs index 1d81163807..e7e4072a91 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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_435_565_000 as Weight) - // Standard Error: 544_000 - .saturating_add((21_593_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: 584_900 nanoseconds. + Weight::from_ref_time(605_663_194 as u64) + // Standard Error: 41_230 + .saturating_add(Weight::from_ref_time(10_516_276 as u64).saturating_mul(i as u64)) + .saturating_add(DbWeight::get().reads(8 as u64)) + .saturating_add(DbWeight::get().reads((1 as u64).saturating_mul(i as u64))) + .saturating_add(DbWeight::get().writes(5 as u64)) + .saturating_add(DbWeight::get().writes((2 as u64).saturating_mul(i as u64))) } // 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_371_475_000 as Weight) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) + // Minimum execution time: 596_933 nanoseconds. + Weight::from_ref_time(599_377_000 as u64) + .saturating_add(DbWeight::get().reads(10 as u64)) + .saturating_add(DbWeight::get().writes(5 as u64)) } // Storage: Identity KeyRecords (r:1 w:0) fn get_my_did() -> Weight { - (37_063_000 as Weight).saturating_add(DbWeight::get().reads(1 as Weight)) + // Minimum execution time: 26_449 nanoseconds. + Weight::from_ref_time(28_002_000 as u64).saturating_add(DbWeight::get().reads(1 as u64)) } // 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 { - (83_854_000 as Weight).saturating_add(DbWeight::get().reads(6 as Weight)) + // Minimum execution time: 48_580 nanoseconds. + Weight::from_ref_time(49_060_000 as u64).saturating_add(DbWeight::get().reads(6 as u64)) } } diff --git a/pallets/weights/src/pallet_timestamp.rs b/pallets/weights/src/pallet_timestamp.rs index 5217163e8f..cd675f2f95 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: 2022-06-22, STEPS: `100`, REPEAT: 5, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-01-18, 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 { - (24_959_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) + // Minimum execution time: 13_254 nanoseconds. + Weight::from_ref_time(13_746_000 as u64) + .saturating_add(DbWeight::get().reads(2 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } fn on_finalize() -> Weight { - (10_557_000 as Weight) + // Minimum execution time: 5_610 nanoseconds. + Weight::from_ref_time(5_810_000 as u64) } } diff --git a/pallets/weights/src/pallet_treasury.rs b/pallets/weights/src/pallet_treasury.rs index 201f928ce5..0e0c9c73f8 100644 --- a/pallets/weights/src/pallet_treasury.rs +++ b/pallets/weights/src/pallet_treasury.rs @@ -50,8 +50,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) @@ -60,13 +60,13 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn disbursement(b: u32) -> Weight { - (76_508_000 as Weight) + Weight::from_ref_time(76_508_000 as u64) // Standard Error: 651_000 - .saturating_add((80_111_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))) + .saturating_add(Weight::from_ref_time(80_111_000 as u64).saturating_mul(b as u64)) + .saturating_add(DbWeight::get().reads(5 as u64)) + .saturating_add(DbWeight::get().reads((5 as u64).saturating_mul(b as u64))) + .saturating_add(DbWeight::get().writes(1 as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(b as u64))) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: Timestamp Now (r:1 w:0) @@ -75,8 +75,8 @@ impl pallet_treasury::WeightInfo for WeightInfo { // Storage: Identity Claims (r:2 w:0) // Storage: System Account (r:2 w:2) fn reimbursement() -> Weight { - (113_304_000 as Weight) - .saturating_add(DbWeight::get().reads(9 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(113_304_000 as u64) + .saturating_add(DbWeight::get().reads(9 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } } diff --git a/pallets/weights/src/pallet_utility.rs b/pallets/weights/src/pallet_utility.rs index 88405b5cc6..ed4d3b2e17 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 as u64) // 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 as u64) // 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 as u64)) + .saturating_add(DbWeight::get().writes(1 as u64)) } // 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 as u64) // 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 as u64) .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 as u64)) + .saturating_add(DbWeight::get().writes(3 as u64)) } } diff --git a/pallets/weights/src/polymesh_contracts.rs b/pallets/weights/src/polymesh_contracts.rs index c15715ee27..b0774c331b 100644 --- a/pallets/weights/src/polymesh_contracts.rs +++ b/pallets/weights/src/polymesh_contracts.rs @@ -50,8 +50,8 @@ 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) @@ -65,13 +65,13 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: unknown [0x00] (r:1 w:0) // Storage: unknown [0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f] (r:1 w:0) fn chain_extension_read_storage(k: u32, v: u32) -> Weight { - (616_785_000 as Weight) + Weight::from_ref_time(616_785_000 as u64) // Standard Error: 3_000 - .saturating_add((8_000 as Weight).saturating_mul(k as Weight)) + .saturating_add(Weight::from_ref_time(8_000 as u64).saturating_mul(k as u64)) // Standard Error: 2_000 - .saturating_add((2_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(v as u64)) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -84,11 +84,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_get_version(r: u32) -> Weight { - (363_157_000 as Weight) + Weight::from_ref_time(363_157_000 as u64) // Standard Error: 20_038_000 - .saturating_add((224_003_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(224_003_000 as u64).saturating_mul(r as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:3 w:0) // Storage: System Account (r:1 w:0) @@ -101,11 +101,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_get_key_did(r: u32) -> Weight { - (616_219_000 as Weight) + Weight::from_ref_time(616_219_000 as u64) // Standard Error: 11_686_000 - .saturating_add((554_712_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(13 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(554_712_000 as u64).saturating_mul(r as u64)) + .saturating_add(DbWeight::get().reads(13 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -118,11 +118,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_hash_twox_64(r: u32) -> Weight { - (302_444_000 as Weight) + Weight::from_ref_time(302_444_000 as u64) // Standard Error: 6_140_000 - .saturating_add((261_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)) + .saturating_add(Weight::from_ref_time(261_925_000 as u64).saturating_mul(r as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -135,11 +135,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_hash_twox_64_per_kb(n: u32) -> Weight { - (960_492_000 as Weight) + Weight::from_ref_time(960_492_000 as u64) // Standard Error: 204_000 - .saturating_add((73_699_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(73_699_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -152,11 +152,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_hash_twox_128(r: u32) -> Weight { - (611_259_000 as Weight) + Weight::from_ref_time(611_259_000 as u64) // Standard Error: 9_446_000 - .saturating_add((269_304_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(269_304_000 as u64).saturating_mul(r as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -169,11 +169,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_hash_twox_128_per_kb(n: u32) -> Weight { - (972_907_000 as Weight) + Weight::from_ref_time(972_907_000 as u64) // Standard Error: 258_000 - .saturating_add((83_521_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(83_521_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -186,11 +186,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_hash_twox_256(r: u32) -> Weight { - (705_382_000 as Weight) + Weight::from_ref_time(705_382_000 as u64) // Standard Error: 723_000 - .saturating_add((255_173_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(255_173_000 as u64).saturating_mul(r as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -203,11 +203,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn chain_extension_hash_twox_256_per_kb(n: u32) -> Weight { - (975_225_000 as Weight) + Weight::from_ref_time(975_225_000 as u64) // Standard Error: 327_000 - .saturating_add((102_619_000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + .saturating_add(Weight::from_ref_time(102_619_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -225,11 +225,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Permissions CurrentPalletName (r:1 w:1) // Storage: Permissions CurrentDispatchableName (r:1 w:1) fn chain_extension_call_runtime(n: u32) -> Weight { - (790_893_000 as Weight) + Weight::from_ref_time(790_893_000 as u64) // Standard Error: 0 - .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)) + .saturating_add(Weight::from_ref_time(4_000 as u64).saturating_mul(n as u64)) + .saturating_add(DbWeight::get().reads(17 as u64)) + .saturating_add(DbWeight::get().writes(6 as u64)) } // Storage: Identity KeyRecords (r:2 w:0) // Storage: System Account (r:1 w:0) @@ -242,12 +242,12 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Instance2Group InactiveMembers (r:1 w:0) // Storage: Identity Claims (r:2 w:0) fn dummy_contract() -> Weight { - (468_460_000 as Weight) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) + Weight::from_ref_time(468_460_000 as u64) + .saturating_add(DbWeight::get().reads(12 as u64)) + .saturating_add(DbWeight::get().writes(2 as u64)) } fn basic_runtime_call(_n: u32) -> Weight { - (1_440_000 as Weight) + Weight::from_ref_time(1_440_000 as u64) } // Storage: Identity KeyRecords (r:2 w:1) // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) @@ -263,11 +263,11 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Contracts OwnerInfoOf (r:1 w:1) // Storage: Identity DidKeys (r:0 w:1) fn instantiate_with_hash_perms(s: u32) -> Weight { - (797_786_000 as Weight) + Weight::from_ref_time(797_786_000 as u64) // Standard Error: 0 - .saturating_add((6_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(15 as Weight)) - .saturating_add(DbWeight::get().writes(9 as Weight)) + .saturating_add(Weight::from_ref_time(6_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(15 as u64)) + .saturating_add(DbWeight::get().writes(9 as u64)) } // Storage: Identity KeyRecords (r:2 w:1) // Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1) @@ -284,19 +284,19 @@ impl polymesh_contracts::WeightInfo for WeightInfo { // Storage: Contracts PristineCode (r:0 w:1) // Storage: Contracts OwnerInfoOf (r:0 w:1) fn instantiate_with_code_perms(c: u32, s: u32) -> Weight { - (693_683_000 as Weight) + Weight::from_ref_time(693_683_000 as u64) // Standard Error: 9_000 - .saturating_add((438_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(Weight::from_ref_time(438_000 as u64).saturating_mul(c as u64)) // Standard Error: 0 - .saturating_add((7_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(14 as Weight)) - .saturating_add(DbWeight::get().writes(10 as Weight)) + .saturating_add(Weight::from_ref_time(7_000 as u64).saturating_mul(s as u64)) + .saturating_add(DbWeight::get().reads(14 as u64)) + .saturating_add(DbWeight::get().writes(10 as u64)) } // Storage: Contracts CallRuntimeWhitelist (r:0 w:200) fn update_call_runtime_whitelist(u: u32) -> Weight { - (0 as Weight) + Weight::from_ref_time(0 as u64) // Standard Error: 403_000 - .saturating_add((2_749_000 as Weight).saturating_mul(u as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(u as Weight))) + .saturating_add(Weight::from_ref_time(2_749_000 as u64).saturating_mul(u as u64)) + .saturating_add(DbWeight::get().writes((1 as u64).saturating_mul(u as u64))) } } 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..d391dfda93 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 = "6.0.0", default_features = false } +sp-rpc = { version = "6.0.0" } +sp-runtime = { version = "6.0.0", default_features = false } +sp-std = {version = "4.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..37850c7ca9 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 = "6.0.0", default-features = false } +sp-std = { version = "4.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..54592c4827 100644 --- a/rpc/src/compliance_manager.rs +++ b/rpc/src/compliance_manager.rs @@ -15,15 +15,19 @@ pub use node_rpc_runtime_api::compliance_manager::ComplianceManagerApi as ComplianceManagerRuntimeApi; +use std::sync::Arc; + 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, ErrorCode, 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 +36,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 +64,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 +78,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( + ErrorCode::ServerError(1).code(), + "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 8245951178..da29e3df7b 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/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 a8e599b5c2..1be9406a6e 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 0fec606e88..88fdf87622 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 @@ -128,7 +127,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 @@ -150,32 +148,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, @@ -183,7 +180,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, > @@ -246,7 +246,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(), )?; @@ -270,11 +270,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()), )?; @@ -286,9 +285,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( @@ -305,6 +301,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(), @@ -326,7 +323,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) @@ -350,10 +347,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. @@ -375,7 +378,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; @@ -410,7 +413,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(), @@ -438,16 +441,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(), })?; @@ -464,9 +468,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 { @@ -488,10 +489,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( @@ -499,13 +500,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()), @@ -604,6 +604,7 @@ where client, network, transaction_pool, + rpc_handlers, }) }