From 012aed2bc8ac16fbce1bb76010059373e95c7376 Mon Sep 17 00:00:00 2001 From: Maksim Ramanenkau Date: Thu, 10 Aug 2023 12:43:39 +0200 Subject: [PATCH] Revert "Merge pull request #59 from Cerebellum-Network/release/4.8.0" This reverts commit 1ccb9218e7b784c02b6f32a97e216932c66179b0, reversing changes made to 76e1c7ebbe9cec64934342002cb8917d6ac60a14. --- .github/workflows/check.yml | 5 - .maintain/frame-weight-template.hbs | 104 -- .vscode/settings.json | 9 - CHANGELOG.md | 21 - Cargo.lock | 1402 +++++++---------- Cargo.toml | 6 +- Dockerfile | 12 +- Dockerfile.tests | 12 +- cli/Cargo.toml | 12 +- cli/src/command.rs | 7 +- node/client/Cargo.toml | 56 +- node/service/Cargo.toml | 69 +- node/service/src/chain_spec.rs | 1 - node/service/src/lib.rs | 25 +- pallets/chainbridge/Cargo.toml | 20 +- pallets/chainbridge/src/lib.rs | 1064 +++++++------ pallets/chainbridge/src/mock.rs | 205 +-- pallets/chainbridge/src/tests.rs | 983 ++++++------ .../ddc-metrics-offchain-worker/Cargo.toml | 26 +- .../ddc-metrics-offchain-worker/src/lib.rs | 1324 ++++++++-------- .../src/tests/mod.rs | 648 ++++---- .../src/tests/test_runtime.rs | 240 ++- pallets/ddc-staking/Cargo.toml | 22 +- pallets/ddc-staking/README.md | 15 - pallets/ddc-staking/src/benchmarking.rs | 3 - pallets/ddc-staking/src/lib.rs | 115 +- pallets/ddc-staking/src/mock.rs | 244 --- pallets/ddc-staking/src/tests.rs | 178 --- pallets/ddc-staking/src/weights.rs | 144 +- pallets/ddc/Cargo.toml | 14 +- pallets/ddc/src/lib.rs | 13 +- pallets/ddc/src/mock.rs | 22 +- pallets/ddc/src/tests.rs | 6 +- pallets/erc20/Cargo.toml | 20 +- pallets/erc20/src/lib.rs | 219 +-- pallets/erc721/Cargo.toml | 18 +- pallets/erc721/src/lib.rs | 197 +-- pallets/erc721/src/mock.rs | 132 +- pallets/erc721/src/tests.rs | 132 +- rpc/Cargo.toml | 48 +- rpc/src/lib.rs | 16 +- runtime/cere-dev/Cargo.toml | 162 +- runtime/cere-dev/constants/Cargo.toml | 6 +- runtime/cere-dev/src/impls.rs | 15 +- runtime/cere-dev/src/lib.rs | 213 ++- runtime/cere/Cargo.toml | 160 +- runtime/cere/constants/Cargo.toml | 6 +- runtime/cere/src/impls.rs | 15 +- runtime/cere/src/lib.rs | 212 ++- runtime/common/Cargo.toml | 10 +- runtime/common/src/lib.rs | 16 +- scripts/init.sh | 2 - scripts/pre-commit.sh | 8 - 53 files changed, 3818 insertions(+), 4816 deletions(-) delete mode 100644 .maintain/frame-weight-template.hbs delete mode 100644 .vscode/settings.json delete mode 100644 pallets/ddc-staking/src/mock.rs delete mode 100644 pallets/ddc-staking/src/tests.rs mode change 100644 => 100755 pallets/ddc-staking/src/weights.rs delete mode 100755 scripts/pre-commit.sh diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4c8a60cc6..d441cd3f0 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -32,11 +32,6 @@ jobs: rustup default stable rustup update nightly rustup update stable - rustup component add rustfmt --toolchain nightly - - - name: Check Format - run: | - cargo +nightly fmt -- --check - name: Check Build run: | diff --git a/.maintain/frame-weight-template.hbs b/.maintain/frame-weight-template.hbs deleted file mode 100644 index e2248b4e2..000000000 --- a/.maintain/frame-weight-template.hbs +++ /dev/null @@ -1,104 +0,0 @@ -//! Autogenerated weights for {{pallet}} -//! -//! 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}}` -//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}` -//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}} - -// Executed Command: -{{#each args as |arg|}} -// {{arg}} -{{/each}} - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for {{pallet}}. -pub trait WeightInfo { - {{#each benchmarks as |benchmark|}} - fn {{benchmark.name~}} - ( - {{~#each benchmark.components as |c| ~}} - {{c.name}}: u32, {{/each~}} - ) -> Weight; - {{/each}} -} - -/// Weights for {{pallet}} using the Substrate node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -{{#if (eq pallet "frame_system")}} -impl WeightInfo for SubstrateWeight { -{{else}} -impl WeightInfo for SubstrateWeight { -{{/if}} - {{#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 { - Weight::from_ref_time({{underscore benchmark.base_weight}} as u64) - {{#each benchmark.component_weight as |cw|}} - // Standard Error: {{underscore cw.error}} - .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(T::DbWeight::get().reads({{benchmark.base_reads}} as u64)) - {{/if}} - {{#each benchmark.component_reads as |cr|}} - .saturating_add(T::DbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64))) - {{/each}} - {{#if (ne benchmark.base_writes "0")}} - .saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as u64)) - {{/if}} - {{#each benchmark.component_writes as |cw|}} - .saturating_add(T::DbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64))) - {{/each}} - } - {{/each}} -} - -// For backwards compatibility and tests -impl WeightInfo for () { - {{#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 { - Weight::from_ref_time({{underscore benchmark.base_weight}} as u64) - {{#each benchmark.component_weight as |cw|}} - // Standard Error: {{underscore cw.error}} - .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(RocksDbWeight::get().reads({{benchmark.base_reads}} as u64)) - {{/if}} - {{#each benchmark.component_reads as |cr|}} - .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64))) - {{/each}} - {{#if (ne benchmark.base_writes "0")}} - .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as u64)) - {{/if}} - {{#each benchmark.component_writes as |cw|}} - .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64))) - {{/each}} - } - {{/each}} -} diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 003fc3624..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "[rust]": { - "editor.defaultFormatter": "rust-lang.rust-analyzer", - "editor.formatOnSave": true - }, - "rust-analyzer.rustfmt.extraArgs": [ - "+nightly" - ] -} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9122f8269..9b0e24e03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,33 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## Legend - -[C] Cere Runtime -[D] Cere Dev Runtime - ## [vNext] -### Added - -- ... - ### Changed - ... -## [4.8.0] - -### Added - -- [D] Handlebars template to generate weights file -- [D] Genesis config for `pallet-ddc-staking` to set genesis DDC participants (empty by default) and staking settings -- [D] Unit tests in `pallet-ddc-staking` for basic staking scenario - -### Changed - -- [C,D] Updated Substrate to polkadot-v0.9.30 - ## [4.7.0] ### Changed diff --git a/Cargo.lock b/Cargo.lock index 8b70b378c..3d4c9b4ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,9 +23,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.20.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ "gimli 0.27.3", ] @@ -168,12 +168,6 @@ 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.7" @@ -209,9 +203,9 @@ checksum = "155a5a185e42c6b77ac7b88a15143d930a9e9727a5b7b77eed417404ab15c247" [[package]] name = "async-channel" -version = "1.9.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" dependencies = [ "concurrent-queue", "event-listener", @@ -261,7 +255,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.23", + "rustix 0.37.20", "slab", "socket2 0.4.9", "waker-fn", @@ -289,7 +283,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 0.37.23", + "rustix 0.37.20", "signal-hook", "windows-sys 0.48.0", ] @@ -315,7 +309,7 @@ dependencies = [ "log", "memchr", "once_cell", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "pin-utils", "slab", "wasm-bindgen-futures", @@ -344,13 +338,13 @@ checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -363,7 +357,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", ] [[package]] @@ -391,16 +385,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ - "addr2line 0.20.0", + "addr2line 0.19.0", "cc", "cfg-if", "libc", - "miniz_oxide", - "object 0.31.1", + "miniz_oxide 0.6.2", + "object 0.30.4", "rustc-demangle", ] @@ -434,12 +428,6 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - [[package]] name = "beef" version = "0.5.2" @@ -470,19 +458,19 @@ version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cexpr", "clang-sys", "lazy_static", "lazycell", "peeking_take_while", - "prettyplease 0.2.10", + "prettyplease", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -491,12 +479,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitflags" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" - [[package]] name = "bitvec" version = "1.0.1" @@ -552,15 +534,15 @@ dependencies = [ [[package]] name = "blake3" -version = "1.4.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq 0.3.0", + "constant_time_eq 0.2.6", ] [[package]] @@ -625,9 +607,9 @@ checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" [[package]] name = "bstr" -version = "1.6.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "a246e68bb43f6cd9db24bea052a53e40405417c5fb372e3d1a8a7f770a564ef5" dependencies = [ "memchr", "serde", @@ -711,7 +693,7 @@ dependencies = [ "cargo-platform", "semver 1.0.17", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", ] [[package]] @@ -725,7 +707,7 @@ dependencies = [ [[package]] name = "cere" -version = "4.8.0" +version = "4.7.0" dependencies = [ "cere-cli", "sc-cli", @@ -735,7 +717,7 @@ dependencies = [ [[package]] name = "cere-cli" -version = "4.8.0" +version = "4.7.0" dependencies = [ "cere-client", "cere-service", @@ -749,7 +731,7 @@ dependencies = [ [[package]] name = "cere-client" -version = "4.8.0" +version = "4.7.0" dependencies = [ "cere-dev-runtime", "cere-runtime", @@ -784,7 +766,7 @@ dependencies = [ [[package]] name = "cere-dev-runtime" -version = "4.8.0" +version = "4.7.0" dependencies = [ "cere-dev-runtime-constants", "cere-runtime-common", @@ -820,7 +802,6 @@ dependencies = [ "pallet-elections-phragmen", "pallet-erc20", "pallet-erc721", - "pallet-fast-unstake", "pallet-grandpa", "pallet-identity", "pallet-im-online", @@ -872,7 +853,7 @@ dependencies = [ [[package]] name = "cere-dev-runtime-constants" -version = "4.8.0" +version = "4.7.0" dependencies = [ "node-primitives", "sp-runtime", @@ -880,7 +861,7 @@ dependencies = [ [[package]] name = "cere-rpc" -version = "4.8.0" +version = "4.7.0" dependencies = [ "jsonrpsee", "node-primitives", @@ -910,7 +891,7 @@ dependencies = [ [[package]] name = "cere-runtime" -version = "4.8.0" +version = "4.7.0" dependencies = [ "cere-runtime-common", "cere-runtime-constants", @@ -945,7 +926,6 @@ dependencies = [ "pallet-elections-phragmen", "pallet-erc20", "pallet-erc721", - "pallet-fast-unstake", "pallet-grandpa", "pallet-identity", "pallet-im-online", @@ -997,7 +977,7 @@ dependencies = [ [[package]] name = "cere-runtime-common" -version = "4.8.0" +version = "4.7.0" dependencies = [ "frame-support", "node-primitives", @@ -1007,7 +987,7 @@ dependencies = [ [[package]] name = "cere-runtime-constants" -version = "4.8.0" +version = "4.7.0" dependencies = [ "node-primitives", "sp-runtime", @@ -1015,7 +995,7 @@ dependencies = [ [[package]] name = "cere-service" -version = "4.8.0" +version = "4.7.0" dependencies = [ "cere-client", "cere-dev-runtime", @@ -1087,12 +1067,6 @@ 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" @@ -1183,7 +1157,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags 1.3.2", + "bitflags", "clap_derive", "clap_lex", "indexmap", @@ -1262,12 +1236,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - [[package]] name = "core-foundation" version = "0.9.3" @@ -1304,30 +1272,28 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] [[package]] name = "cranelift-bforest" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52056f6d0584484b57fa6c1a65c1fcb15f3780d8b6a758426d9e3084169b2ddd" +checksum = "749d0d6022c9038dccf480bdde2a38d435937335bf2bb0f14e815d94517cdce8" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fed94c8770dc25d01154c3ffa64ed0b3ba9d583736f305fed7beebe5d9cf74" +checksum = "e94370cc7b37bf652ccd8bb8f09bd900997f7ccf97520edfc75554bb5c4abbea" dependencies = [ - "arrayvec 0.7.4", - "bumpalo", "cranelift-bforest", "cranelift-codegen-meta", "cranelift-codegen-shared", @@ -1342,33 +1308,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c451b81faf237d11c7e4f3165eeb6bac61112762c5cfe7b4c0fb7241474358f" +checksum = "e0a3cea8fdab90e44018c5b9a1dfd460d8ee265ac354337150222a354628bdb6" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c940133198426d26128f08be2b40b0bd117b84771fd36798969c4d712d81fc" +checksum = "5ac72f76f2698598951ab26d8c96eaa854810e693e7dd52523958b5909fde6b2" [[package]] name = "cranelift-entity" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87a0f1b2fdc18776956370cf8d9b009ded3f855350c480c1c52142510961f352" +checksum = "09eaeacfcd2356fe0e66b295e8f9d59fdd1ac3ace53ba50de14d628ec902f72d" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34897538b36b216cc8dd324e73263596d51b8cf610da6498322838b2546baf8a" +checksum = "dba69c9980d5ffd62c18a2bde927855fcd7c8dc92f29feaf8636052662cbd99c" dependencies = [ "cranelift-codegen", "log", @@ -1378,15 +1344,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2629a569fae540f16a76b70afcc87ad7decb38dc28fa6c648ac73b51e78470" +checksum = "d2920dc1e05cac40304456ed3301fde2c09bd6a9b0210bcfa2f101398d628d5b" [[package]] name = "cranelift-native" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20937dab4e14d3e225c5adfc9c7106bafd4ac669bdb43027b911ff794c6fb318" +checksum = "f04dfa45f9b2a6f587c564d6b63388e00cd6589d2df6ea2758cf79e1a13285e6" dependencies = [ "cranelift-codegen", "libc", @@ -1395,9 +1361,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.88.2" +version = "0.85.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80fc2288957a94fd342a015811479de1837850924166d1f1856d8406e6f3609b" +checksum = "31a46513ae6f26f3f267d8d75b5373d555fbbd1e68681f348d99df43f747ec54" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1719,9 +1685,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.8" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "519b83cd10f5f6e969625a409f735182bea5558cd8b64c655806ceaae36f1999" +checksum = "65d09067bfacaa79114679b279d7f5885b53295b1e2cfb4e79c8e4bd3d633169" [[package]] name = "dyn-clonable" @@ -1792,7 +1758,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek 3.2.0", - "hashbrown", + "hashbrown 0.12.3", "hex", "rand_core 0.6.4", "sha2 0.9.9", @@ -1852,7 +1818,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -2044,7 +2010,7 @@ checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "libz-sys", - "miniz_oxide", + "miniz_oxide 0.7.1", ] [[package]] @@ -2056,7 +2022,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", ] @@ -2073,7 +2039,7 @@ dependencies = [ [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -2096,10 +2062,9 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "Inflector", - "array-bytes", "chrono", "clap", "comfy-table", @@ -2109,6 +2074,7 @@ dependencies = [ "gethostname", "handlebars", "hash-db", + "hex", "itertools", "kvdb", "lazy_static", @@ -2126,7 +2092,7 @@ dependencies = [ "sc-service", "sc-sysinfo", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "serde_nanos", "sp-api", "sp-blockchain", @@ -2147,7 +2113,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2158,7 +2124,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -2174,7 +2140,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -2203,9 +2169,9 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "bitflags 1.3.2", + "bitflags", "frame-metadata", "frame-support-procedural", "impl-trait-for-tuples", @@ -2228,14 +2194,13 @@ 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/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "Inflector", "cfg-expr", @@ -2249,7 +2214,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -2261,7 +2226,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -2271,7 +2236,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "log", @@ -2283,13 +2248,12 @@ dependencies = [ "sp-runtime", "sp-std", "sp-version", - "sp-weights", ] [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -2304,7 +2268,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "sp-api", @@ -2313,7 +2277,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "parity-scale-codec", @@ -2416,7 +2380,7 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "waker-fn", ] @@ -2428,7 +2392,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -2473,7 +2437,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "pin-utils", "slab", ] @@ -2638,7 +2602,7 @@ dependencies = [ "pest", "pest_derive", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "thiserror", ] @@ -2657,6 +2621,15 @@ dependencies = [ "crunchy", ] +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -2683,9 +2656,18 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "hex" @@ -2755,7 +2737,7 @@ checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", - "itoa 1.0.8", + "itoa 1.0.6", ] [[package]] @@ -2766,7 +2748,7 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", ] [[package]] @@ -2802,8 +2784,8 @@ dependencies = [ "http-body", "httparse", "httpdate", - "itoa 1.0.8", - "pin-project-lite 0.2.10", + "itoa 1.0.6", + "pin-project-lite 0.2.9", "socket2 0.4.9", "tokio", "tower-service", @@ -2934,7 +2916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -2965,6 +2947,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "io-lifetimes" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" + [[package]] name = "io-lifetimes" version = "0.7.5" @@ -2977,7 +2965,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.3.1", "libc", "windows-sys 0.48.0", ] @@ -3008,12 +2996,13 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ - "hermit-abi 0.3.2", - "rustix 0.38.3", + "hermit-abi 0.3.1", + "io-lifetimes 1.0.11", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -3034,9 +3023,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jobserver" @@ -3115,7 +3104,7 @@ dependencies = [ "rand 0.8.5", "rustc-hash", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "soketto", "thiserror", "tokio", @@ -3136,7 +3125,7 @@ dependencies = [ "jsonrpsee-core", "jsonrpsee-types", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "tokio", "tracing", "tracing-futures", @@ -3163,7 +3152,7 @@ dependencies = [ "anyhow", "beef", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "thiserror", "tracing", ] @@ -3191,7 +3180,7 @@ dependencies = [ "http", "jsonrpsee-core", "jsonrpsee-types", - "serde_json 1.0.100", + "serde_json 1.0.99", "soketto", "tokio", "tokio-stream", @@ -3377,8 +3366,8 @@ dependencies = [ "libp2p-request-response", "libp2p-swarm", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", ] @@ -3404,8 +3393,8 @@ dependencies = [ "multistream-select", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", "ring", "rw-stream-sink", @@ -3455,8 +3444,8 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.7.3", "smallvec", ] @@ -3479,8 +3468,8 @@ dependencies = [ "libp2p-swarm", "log", "prometheus-client", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.7.3", "regex", "sha2 0.10.7", @@ -3502,8 +3491,8 @@ dependencies = [ "libp2p-swarm", "log", "lru", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "prost-codec", "smallvec", "thiserror", @@ -3527,8 +3516,8 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.7.3", "sha2 0.10.7", "smallvec", @@ -3605,8 +3594,8 @@ dependencies = [ "lazy_static", "libp2p-core", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", "sha2 0.10.7", "snow", @@ -3642,8 +3631,8 @@ dependencies = [ "futures", "libp2p-core", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "unsigned-varint", "void", ] @@ -3678,8 +3667,8 @@ dependencies = [ "libp2p-swarm", "log", "pin-project", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "prost-codec", "rand 0.8.5", "smallvec", @@ -3702,8 +3691,8 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.8.5", "sha2 0.10.7", "thiserror", @@ -3935,21 +3924,21 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.0.46" +version = "0.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" +checksum = "5284f00d480e1c39af34e72f8ad60b94f47007e3481cd3b731c1d67190ddc7b7" [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lite-json" @@ -3994,7 +3983,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -4047,7 +4036,7 @@ version = "0.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] @@ -4074,11 +4063,11 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memfd" -version = "0.6.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" +checksum = "f6627dc657574b49d6ad27105ed671822be56e0d2547d413bfbf3e8d8fa92e7a" dependencies = [ - "rustix 0.37.23", + "libc", ] [[package]] @@ -4115,15 +4104,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6566c70c1016f525ced45d7b7f97730a2bafb037c788211d0c186ef5b2189f0a" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "parity-util-mem", ] [[package]] name = "memory_units" -version = "0.4.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" +checksum = "71d96e3f3c0b6325d8ccd83c33b28acb183edcb6c67938ba104ec546854b0882" [[package]] name = "merlin" @@ -4143,6 +4132,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +dependencies = [ + "adler", +] + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -4163,6 +4161,12 @@ dependencies = [ "windows-sys 0.48.0", ] +[[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" @@ -4300,7 +4304,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" dependencies = [ "anyhow", - "bitflags 1.3.2", + "bitflags", "byteorder", "libc", "netlink-packet-core", @@ -4353,7 +4357,7 @@ version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cfg-if", "libc", ] @@ -4361,7 +4365,7 @@ dependencies = [ [[package]] name = "node-primitives" version = "2.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-system", "parity-scale-codec", @@ -4404,17 +4408,6 @@ 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.3" @@ -4431,7 +4424,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a652d9771a63711fd3c3deb670acfbe5c30a4072e664d7a3bf5a9e1056ac72c3" dependencies = [ "arrayvec 0.7.4", - "itoa 1.0.8", + "itoa 1.0.6", ] [[package]] @@ -4451,7 +4444,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" dependencies = [ "autocfg", - "num-bigint 0.2.6", + "num-bigint", "num-integer", "num-traits", ] @@ -4463,7 +4456,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint 0.4.3", "num-integer", "num-traits", ] @@ -4480,31 +4472,31 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.16.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi 0.2.6", "libc", ] [[package]] name = "object" -version = "0.29.0" +version = "0.28.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" dependencies = [ "crc32fast", - "hashbrown", + "hashbrown 0.11.2", "indexmap", "memchr", ] [[package]] name = "object" -version = "0.31.1" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "memchr", ] @@ -4570,7 +4562,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -4586,7 +4578,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -4601,7 +4593,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -4625,7 +4617,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4645,7 +4637,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -4660,7 +4652,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -4677,7 +4669,7 @@ dependencies = [ [[package]] name = "pallet-cere-ddc" -version = "4.8.0" +version = "4.7.0" dependencies = [ "frame-support", "frame-system", @@ -4692,7 +4684,7 @@ dependencies = [ [[package]] name = "pallet-chainbridge" -version = "4.8.0" +version = "4.7.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -4711,7 +4703,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -4730,7 +4722,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -4747,9 +4739,9 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "bitflags 1.3.2", + "bitflags", "frame-benchmarking", "frame-support", "frame-system", @@ -4775,9 +4767,9 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "bitflags 1.3.2", + "bitflags", "parity-scale-codec", "scale-info", "serde", @@ -4790,7 +4782,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -4800,7 +4792,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "jsonrpsee", "pallet-contracts-primitives", @@ -4817,7 +4809,7 @@ dependencies = [ [[package]] name = "pallet-contracts-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "pallet-contracts-primitives", "parity-scale-codec", @@ -4829,7 +4821,7 @@ dependencies = [ [[package]] name = "pallet-ddc-metrics-offchain-worker" -version = "4.8.0" +version = "4.7.0" dependencies = [ "alt_serde", "frame-support", @@ -4855,28 +4847,24 @@ dependencies = [ [[package]] name = "pallet-ddc-staking" -version = "4.8.0" +version = "4.7.0" dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "pallet-balances", - "pallet-timestamp", "parity-scale-codec", "scale-info", - "sp-core", "sp-io", "sp-runtime", "sp-staking", "sp-std", - "sp-tracing", "substrate-test-utils", ] [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -4892,14 +4880,13 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", "frame-support", "frame-system", "log", - "pallet-election-provider-support-benchmarking", "parity-scale-codec", "rand 0.7.3", "scale-info", @@ -4916,7 +4903,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -4929,7 +4916,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -4946,7 +4933,7 @@ dependencies = [ [[package]] name = "pallet-erc20" -version = "4.8.0" +version = "4.7.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -4966,7 +4953,7 @@ dependencies = [ [[package]] name = "pallet-erc721" -version = "4.8.0" +version = "4.7.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -4982,31 +4969,10 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-fast-unstake" -version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "frame-benchmarking", - "frame-election-provider-support", - "frame-support", - "frame-system", - "log", - "pallet-balances", - "pallet-staking", - "pallet-timestamp", - "parity-scale-codec", - "scale-info", - "sp-io", - "sp-runtime", - "sp-staking", - "sp-std", -] - [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5029,7 +4995,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "enumflags2", "frame-benchmarking", @@ -5045,7 +5011,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5065,7 +5031,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5082,7 +5048,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5099,7 +5065,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5114,7 +5080,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5131,7 +5097,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5143,7 +5109,6 @@ dependencies = [ "parity-scale-codec", "scale-info", "sp-runtime", - "sp-runtime-interface", "sp-staking", "sp-std", ] @@ -5151,7 +5116,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "sp-api", @@ -5161,7 +5126,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5178,7 +5143,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5201,7 +5166,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5216,7 +5181,7 @@ dependencies = [ [[package]] name = "pallet-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5230,7 +5195,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5245,7 +5210,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5261,7 +5226,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5282,7 +5247,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5298,7 +5263,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5312,7 +5277,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -5335,7 +5300,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5346,7 +5311,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5360,7 +5325,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5378,7 +5343,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5397,7 +5362,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5413,7 +5378,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -5428,7 +5393,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -5439,7 +5404,7 @@ dependencies = [ [[package]] name = "pallet-transaction-storage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-support", "frame-system", @@ -5457,7 +5422,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5474,7 +5439,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5490,7 +5455,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-benchmarking", "frame-support", @@ -5523,9 +5488,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.3" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756d439303e94fae44f288ba881ad29670c65b0c4b0e05674ca81061bb65f2c5" +checksum = "2287753623c76f953acd29d15d8100bcab84d29db78fb6f352adb3c53e83b967" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -5538,9 +5503,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.3" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d884d78fcf214d70b1e239fcd1c6e5e95aa3be1881918da2e488cc946c7a476" +checksum = "2b6937b5e67bfba3351b87b040d48352a2fcb6ad72f81855412ce97b45c8f110" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5561,7 +5526,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c32561d248d352148124f036cac253a644685a21dc9fea383eb4907d7bd35a8f" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.12.3", "impl-trait-for-tuples", "parity-util-mem-derive", "parking_lot 0.12.1", @@ -5592,9 +5557,9 @@ dependencies = [ [[package]] name = "parity-wasm" -version = "0.45.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1ad0aff30c1da14b1254fcb2af73e1fa9a28670e584a626f53a369d0e157304" +checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "parking" @@ -5652,9 +5617,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.13" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" @@ -5716,7 +5681,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -5742,22 +5707,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -5768,9 +5733,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" [[package]] name = "pin-utils" @@ -5778,17 +5743,6 @@ 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.27" @@ -5814,12 +5768,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", - "bitflags 1.3.2", + "bitflags", "cfg-if", "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "windows-sys 0.48.0", ] @@ -5866,22 +5820,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "prettyplease" -version = "0.2.10" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92139198957b410250d43fad93e630d956499a625c527eda65175c8680f83387" +checksum = "9825a04601d60621feed79c4e6b56d65db77cdca55cef43b46b0de1096d1c282" dependencies = [ "proc-macro2", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -5933,9 +5877,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -5961,7 +5905,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1abe0255c04d15f571427a2d1e00099016506cf3297b53853acd2b7eb87825" dependencies = [ "dtoa", - "itoa 1.0.8", + "itoa 1.0.6", "owning_ref", "prometheus-client-derive-text-encode", ] @@ -5984,17 +5928,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" dependencies = [ "bytes", - "prost-derive 0.10.1", -] - -[[package]] -name = "prost" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" -dependencies = [ - "bytes", - "prost-derive 0.11.9", + "prost-derive", ] [[package]] @@ -6012,35 +5946,13 @@ dependencies = [ "log", "multimap", "petgraph", - "prost 0.10.4", - "prost-types 0.10.1", + "prost", + "prost-types", "regex", "tempfile", "which", ] -[[package]] -name = "prost-build" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" -dependencies = [ - "bytes", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prettyplease 0.1.25", - "prost 0.11.9", - "prost-types 0.11.9", - "regex", - "syn 1.0.109", - "tempfile", - "which", -] - [[package]] name = "prost-codec" version = "0.1.0" @@ -6049,7 +5961,7 @@ checksum = "00af1e92c33b4813cc79fda3f2dbf56af5169709be0202df730e9ebc3e4cd007" dependencies = [ "asynchronous-codec", "bytes", - "prost 0.10.4", + "prost", "thiserror", "unsigned-varint", ] @@ -6067,19 +5979,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "prost-derive" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "prost-types" version = "0.10.1" @@ -6087,16 +5986,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" dependencies = [ "bytes", - "prost 0.10.4", -] - -[[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" -dependencies = [ - "prost 0.11.9", + "prost", ] [[package]] @@ -6127,9 +6017,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -6274,7 +6164,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -6283,7 +6173,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -6299,29 +6189,29 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.18" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1641819477c319ef452a075ac34a4be92eb9ba09f6841f62d594d50fdcf0bf6b" +checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.18" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bf53dad9b6086826722cdc99140793afd9f62faa14a1ad07eb4f955e7a7216" +checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] name = "regalloc2" -version = "0.3.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43a209257d978ef079f3d446331d0f1794f5e0fc19b306a199983857833a779" +checksum = "4a8d23b35d7177df3b9d31ed8a9ab4bf625c668be77a319d4f5efd4a5257701c" dependencies = [ "fxhash", "log", @@ -6331,14 +6221,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.1" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick 1.0.2", "memchr", - "regex-automata 0.3.2", - "regex-syntax 0.7.3", + "regex-syntax 0.7.2", ] [[package]] @@ -6350,17 +6239,6 @@ dependencies = [ "regex-syntax 0.6.29", ] -[[package]] -name = "regex-automata" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" -dependencies = [ - "aho-corasick 1.0.2", - "memchr", - "regex-syntax 0.7.3", -] - [[package]] name = "regex-syntax" version = "0.6.29" @@ -6369,21 +6247,33 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.3" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" + +[[package]] +name = "region" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" +checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0" +dependencies = [ + "bitflags", + "libc", + "mach", + "winapi", +] [[package]] name = "remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "env_logger 0.9.3", "jsonrpsee", "log", "parity-scale-codec", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-core", "sp-io", "sp-runtime", @@ -6510,42 +6400,43 @@ dependencies = [ [[package]] name = "rustix" -version = "0.35.14" +version = "0.33.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6380889b07a03b5ecf1d44dc9ede6fd2145d84b502a2a9ca0b03c48e0cc3220f" +checksum = "938a344304321a9da4973b9ff4f9f8db9caf4597dfd9dda6a60b523340a0fff0" dependencies = [ - "bitflags 1.3.2", + "bitflags", "errno 0.2.8", - "io-lifetimes 0.7.5", + "io-lifetimes 0.5.3", "libc", - "linux-raw-sys 0.0.46", - "windows-sys 0.42.0", + "linux-raw-sys 0.0.42", + "winapi", ] [[package]] name = "rustix" -version = "0.37.23" +version = "0.35.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ - "bitflags 1.3.2", - "errno 0.3.1", - "io-lifetimes 1.0.11", + "bitflags", + "errno 0.2.8", + "io-lifetimes 0.7.5", "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", + "linux-raw-sys 0.0.46", + "windows-sys 0.42.0", ] [[package]] name = "rustix" -version = "0.38.3" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ - "bitflags 2.3.3", + "bitflags", "errno 0.3.1", + "io-lifetimes 1.0.11", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys 0.3.8", "windows-sys 0.48.0", ] @@ -6584,9 +6475,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" [[package]] name = "rw-stream-sink" @@ -6601,9 +6492,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "safe-mix" @@ -6635,7 +6526,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "log", "sp-core", @@ -6646,7 +6537,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -6655,8 +6546,8 @@ dependencies = [ "libp2p", "log", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "rand 0.7.3", "sc-client-api", "sc-network-common", @@ -6673,7 +6564,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "futures-timer", @@ -6696,7 +6587,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -6712,7 +6603,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-trait-for-tuples", "memmap2", @@ -6721,7 +6612,7 @@ dependencies = [ "sc-network-common", "sc-telemetry", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-core", "sp-runtime", ] @@ -6729,7 +6620,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -6740,13 +6631,13 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "array-bytes", "chrono", "clap", "fdlimit", "futures", + "hex", "libp2p", "log", "names", @@ -6758,13 +6649,12 @@ dependencies = [ "sc-client-db", "sc-keystore", "sc-network", - "sc-network-common", "sc-service", "sc-telemetry", "sc-tracing", "sc-utils", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-blockchain", "sp-core", "sp-keyring", @@ -6780,7 +6670,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "fnv", "futures", @@ -6808,7 +6698,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "hash-db", "kvdb", @@ -6833,7 +6723,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -6857,14 +6747,14 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "fork-tree", "futures", "log", "merlin", - "num-bigint 0.2.6", + "num-bigint", "num-rational 0.2.4", "num-traits", "parity-scale-codec", @@ -6899,7 +6789,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "jsonrpsee", @@ -6921,7 +6811,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "fork-tree", "parity-scale-codec", @@ -6934,7 +6824,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -6952,13 +6842,14 @@ 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/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "sc-client-api", "sp-authorship", @@ -6969,7 +6860,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "lazy_static", "lru", @@ -6996,7 +6887,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "environmental", "parity-scale-codec", @@ -7012,7 +6903,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "log", "parity-scale-codec", @@ -7027,15 +6918,16 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "cfg-if", "libc", "log", "once_cell", "parity-scale-codec", - "parity-wasm 0.45.0", - "rustix 0.35.14", + "parity-wasm 0.42.2", + "rustix 0.33.7", + "rustix 0.35.13", "sc-allocator", "sc-executor-common", "sp-runtime-interface", @@ -7047,16 +6939,16 @@ dependencies = [ [[package]] name = "sc-finality-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ahash", - "array-bytes", "async-trait", "dyn-clone", "finality-grandpa", "fork-tree", "futures", "futures-timer", + "hex", "log", "parity-scale-codec", "parking_lot 0.12.1", @@ -7071,7 +6963,7 @@ dependencies = [ "sc-network-gossip", "sc-telemetry", "sc-utils", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-api", "sp-application-crypto", "sp-arithmetic", @@ -7088,7 +6980,7 @@ dependencies = [ [[package]] name = "sc-finality-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "finality-grandpa", "futures", @@ -7099,7 +6991,7 @@ dependencies = [ "sc-finality-grandpa", "sc-rpc", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-blockchain", "sp-core", "sp-runtime", @@ -7109,7 +7001,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ansi_term 0.12.1", "futures", @@ -7126,12 +7018,12 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "array-bytes", "async-trait", + "hex", "parking_lot 0.12.1", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-application-crypto", "sp-core", "sp-keystore", @@ -7141,12 +7033,11 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "array-bytes", "async-trait", "asynchronous-codec", - "bitflags 1.3.2", + "bitflags", "bytes", "cid", "either", @@ -7154,6 +7045,7 @@ dependencies = [ "fork-tree", "futures", "futures-timer", + "hex", "ip_network", "libp2p", "linked-hash-map", @@ -7163,7 +7055,8 @@ dependencies = [ "parity-scale-codec", "parking_lot 0.12.1", "pin-project", - "prost 0.10.4", + "prost", + "prost-build", "rand 0.7.3", "sc-block-builder", "sc-client-api", @@ -7172,7 +7065,7 @@ dependencies = [ "sc-peerset", "sc-utils", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "smallvec", "sp-arithmetic", "sp-blockchain", @@ -7182,43 +7075,22 @@ dependencies = [ "substrate-prometheus-endpoint", "thiserror", "unsigned-varint", - "zeroize", -] - -[[package]] -name = "sc-network-bitswap" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "cid", - "futures", - "libp2p", - "log", - "prost 0.11.9", - "prost-build 0.11.9", - "sc-client-api", - "sc-network-common", - "sp-blockchain", - "sp-runtime", - "thiserror", - "unsigned-varint", "void", + "zeroize", ] [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", - "bitflags 1.3.2", + "bitflags", "bytes", "futures", - "futures-timer", "libp2p", - "linked_hash_set", "parity-scale-codec", - "prost-build 0.10.4", + "prost-build", "sc-consensus", "sc-peerset", "serde", @@ -7227,14 +7099,13 @@ dependencies = [ "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/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ahash", "futures", @@ -7252,15 +7123,15 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "array-bytes", "futures", + "hex", "libp2p", "log", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-network-common", "sc-peerset", @@ -7273,17 +7144,17 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "array-bytes", "fork-tree", "futures", + "hex", "libp2p", "log", "lru", "parity-scale-codec", - "prost 0.10.4", - "prost-build 0.10.4", + "prost", + "prost-build", "sc-client-api", "sc-consensus", "sc-network-common", @@ -7298,35 +7169,16 @@ dependencies = [ "thiserror", ] -[[package]] -name = "sc-network-transactions" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "array-bytes", - "futures", - "hex", - "libp2p", - "log", - "parity-scale-codec", - "pin-project", - "sc-network-common", - "sc-peerset", - "sp-consensus", - "sp-runtime", - "substrate-prometheus-endpoint", -] - [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "array-bytes", "bytes", "fnv", "futures", "futures-timer", + "hex", "hyper", "hyper-rustls", "libp2p", @@ -7350,20 +7202,20 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "libp2p", "log", "sc-utils", - "serde_json 1.0.100", + "serde_json 1.0.99", "wasm-timer", ] [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -7372,7 +7224,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "hash-db", @@ -7387,7 +7239,7 @@ dependencies = [ "sc-tracing", "sc-transaction-pool-api", "sc-utils", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-api", "sp-blockchain", "sp-core", @@ -7402,7 +7254,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "jsonrpsee", @@ -7413,7 +7265,7 @@ dependencies = [ "sc-transaction-pool-api", "scale-info", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-core", "sp-rpc", "sp-runtime", @@ -7425,12 +7277,12 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "jsonrpsee", "log", - "serde_json 1.0.100", + "serde_json 1.0.99", "substrate-prometheus-endpoint", "tokio", ] @@ -7438,7 +7290,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "directories", @@ -7462,11 +7314,9 @@ 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", @@ -7477,7 +7327,7 @@ dependencies = [ "sc-transaction-pool-api", "sc-utils", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-api", "sp-application-crypto", "sp-block-builder", @@ -7496,7 +7346,6 @@ dependencies = [ "sp-transaction-storage-proof", "sp-trie", "sp-version", - "static_init", "substrate-prometheus-endpoint", "tempfile", "thiserror", @@ -7508,7 +7357,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "log", "parity-scale-codec", @@ -7522,7 +7371,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -7532,7 +7381,7 @@ dependencies = [ "sc-consensus-epochs", "sc-finality-grandpa", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-blockchain", "sp-runtime", "thiserror", @@ -7541,7 +7390,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "libc", @@ -7551,7 +7400,7 @@ dependencies = [ "regex", "sc-telemetry", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-core", "sp-io", "sp-std", @@ -7560,7 +7409,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "chrono", "futures", @@ -7570,7 +7419,7 @@ dependencies = [ "pin-project", "rand 0.7.3", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "thiserror", "wasm-timer", ] @@ -7578,7 +7427,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ansi_term 0.12.1", "atty", @@ -7609,7 +7458,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7620,7 +7469,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "futures-timer", @@ -7646,7 +7495,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "log", @@ -7659,7 +7508,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "futures-timer", @@ -7671,9 +7520,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.9.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" +checksum = "ad560913365790f17cbf12479491169f01b9d46d29cfc7422bf8c64bdc61b731" dependencies = [ "bitvec", "cfg-if", @@ -7685,9 +7534,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.9.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" +checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7697,11 +7546,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.42.0", ] [[package]] @@ -7746,7 +7595,6 @@ checksum = "08da66b8b0965a5555b6bd6639e68ccba85e1e2506f5fbb089e93f8a04e1a2d1" dependencies = [ "der", "generic-array 0.14.7", - "pkcs8", "subtle", "zeroize", ] @@ -7784,7 +7632,7 @@ version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -7836,22 +7684,22 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.171" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -7866,11 +7714,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.100" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" +checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" dependencies = [ - "itoa 1.0.8", + "itoa 1.0.6", "ryu", "serde", ] @@ -8016,9 +7864,9 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "1.11.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snap" @@ -8082,7 +7930,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "hash-db", "log", @@ -8100,7 +7948,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "blake2", "proc-macro-crate", @@ -8112,7 +7960,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -8125,7 +7973,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "integer-sqrt", "num-traits", @@ -8140,7 +7988,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -8153,7 +8001,7 @@ dependencies = [ [[package]] name = "sp-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "parity-scale-codec", @@ -8165,7 +8013,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "sp-api", @@ -8177,7 +8025,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "log", @@ -8195,7 +8043,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -8214,7 +8062,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "merlin", @@ -8237,7 +8085,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -8251,7 +8099,7 @@ dependencies = [ [[package]] name = "sp-consensus-vrf" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -8264,18 +8112,18 @@ dependencies = [ [[package]] name = "sp-core" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ - "array-bytes", "base58", - "bitflags 1.3.2", - "blake2", + "bitflags", + "blake2-rfc", "byteorder", "dyn-clonable", "ed25519-zebra", "futures", "hash-db", "hash256-std-hasher", + "hex", "impl-serde", "lazy_static", "libsecp256k1", @@ -8310,7 +8158,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "blake2", "byteorder", @@ -8324,7 +8172,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -8335,7 +8183,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -8344,7 +8192,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro2", "quote", @@ -8354,7 +8202,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "environmental", "parity-scale-codec", @@ -8365,7 +8213,7 @@ dependencies = [ [[package]] name = "sp-finality-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "finality-grandpa", "log", @@ -8383,7 +8231,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -8397,7 +8245,7 @@ dependencies = [ [[package]] name = "sp-io" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bytes", "futures", @@ -8423,7 +8271,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "lazy_static", "sp-core", @@ -8434,7 +8282,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures", @@ -8451,7 +8299,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "thiserror", "zstd", @@ -8460,7 +8308,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -8474,7 +8322,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "sp-api", "sp-core", @@ -8484,7 +8332,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "backtrace", "lazy_static", @@ -8494,7 +8342,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "rustc-hash", "serde", @@ -8504,7 +8352,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "either", "hash256-std-hasher", @@ -8521,13 +8369,12 @@ dependencies = [ "sp-core", "sp-io", "sp-std", - "sp-weights", ] [[package]] name = "sp-runtime-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -8545,7 +8392,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "Inflector", "proc-macro-crate", @@ -8557,7 +8404,7 @@ dependencies = [ [[package]] name = "sp-sandbox" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "log", "parity-scale-codec", @@ -8571,7 +8418,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -8585,7 +8432,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "scale-info", @@ -8596,7 +8443,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.12.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "hash-db", "log", @@ -8618,12 +8465,12 @@ dependencies = [ [[package]] name = "sp-std" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" [[package]] name = "sp-storage" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-serde", "parity-scale-codec", @@ -8636,7 +8483,7 @@ dependencies = [ [[package]] name = "sp-tasks" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "log", "sp-core", @@ -8649,7 +8496,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "futures-timer", @@ -8665,7 +8512,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "sp-std", @@ -8677,7 +8524,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "sp-api", "sp-runtime", @@ -8686,7 +8533,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "async-trait", "log", @@ -8702,11 +8549,11 @@ dependencies = [ [[package]] name = "sp-trie" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ahash", "hash-db", - "hashbrown", + "hashbrown 0.12.3", "lazy_static", "lru", "memory-db", @@ -8725,11 +8572,11 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-serde", "parity-scale-codec", - "parity-wasm 0.45.0", + "parity-wasm 0.42.2", "scale-info", "serde", "sp-core-hashing-proc-macro", @@ -8742,7 +8589,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -8753,7 +8600,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "impl-trait-for-tuples", "log", @@ -8763,50 +8610,24 @@ dependencies = [ "wasmtime", ] -[[package]] -name = "sp-weights" -version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "serde", - "smallvec", - "sp-arithmetic", - "sp-core", - "sp-debug-derive", - "sp-std", -] - [[package]] name = "spin" version = "0.5.2" 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.41.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfc443bad666016e012538782d9e3006213a7db43e9fb1dda91657dc06a6fa08" +checksum = "eb47a8ad42e5fc72d5b1eb104a5546937eaf39843499948bb666d6e93c62423b" dependencies = [ "Inflector", "num-format", "proc-macro2", "quote", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "unicode-xid", ] @@ -8822,34 +8643,6 @@ 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 1.3.2", - "cfg_aliases", - "libc", - "parking_lot 0.11.2", - "parking_lot_core 0.8.6", - "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 1.0.109", -] - [[package]] name = "statrs" version = "0.15.0" @@ -8907,7 +8700,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "platforms 2.0.0", ] @@ -8915,7 +8708,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -8925,7 +8718,7 @@ dependencies = [ "sc-client-api", "sc-rpc-api", "sc-transaction-pool-api", - "serde_json 1.0.100", + "serde_json 1.0.99", "sp-api", "sp-block-builder", "sp-blockchain", @@ -8936,7 +8729,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures-util", "hyper", @@ -8949,7 +8742,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "jsonrpsee", "log", @@ -8970,7 +8763,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "futures", "substrate-test-utils-derive", @@ -8980,7 +8773,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -8991,7 +8784,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "ansi_term 0.12.1", "build-helper", @@ -9024,9 +8817,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "2efbeae7acf4eabd6bcdcbd11c92f45231ddda7539edc7806bd1a04a03b24616" dependencies = [ "proc-macro2", "quote", @@ -9051,7 +8844,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -9088,7 +8881,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.23", + "rustix 0.37.20", "windows-sys 0.48.0", ] @@ -9109,22 +8902,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.43" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -9210,9 +9003,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "374442f06ee49c3a28a8fc9f01a2596fed7559c6b99b31279c3261778e77d84f" dependencies = [ "autocfg", "backtrace", @@ -9221,7 +9014,7 @@ dependencies = [ "mio", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "signal-hook-registry", "socket2 0.4.9", "tokio-macros", @@ -9236,7 +9029,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -9257,7 +9050,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "tokio", ] @@ -9271,7 +9064,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "tokio", "tracing", ] @@ -9298,7 +9091,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", ] @@ -9311,7 +9104,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] @@ -9368,7 +9161,7 @@ dependencies = [ "parking_lot 0.11.2", "regex", "serde", - "serde_json 1.0.100", + "serde_json 1.0.99", "sharded-slab", "smallvec", "thread_local", @@ -9385,7 +9178,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ "hash-db", - "hashbrown", + "hashbrown 0.12.3", "log", "rustc-hex", "smallvec", @@ -9452,7 +9245,7 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.30#a3ed0119c45cdd0d571ad34e5b3ee7518c8cef8d" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.29#cc370aa61e15c18d23a2f686b812fd576a630afe" dependencies = [ "clap", "frame-try-runtime", @@ -9501,9 +9294,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "uint" @@ -9534,9 +9327,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -9692,7 +9485,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", "wasm-bindgen-shared", ] @@ -9726,7 +9519,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -9750,11 +9543,11 @@ dependencies = [ [[package]] name = "wasm-instrument" -version = "0.3.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa1dafb3e60065305741e83db35c6c2584bb3725b692b5b66148a38d72ace6cd" +checksum = "962e5b0401bbb6c887f54e69b8c496ea36f704df65db73e81fd5ff8dc3e63a9f" dependencies = [ - "parity-wasm 0.45.0", + "parity-wasm 0.42.2", ] [[package]] @@ -9774,63 +9567,58 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.13.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c326c93fbf86419608361a2c925a31754cf109da1b8b55737070b4d6669422" +checksum = "ca00c5147c319a8ec91ec1a0edbec31e566ce2c9cc93b3f9bb86a9efd0eb795d" dependencies = [ - "parity-wasm 0.45.0", + "downcast-rs", + "libc", + "libm 0.2.7", + "memory_units", + "num-rational 0.2.4", + "num-traits", + "parity-wasm 0.42.2", "wasmi-validation", - "wasmi_core", ] [[package]] name = "wasmi-validation" -version = "0.5.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ff416ad1ff0c42e5a926ed5d5fab74c0f098749aa0ad8b2a34b982ce0e867b" +checksum = "165343ecd6c018fc09ebcae280752702c9a2ef3e6f8d02f1cfcbdb53ef6d7937" dependencies = [ - "parity-wasm 0.45.0", -] - -[[package]] -name = "wasmi_core" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" -dependencies = [ - "downcast-rs", - "libm 0.2.7", - "memory_units", - "num-rational 0.4.1", - "num-traits", + "parity-wasm 0.42.2", ] [[package]] name = "wasmparser" -version = "0.89.1" +version = "0.85.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab5d3e08b13876f96dd55608d03cd4883a0545884932d5adf11925876c96daef" +checksum = "570460c58b21e9150d2df0eaaedbb7816c34bcec009ae0dcc976e40ba81463e7" dependencies = [ "indexmap", ] [[package]] name = "wasmtime" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad5af6ba38311282f2a21670d96e78266e8c8e2f38cbcd52c254df6ccbc7731" +checksum = "1f50eadf868ab6a04b7b511460233377d0bfbb92e417b2f6a98b98fef2e098f5" dependencies = [ "anyhow", + "backtrace", "bincode", "cfg-if", "indexmap", + "lazy_static", "libc", "log", - "object 0.29.0", + "object 0.28.4", "once_cell", "paste", "psm", "rayon", + "region", "serde", "target-lexicon", "wasmparser", @@ -9839,23 +9627,14 @@ dependencies = [ "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", - "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", + "winapi", ] [[package]] name = "wasmtime-cache" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcd849399d17d2270141cfe47fa0d91ee52d5f8ea9b98cf7ddde0d53e5f79882" +checksum = "d1df23c642e1376892f3b72f311596976979cbf8b85469680cdd3a8a063d12a2" dependencies = [ "anyhow", "base64 0.13.1", @@ -9863,19 +9642,19 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix 0.35.14", + "rustix 0.33.7", "serde", "sha2 0.9.9", "toml", - "windows-sys 0.36.1", + "winapi", "zstd", ] [[package]] name = "wasmtime-cranelift" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bd91339b742ff20bfed4532a27b73c86b5bcbfedd6bea2dcdf2d64471e1b5c6" +checksum = "f264ff6b4df247d15584f2f53d009fbc90032cfdc2605b52b961bffc71b6eccd" dependencies = [ "anyhow", "cranelift-codegen", @@ -9885,7 +9664,8 @@ dependencies = [ "cranelift-wasm", "gimli 0.26.2", "log", - "object 0.29.0", + "more-asserts", + "object 0.28.4", "target-lexicon", "thiserror", "wasmparser", @@ -9894,16 +9674,17 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" +checksum = "839d2820e4b830f4b9e7aa08d4c0acabf4a5036105d639f6dfa1c6891c73bdc6" dependencies = [ "anyhow", "cranelift-entity", "gimli 0.26.2", "indexmap", "log", - "object 0.29.0", + "more-asserts", + "object 0.28.4", "serde", "target-lexicon", "thiserror", @@ -9913,9 +9694,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1985c628011fe26adf5e23a5301bdc79b245e0e338f14bb58b39e4e25e4d8681" +checksum = "ef0a0bcbfa18b946d890078ba0e1bc76bcc53eccfb40806c0020ec29dcd1bd49" dependencies = [ "addr2line 0.17.0", "anyhow", @@ -9924,36 +9705,38 @@ dependencies = [ "cpp_demangle", "gimli 0.26.2", "log", - "object 0.29.0", + "object 0.28.4", + "region", "rustc-demangle", - "rustix 0.35.14", + "rustix 0.33.7", "serde", "target-lexicon", "thiserror", "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-runtime", - "windows-sys 0.36.1", + "winapi", ] [[package]] name = "wasmtime-jit-debug" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f671b588486f5ccec8c5a3dba6b4c07eac2e66ab8c60e6f4e53717c77f709731" +checksum = "4f4779d976206c458edd643d1ac622b6c37e4a0800a8b1d25dfbf245ac2f2cac" dependencies = [ - "object 0.29.0", - "once_cell", - "rustix 0.35.14", + "lazy_static", + "object 0.28.4", + "rustix 0.33.7", ] [[package]] name = "wasmtime-runtime" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee8f92ad4b61736339c29361da85769ebc200f184361959d1792832e592a1afd" +checksum = "b7eb6ffa169eb5dcd18ac9473c817358cd57bc62c244622210566d473397954a" dependencies = [ "anyhow", + "backtrace", "cc", "cfg-if", "indexmap", @@ -9962,21 +9745,21 @@ dependencies = [ "mach", "memfd", "memoffset 0.6.5", - "paste", + "more-asserts", "rand 0.8.5", - "rustix 0.35.14", + "region", + "rustix 0.33.7", "thiserror", - "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-jit-debug", - "windows-sys 0.36.1", + "winapi", ] [[package]] name = "wasmtime-types" -version = "1.0.2" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" +checksum = "8d932b0ac5336f7308d869703dd225610a6a3aeaa8e968c52b43eed96cefb1c2" dependencies = [ "cranelift-entity", "serde", @@ -10083,19 +9866,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" @@ -10122,9 +9892,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -10153,12 +9923,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -10177,12 +9941,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -10201,12 +9959,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -10225,12 +9977,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -10261,12 +10007,6 @@ version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -10340,7 +10080,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.22", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 7be78ede0..ae62d4a9f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,17 +5,17 @@ path = "src/main.rs" [package] name = "cere" license = "GPL-3.0-or-later WITH Classpath-exception-2.0" -version = "4.8.0" +version = "4.7.0" edition = "2021" build = "build.rs" [dependencies] cere-cli = { path = "cli", features = [ "cere-dev-native" ] } -sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } ss58-registry = { version = "1.38.0", default-features = false } [build-dependencies] -substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } [workspace] members = [ diff --git a/Dockerfile b/Dockerfile index 55ede5447..5168b649c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,17 +7,7 @@ COPY . /cerenetwork RUN apt-get update && \ apt-get upgrade -y && \ - apt-get install -y cmake pkg-config libssl-dev git clang unzip - -# Installation script is taken from https://grpc.io/docs/protoc-installation/ -ENV PROTOC_VERSION=3.15.8 -RUN PB_REL="https://github.com/protocolbuffers/protobuf/releases" && \ - curl -LO $PB_REL/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ - mkdir -p /usr/local/protoc && \ - unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/protoc && \ - chmod +x /usr/local/protoc/bin/protoc && \ - ln -s /usr/local/protoc/bin/protoc /usr/local/bin - + apt-get install -y cmake pkg-config libssl-dev git clang RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \ export PATH=$PATH:$HOME/.cargo/bin && \ scripts/init.sh && \ diff --git a/Dockerfile.tests b/Dockerfile.tests index 23c25292b..56bba2fed 100644 --- a/Dockerfile.tests +++ b/Dockerfile.tests @@ -17,17 +17,7 @@ COPY --from=ddc-smart-contract /ddc-smart-contract/artifacts/metadata.json /cere RUN apt-get update && \ apt-get upgrade -y && \ - apt-get install -y cmake pkg-config libssl-dev git clang unzip - -# Installation script is taken from https://grpc.io/docs/protoc-installation/ -ENV PROTOC_VERSION=3.15.8 -RUN PB_REL="https://github.com/protocolbuffers/protobuf/releases" && \ - curl -LO $PB_REL/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip && \ - mkdir -p /usr/local/protoc && \ - unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr/local/protoc && \ - chmod +x /usr/local/protoc/bin/protoc && \ - ln -s /usr/local/protoc/bin/protoc /usr/local/bin - + apt-get install -y cmake pkg-config libssl-dev git clang RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \ export PATH=$PATH:$HOME/.cargo/bin && \ scripts/init.sh && \ diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 4d1fe40d0..87bb9c571 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cere-cli" -version = "4.8.0" +version = "4.7.0" edition = "2021" [package.metadata.wasm-pack.profile.release] @@ -13,17 +13,17 @@ crate-type = ["cdylib", "rlib"] [dependencies] clap = { version = "3.1", features = ["derive"], optional = true } -sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } -sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } -frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" } -try-runtime-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.30" } +sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.29" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.29" } +frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.29" } +try-runtime-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", optional = true , branch = "polkadot-v0.9.29" } # Local cere-service = { path = "../node/service", default-features = false, optional = true } cere-client = { path = "../node/client", optional = true } [build-dependencies] -substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } [features] default = ["cli", "cere-native"] diff --git a/cli/src/command.rs b/cli/src/command.rs index 5884387bc..b2e88f2f9 100644 --- a/cli/src/command.rs +++ b/cli/src/command.rs @@ -40,7 +40,7 @@ impl SubstrateCli for Cli { #[cfg(feature = "cere-dev-native")] "dev" => Box::new(cere_service::chain_spec::cere_dev_development_config()?), #[cfg(feature = "cere-dev-native")] - "local" => Box::new(cere_service::chain_spec::cere_dev_local_testnet_config()?), + "local" => Box::new(cere_service::chain_spec::cere_dev_local_testnet_config()?), path => { let path = std::path::PathBuf::from(path); @@ -181,11 +181,6 @@ pub fn run() -> sc_cli::Result<()> { let (client, _, _, _) = cere_service::new_chain_ops(&config)?; unwrap_client!(client, cmd.run(client.clone())) }), - #[cfg(not(feature = "runtime-benchmarks"))] - BenchmarkCmd::Storage(_) => - Err("Storage benchmarking can be enabled with `--features runtime-benchmarks`." - .into()), - #[cfg(feature = "runtime-benchmarks")] BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| { let (client, backend, _, _) = cere_service::new_chain_ops(&config)?; let db = backend.expose_db(); diff --git a/node/client/Cargo.toml b/node/client/Cargo.toml index eb4f2be13..9538f143e 100644 --- a/node/client/Cargo.toml +++ b/node/client/Cargo.toml @@ -1,36 +1,36 @@ [package] name = "cere-client" -version = "4.8.0" +version = "4.7.0" edition = "2021" [dependencies] -sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-offchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-storage = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-inherents = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } +sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-benchmarking-cli = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-offchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-storage = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-inherents = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-keyring = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } # Local cere-runtime = { path = "../../runtime/cere", optional = true } diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 65c79d982..276ece98a 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cere-service" -version = "4.8.0" +version = "4.7.0" edition = "2021" [dependencies] @@ -10,39 +10,39 @@ rand = "0.8" futures = "0.3.21" jsonrpsee = { version = "0.15.1", features = ["server"] } -sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", features = ["wasmtime"] } -sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-sysinfo = { version = "6.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus-uncles = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-authority-discovery = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-network = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-transaction-storage-proof = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-authorship = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-trie = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-cli = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", features = ["wasmtime"] } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-executor = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", features = ["wasmtime"] } +sc-service = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", features = ["wasmtime"] } +sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-transaction-pool = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-finality-grandpa = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-sysinfo = { version = "6.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-consensus-slots = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-consensus-uncles = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-authority-discovery = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-network = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-transaction-storage-proof = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-authorship = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-basic-authorship = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +node-primitives = { version = "2.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-trie = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } # Local cere-client = { path = "../client", default-features = false, optional = true } @@ -63,7 +63,6 @@ cere-dev-native = [ "cere-dev-runtime", "cere-dev-runtime-constants", "cere-clie runtime-benchmarks = [ "cere-runtime/runtime-benchmarks", "cere-dev-runtime/runtime-benchmarks", - "sc-service/runtime-benchmarks", ] try-runtime = [ diff --git a/node/service/src/chain_spec.rs b/node/service/src/chain_spec.rs index fbfc8bc6a..ebcbd8a37 100644 --- a/node/service/src/chain_spec.rs +++ b/node/service/src/chain_spec.rs @@ -193,7 +193,6 @@ pub fn cere_dev_genesis( stakers, ..Default::default() }, - ddc_staking: cere_dev::DdcStakingConfig::default(), democracy: cere_dev::DemocracyConfig::default(), elections: cere_dev::ElectionsConfig { members: endowed_accounts diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 8a84ed755..d8b3c7407 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -6,7 +6,7 @@ pub use cere_dev_runtime; pub use cere_runtime; use futures::prelude::*; -use sc_client_api::BlockBackend; +use sc_client_api::{BlockBackend, ExecutorProvider}; use sc_consensus_babe::{self, SlotProportion}; use sc_network::Event; use sc_service::{ @@ -26,9 +26,9 @@ pub use cere_client::{ pub use chain_spec::{CereChainSpec, CereDevChainSpec}; pub use node_primitives::{Block, BlockNumber}; pub use sc_executor::NativeElseWasmExecutor; -use sc_network_common::service::NetworkEventStream; pub use sc_service::ChainSpec; pub use sp_api::ConstructRuntimeApi; +use sc_network_common::{service::NetworkEventStream}; type FullSelectChain = sc_consensus::LongestChain; type FullGrandpaBlockImport = sc_finality_grandpa::GrandpaBlockImport< @@ -195,10 +195,11 @@ where let uncles = sp_authorship::InherentDataProvider::<::Header>::check_inherents(); - Ok((slot, timestamp, uncles)) + Ok((timestamp, slot, uncles)) }, &task_manager.spawn_essential_handle(), config.prometheus_registry(), + sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()), telemetry.as_ref().map(|x| x.handle()), )?; @@ -375,7 +376,7 @@ where Vec::default(), )); - let (network, system_rpc_tx, tx_handler_controller, network_starter) = + let (network, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams { config: &config, client: client.clone(), @@ -413,7 +414,6 @@ where transaction_pool: transaction_pool.clone(), task_manager: &mut task_manager, system_rpc_tx, - tx_handler_controller, telemetry: telemetry.as_mut(), })?; @@ -443,6 +443,9 @@ 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 { @@ -475,12 +478,13 @@ where &parent, )?; - Ok((slot, timestamp, uncles, storage_proof)) + Ok((timestamp, slot, 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()), @@ -641,15 +645,12 @@ pub trait IdentifyVariant { impl IdentifyVariant for Box { fn is_cere(&self) -> bool { - self.id().starts_with("cere_mainnet") || - self.id().starts_with("cere_qanet") || - self.id().starts_with("cere_testnet") + self.id().starts_with("cere_mainnet") || self.id().starts_with("cere_qanet") || self.id().starts_with("cere_testnet") } fn is_cere_dev(&self) -> bool { // Works for "cere-devnet" and "dev" arms in the load_spec(...) call. - // If you are specifying a customSpecRaw.json for "path" arm along with the - // "--force-cere-dev" flag, make sure your spec has a compatible "id" field to satisfy this - // condition + // If you are specifying a customSpecRaw.json for "path" arm along with the "--force-cere-dev" flag, + // make sure your spec has a compatible "id" field to satisfy this condition self.id().starts_with("cere_dev") } } diff --git a/pallets/chainbridge/Cargo.toml b/pallets/chainbridge/Cargo.toml index b1f2b953a..9528fb3bc 100644 --- a/pallets/chainbridge/Cargo.toml +++ b/pallets/chainbridge/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-chainbridge" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" license = "Unlicense" @@ -14,18 +14,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } lite-json = { version = "0.2.0", default-features = false } -sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } [features] default = ["std"] diff --git a/pallets/chainbridge/src/lib.rs b/pallets/chainbridge/src/lib.rs index 512c0a9c2..6a7d57c68 100644 --- a/pallets/chainbridge/src/lib.rs +++ b/pallets/chainbridge/src/lib.rs @@ -1,30 +1,27 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode, EncodeLike}; +use sp_std::marker::PhantomData; use frame_support::{ - decl_error, decl_event, decl_module, decl_storage, - dispatch::{ - ClassifyDispatch, DispatchClass, DispatchResult, GetDispatchInfo, Pays, PaysFee, WeighData, - Weight, - }, + dispatch::{DispatchResult}, decl_module, decl_storage, decl_event, decl_error, + weights::{DispatchClass, ClassifyDispatch, WeighData, Weight, PaysFee, Pays, GetDispatchInfo}, ensure, traits::{EnsureOrigin, Get}, - PalletId, Parameter, + Parameter, PalletId }; -use frame_system::{self as system, ensure_root, ensure_signed}; +use sp_std::prelude::*; +use frame_system::{self as system, ensure_signed, ensure_root}; use sp_core::U256; +use codec::{Encode, Decode, EncodeLike}; use sp_runtime::{ traits::{ - AccountIdConversion, Bounded, DispatchInfoOf, Dispatchable, SaturatedConversion, - SignedExtension, + SignedExtension, Bounded, SaturatedConversion, DispatchInfoOf, AccountIdConversion, Dispatchable, }, transaction_validity::{ - InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, + ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity, }, - RuntimeDebug, + RuntimeDebug, }; -use sp_std::{marker::PhantomData, prelude::*}; mod mock; mod tests; @@ -39,121 +36,118 @@ pub type ResourceId = [u8; 32]; /// Helper function to concatenate a chain ID and some bytes to produce a resource ID. /// The common format is (31 bytes unique ID + 1 byte chain ID). pub fn derive_resource_id(chain: u8, id: &[u8]) -> ResourceId { - let mut r_id: ResourceId = [0; 32]; - r_id[31] = chain; // last byte is chain id - let range = if id.len() > 31 { 31 } else { id.len() }; // Use at most 31 bytes - for i in 0..range { - r_id[30 - i] = id[range - 1 - i]; // Ensure left padding for eth compatibility - } - return r_id + let mut r_id: ResourceId = [0; 32]; + r_id[31] = chain; // last byte is chain id + let range = if id.len() > 31 { 31 } else { id.len() }; // Use at most 31 bytes + for i in 0..range { + r_id[30 - i] = id[range - 1 - i]; // Ensure left padding for eth compatibility + } + return r_id; } #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] pub enum ProposalStatus { - Initiated, - Approved, - Rejected, + Initiated, + Approved, + Rejected, } #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] pub struct ProposalVotes { - pub votes_for: Vec, - pub votes_against: Vec, - pub status: ProposalStatus, - pub expiry: BlockNumber, + pub votes_for: Vec, + pub votes_against: Vec, + pub status: ProposalStatus, + pub expiry: BlockNumber, } impl ProposalVotes { - /// Attempts to mark the proposal as approve or rejected. - /// Returns true if the status changes from active. - fn try_to_complete(&mut self, threshold: u32, total: u32) -> ProposalStatus { - if self.votes_for.len() >= threshold as usize { - self.status = ProposalStatus::Approved; - ProposalStatus::Approved - } else if total >= threshold && self.votes_against.len() as u32 + threshold > total { - self.status = ProposalStatus::Rejected; - ProposalStatus::Rejected - } else { - ProposalStatus::Initiated - } - } - - /// Returns true if the proposal has been rejected or approved, otherwise false. - fn is_complete(&self) -> bool { - self.status != ProposalStatus::Initiated - } - - /// Returns true if `who` has voted for or against the proposal - fn has_voted(&self, who: &A) -> bool { - self.votes_for.contains(&who) || self.votes_against.contains(&who) - } - - /// Return true if the expiry time has been reached - fn is_expired(&self, now: B) -> bool { - self.expiry <= now - } + /// Attempts to mark the proposal as approve or rejected. + /// Returns true if the status changes from active. + fn try_to_complete(&mut self, threshold: u32, total: u32) -> ProposalStatus { + if self.votes_for.len() >= threshold as usize { + self.status = ProposalStatus::Approved; + ProposalStatus::Approved + } else if total >= threshold && self.votes_against.len() as u32 + threshold > total { + self.status = ProposalStatus::Rejected; + ProposalStatus::Rejected + } else { + ProposalStatus::Initiated + } + } + + /// Returns true if the proposal has been rejected or approved, otherwise false. + fn is_complete(&self) -> bool { + self.status != ProposalStatus::Initiated + } + + /// Returns true if `who` has voted for or against the proposal + fn has_voted(&self, who: &A) -> bool { + self.votes_for.contains(&who) || self.votes_against.contains(&who) + } + + /// Return true if the expiry time has been reached + fn is_expired(&self, now: B) -> bool { + self.expiry <= now + } } impl Default for ProposalVotes { - fn default() -> Self { - Self { - votes_for: vec![], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: BlockNumber::default(), - } - } + fn default() -> Self { + Self { + votes_for: vec![], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: BlockNumber::default(), + } + } } pub trait Config: system::Config { - type RuntimeEvent: From> + Into<::RuntimeEvent>; - /// Origin used to administer the pallet - type AdminOrigin: EnsureOrigin; - /// Proposed dispatchable call - type Proposal: Parameter - + Dispatchable - + EncodeLike - + GetDispatchInfo; - /// The identifier for this chain. - /// This must be unique and must not collide with existing IDs within a set of bridged chains. - type ChainId: Get; - - type ProposalLifetime: Get; + type Event: From> + Into<::Event>; + /// Origin used to administer the pallet + type AdminOrigin: EnsureOrigin; + /// Proposed dispatchable call + type Proposal: Parameter + Dispatchable + EncodeLike + GetDispatchInfo; + /// The identifier for this chain. + /// This must be unique and must not collide with existing IDs within a set of bridged chains. + type ChainId: Get; + + type ProposalLifetime: Get; } decl_error! { - pub enum Error for Module { - /// Relayer threshold not set - ThresholdNotSet, - /// Provided chain Id is not valid - InvalidChainId, - /// Relayer threshold cannot be 0 - InvalidThreshold, - /// Interactions with this chain is not permitted - ChainNotWhitelisted, - /// Chain has already been enabled - ChainAlreadyWhitelisted, - /// Resource ID provided isn't mapped to anything - ResourceDoesNotExist, - /// Relayer already in set - RelayerAlreadyExists, - /// Provided accountId is not a relayer - RelayerInvalid, - /// Protected operation, must be performed by relayer - MustBeRelayer, - /// Relayer has already submitted some vote for this proposal - RelayerAlreadyVoted, - /// A proposal with these parameters has already been submitted - ProposalAlreadyExists, - /// No proposal with the ID was found - ProposalDoesNotExist, - /// Cannot complete proposal, needs more votes - ProposalNotComplete, - /// Proposal has either failed or succeeded - ProposalAlreadyComplete, - /// Lifetime of proposal has been exceeded - ProposalExpired, - } + pub enum Error for Module { + /// Relayer threshold not set + ThresholdNotSet, + /// Provided chain Id is not valid + InvalidChainId, + /// Relayer threshold cannot be 0 + InvalidThreshold, + /// Interactions with this chain is not permitted + ChainNotWhitelisted, + /// Chain has already been enabled + ChainAlreadyWhitelisted, + /// Resource ID provided isn't mapped to anything + ResourceDoesNotExist, + /// Relayer already in set + RelayerAlreadyExists, + /// Provided accountId is not a relayer + RelayerInvalid, + /// Protected operation, must be performed by relayer + MustBeRelayer, + /// Relayer has already submitted some vote for this proposal + RelayerAlreadyVoted, + /// A proposal with these parameters has already been submitted + ProposalAlreadyExists, + /// No proposal with the ID was found + ProposalDoesNotExist, + /// Cannot complete proposal, needs more votes + ProposalNotComplete, + /// Proposal has either failed or succeeded + ProposalAlreadyComplete, + /// Lifetime of proposal has been exceeded + ProposalExpired, + } } decl_storage! { @@ -184,427 +178,461 @@ decl_storage! { decl_event!( pub enum Event where ::AccountId { - /// Vote threshold has changed (new_threshold) - RelayerThresholdChanged(u32), - /// Chain now available for transfers (chain_id) - ChainWhitelisted(ChainId), - /// Relayer added to set - RelayerAdded(AccountId), - /// Relayer removed from set - RelayerRemoved(AccountId), - /// FunglibleTransfer is for relaying fungibles (dest_id, nonce, resource_id, amount, recipient, metadata) - FungibleTransfer(ChainId, DepositNonce, ResourceId, U256, Vec), - /// NonFungibleTransfer is for relaying NFTS (dest_id, nonce, resource_id, token_id, recipient, metadata) - NonFungibleTransfer(ChainId, DepositNonce, ResourceId, Vec, Vec, Vec), - /// GenericTransfer is for a generic data payload (dest_id, nonce, resource_id, metadata) - GenericTransfer(ChainId, DepositNonce, ResourceId, Vec), - /// Vote submitted in favour of proposal - VoteFor(ChainId, DepositNonce, AccountId), - /// Vot submitted against proposal - VoteAgainst(ChainId, DepositNonce, AccountId), - /// Voting successful for a proposal - ProposalApproved(ChainId, DepositNonce), - /// Voting rejected a proposal - ProposalRejected(ChainId, DepositNonce), - /// Execution of call succeeded - ProposalSucceeded(ChainId, DepositNonce), - /// Execution of call failed - ProposalFailed(ChainId, DepositNonce), - } + /// Vote threshold has changed (new_threshold) + RelayerThresholdChanged(u32), + /// Chain now available for transfers (chain_id) + ChainWhitelisted(ChainId), + /// Relayer added to set + RelayerAdded(AccountId), + /// Relayer removed from set + RelayerRemoved(AccountId), + /// FunglibleTransfer is for relaying fungibles (dest_id, nonce, resource_id, amount, recipient, metadata) + FungibleTransfer(ChainId, DepositNonce, ResourceId, U256, Vec), + /// NonFungibleTransfer is for relaying NFTS (dest_id, nonce, resource_id, token_id, recipient, metadata) + NonFungibleTransfer(ChainId, DepositNonce, ResourceId, Vec, Vec, Vec), + /// GenericTransfer is for a generic data payload (dest_id, nonce, resource_id, metadata) + GenericTransfer(ChainId, DepositNonce, ResourceId, Vec), + /// Vote submitted in favour of proposal + VoteFor(ChainId, DepositNonce, AccountId), + /// Vot submitted against proposal + VoteAgainst(ChainId, DepositNonce, AccountId), + /// Voting successful for a proposal + ProposalApproved(ChainId, DepositNonce), + /// Voting rejected a proposal + ProposalRejected(ChainId, DepositNonce), + /// Execution of call succeeded + ProposalSucceeded(ChainId, DepositNonce), + /// Execution of call failed + ProposalFailed(ChainId, DepositNonce), + } ); decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin { - type Error = Error; - - const ChainIdentity: ChainId = T::ChainId::get(); - const ProposalLifetime: T::BlockNumber = T::ProposalLifetime::get(); - const BridgeAccountId: T::AccountId = AccountIdConversion::::into_account_truncating(&MODULE_ID); - - fn deposit_event() = default; - - /// Sets the vote threshold for proposals. - /// - /// This threshold is used to determine how many votes are required - /// before a proposal is executed. - /// - /// # - /// - O(1) lookup and insert - /// # - #[weight = 195_000_000] - pub fn set_threshold(origin, threshold: u32) -> DispatchResult { - Self::ensure_admin(origin)?; - Self::set_relayer_threshold(threshold) - } - - /// Stores a method name on chain under an associated resource ID. - /// - /// # - /// - O(1) write - /// # - #[weight = 195_000_000] - pub fn set_resource(origin, id: ResourceId, method: Vec) -> DispatchResult { - Self::ensure_admin(origin)?; - Self::register_resource(id, method) - } - - /// Removes a resource ID from the resource mapping. - /// - /// After this call, bridge transfers with the associated resource ID will - /// be rejected. - /// - /// # - /// - O(1) removal - /// # - #[weight = 195_000_000] - pub fn remove_resource(origin, id: ResourceId) -> DispatchResult { - Self::ensure_admin(origin)?; - Self::unregister_resource(id) - } - - /// Enables a chain ID as a source or destination for a bridge transfer. - /// - /// # - /// - O(1) lookup and insert - /// # - #[weight = 195_000_000] - pub fn whitelist_chain(origin, id: ChainId) -> DispatchResult { - Self::ensure_admin(origin)?; - Self::whitelist(id) - } - - /// Adds a new relayer to the relayer set. - /// - /// # - /// - O(1) lookup and insert - /// # - #[weight = 195_000_000] - pub fn add_relayer(origin, v: T::AccountId) -> DispatchResult { - Self::ensure_admin(origin)?; - Self::register_relayer(v) - } - - /// Removes an existing relayer from the set. - /// - /// # - /// - O(1) lookup and removal - /// # - #[weight = 195_000_000] - pub fn remove_relayer(origin, v: T::AccountId) -> DispatchResult { - Self::ensure_admin(origin)?; - Self::unregister_relayer(v) - } - - /// Commits a vote in favour of the provided proposal. - /// - /// If a proposal with the given nonce and source chain ID does not already exist, it will - /// be created with an initial vote in favour from the caller. - /// - /// # - /// - weight of proposed call, regardless of whether execution is performed - /// # - #[weight = (call.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), call.get_dispatch_info().class, Pays::Yes)] - pub fn acknowledge_proposal(origin, nonce: DepositNonce, src_id: ChainId, r_id: ResourceId, call: Box<::Proposal>) -> DispatchResult { - let who = ensure_signed(origin)?; - ensure!(Self::is_relayer(&who), Error::::MustBeRelayer); - ensure!(Self::chain_whitelisted(src_id), Error::::ChainNotWhitelisted); - ensure!(Self::resource_exists(r_id), Error::::ResourceDoesNotExist); - - Self::vote_for(who, nonce, src_id, call) - } - - /// Commits a vote against a provided proposal. - /// - /// # - /// - Fixed, since execution of proposal should not be included - /// # - #[weight = 195_000_000] - pub fn reject_proposal(origin, nonce: DepositNonce, src_id: ChainId, r_id: ResourceId, call: Box<::Proposal>) -> DispatchResult { - let who = ensure_signed(origin)?; - ensure!(Self::is_relayer(&who), Error::::MustBeRelayer); - ensure!(Self::chain_whitelisted(src_id), Error::::ChainNotWhitelisted); - ensure!(Self::resource_exists(r_id), Error::::ResourceDoesNotExist); - - Self::vote_against(who, nonce, src_id, call) - } - - /// Evaluate the state of a proposal given the current vote threshold. - /// - /// A proposal with enough votes will be either executed or cancelled, and the status - /// will be updated accordingly. - /// - /// # - /// - weight of proposed call, regardless of whether execution is performed - /// # - #[weight = (prop.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), prop.get_dispatch_info().class, Pays::Yes)] - pub fn eval_vote_state(origin, nonce: DepositNonce, src_id: ChainId, prop: Box<::Proposal>) -> DispatchResult { - ensure_signed(origin)?; - - Self::try_resolve_proposal(nonce, src_id, prop) - } - } + pub struct Module for enum Call where origin: T::Origin { + type Error = Error; + + const ChainIdentity: ChainId = T::ChainId::get(); + const ProposalLifetime: T::BlockNumber = T::ProposalLifetime::get(); + const BridgeAccountId: T::AccountId = AccountIdConversion::::into_account_truncating(&MODULE_ID); + + fn deposit_event() = default; + + /// Sets the vote threshold for proposals. + /// + /// This threshold is used to determine how many votes are required + /// before a proposal is executed. + /// + /// # + /// - O(1) lookup and insert + /// # + #[weight = 195_000_000] + pub fn set_threshold(origin, threshold: u32) -> DispatchResult { + Self::ensure_admin(origin)?; + Self::set_relayer_threshold(threshold) + } + + /// Stores a method name on chain under an associated resource ID. + /// + /// # + /// - O(1) write + /// # + #[weight = 195_000_000] + pub fn set_resource(origin, id: ResourceId, method: Vec) -> DispatchResult { + Self::ensure_admin(origin)?; + Self::register_resource(id, method) + } + + /// Removes a resource ID from the resource mapping. + /// + /// After this call, bridge transfers with the associated resource ID will + /// be rejected. + /// + /// # + /// - O(1) removal + /// # + #[weight = 195_000_000] + pub fn remove_resource(origin, id: ResourceId) -> DispatchResult { + Self::ensure_admin(origin)?; + Self::unregister_resource(id) + } + + /// Enables a chain ID as a source or destination for a bridge transfer. + /// + /// # + /// - O(1) lookup and insert + /// # + #[weight = 195_000_000] + pub fn whitelist_chain(origin, id: ChainId) -> DispatchResult { + Self::ensure_admin(origin)?; + Self::whitelist(id) + } + + /// Adds a new relayer to the relayer set. + /// + /// # + /// - O(1) lookup and insert + /// # + #[weight = 195_000_000] + pub fn add_relayer(origin, v: T::AccountId) -> DispatchResult { + Self::ensure_admin(origin)?; + Self::register_relayer(v) + } + + /// Removes an existing relayer from the set. + /// + /// # + /// - O(1) lookup and removal + /// # + #[weight = 195_000_000] + pub fn remove_relayer(origin, v: T::AccountId) -> DispatchResult { + Self::ensure_admin(origin)?; + Self::unregister_relayer(v) + } + + /// Commits a vote in favour of the provided proposal. + /// + /// If a proposal with the given nonce and source chain ID does not already exist, it will + /// be created with an initial vote in favour from the caller. + /// + /// # + /// - weight of proposed call, regardless of whether execution is performed + /// # + #[weight = (call.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), call.get_dispatch_info().class, Pays::Yes)] + pub fn acknowledge_proposal(origin, nonce: DepositNonce, src_id: ChainId, r_id: ResourceId, call: Box<::Proposal>) -> DispatchResult { + let who = ensure_signed(origin)?; + ensure!(Self::is_relayer(&who), Error::::MustBeRelayer); + ensure!(Self::chain_whitelisted(src_id), Error::::ChainNotWhitelisted); + ensure!(Self::resource_exists(r_id), Error::::ResourceDoesNotExist); + + Self::vote_for(who, nonce, src_id, call) + } + + /// Commits a vote against a provided proposal. + /// + /// # + /// - Fixed, since execution of proposal should not be included + /// # + #[weight = 195_000_000] + pub fn reject_proposal(origin, nonce: DepositNonce, src_id: ChainId, r_id: ResourceId, call: Box<::Proposal>) -> DispatchResult { + let who = ensure_signed(origin)?; + ensure!(Self::is_relayer(&who), Error::::MustBeRelayer); + ensure!(Self::chain_whitelisted(src_id), Error::::ChainNotWhitelisted); + ensure!(Self::resource_exists(r_id), Error::::ResourceDoesNotExist); + + Self::vote_against(who, nonce, src_id, call) + } + + /// Evaluate the state of a proposal given the current vote threshold. + /// + /// A proposal with enough votes will be either executed or cancelled, and the status + /// will be updated accordingly. + /// + /// # + /// - weight of proposed call, regardless of whether execution is performed + /// # + #[weight = (prop.get_dispatch_info().weight + Weight::from_ref_time(195_000_000 as u64), prop.get_dispatch_info().class, Pays::Yes)] + pub fn eval_vote_state(origin, nonce: DepositNonce, src_id: ChainId, prop: Box<::Proposal>) -> DispatchResult { + ensure_signed(origin)?; + + Self::try_resolve_proposal(nonce, src_id, prop) + } + } } impl Module { - // *** Utility methods *** - - pub fn ensure_admin(o: T::RuntimeOrigin) -> DispatchResult { - T::AdminOrigin::try_origin(o).map(|_| ()).or_else(ensure_root)?; - Ok(()) - } - - /// Checks if who is a relayer - pub fn is_relayer(who: &T::AccountId) -> bool { - Self::relayers(who) - } - - /// Provides an AccountId for the pallet. - /// This is used both as an origin check and deposit/withdrawal account. - pub fn account_id() -> T::AccountId { - AccountIdConversion::::into_account_truncating(&MODULE_ID) - } - - /// Asserts if a resource is registered - pub fn resource_exists(id: ResourceId) -> bool { - return Self::resources(id) != None - } - - /// Checks if a chain exists as a whitelisted destination - pub fn chain_whitelisted(id: ChainId) -> bool { - return Self::chains(id) != None - } - - /// Increments the deposit nonce for the specified chain ID - fn bump_nonce(id: ChainId) -> DepositNonce { - let nonce = Self::chains(id).unwrap_or_default() + 1; - ::insert(id, nonce); - nonce - } - - // *** Admin methods *** - - /// Set a new voting threshold - pub fn set_relayer_threshold(threshold: u32) -> DispatchResult { - ensure!(threshold > 0, Error::::InvalidThreshold); - ::put(threshold); - Self::deposit_event(RawEvent::RelayerThresholdChanged(threshold)); - Ok(()) - } - - /// Register a method for a resource Id, enabling associated transfers - pub fn register_resource(id: ResourceId, method: Vec) -> DispatchResult { - ::insert(id, method); - Ok(()) - } - - /// Removes a resource ID, disabling associated transfer - pub fn unregister_resource(id: ResourceId) -> DispatchResult { - ::remove(id); - Ok(()) - } - - /// Whitelist a chain ID for transfer - pub fn whitelist(id: ChainId) -> DispatchResult { - // Cannot whitelist this chain - ensure!(id != T::ChainId::get(), Error::::InvalidChainId); - // Cannot whitelist with an existing entry - ensure!(!Self::chain_whitelisted(id), Error::::ChainAlreadyWhitelisted); - ::insert(&id, 0); - Self::deposit_event(RawEvent::ChainWhitelisted(id)); - Ok(()) - } - - /// Adds a new relayer to the set - pub fn register_relayer(relayer: T::AccountId) -> DispatchResult { - ensure!(!Self::is_relayer(&relayer), Error::::RelayerAlreadyExists); - >::insert(&relayer, true); - ::mutate(|i| *i += 1); - - Self::deposit_event(RawEvent::RelayerAdded(relayer)); - Ok(()) - } - - /// Removes a relayer from the set - pub fn unregister_relayer(relayer: T::AccountId) -> DispatchResult { - ensure!(Self::is_relayer(&relayer), Error::::RelayerInvalid); - >::remove(&relayer); - ::mutate(|i| *i -= 1); - Self::deposit_event(RawEvent::RelayerRemoved(relayer)); - Ok(()) - } - - // *** Proposal voting and execution methods *** - - /// Commits a vote for a proposal. If the proposal doesn't exist it will be created. - fn commit_vote( - who: T::AccountId, - nonce: DepositNonce, - src_id: ChainId, - prop: Box, - in_favour: bool, - ) -> DispatchResult { - let now = >::block_number(); - let mut votes = match >::get(src_id, (nonce, prop.clone())) { - Some(v) => v, - None => { - let mut v = ProposalVotes::default(); - v.expiry = now + T::ProposalLifetime::get(); - v - }, - }; - - // Ensure the proposal isn't complete and relayer hasn't already voted - ensure!(!votes.is_complete(), Error::::ProposalAlreadyComplete); - ensure!(!votes.is_expired(now), Error::::ProposalExpired); - ensure!(!votes.has_voted(&who), Error::::RelayerAlreadyVoted); - - if in_favour { - votes.votes_for.push(who.clone()); - Self::deposit_event(RawEvent::VoteFor(src_id, nonce, who.clone())); - } else { - votes.votes_against.push(who.clone()); - Self::deposit_event(RawEvent::VoteAgainst(src_id, nonce, who.clone())); - } - - >::insert(src_id, (nonce, prop.clone()), votes.clone()); - - Ok(()) - } - - /// Attempts to finalize or cancel the proposal if the vote count allows. - fn try_resolve_proposal( - nonce: DepositNonce, - src_id: ChainId, - prop: Box, - ) -> DispatchResult { - if let Some(mut votes) = >::get(src_id, (nonce, prop.clone())) { - let now = >::block_number(); - ensure!(!votes.is_complete(), Error::::ProposalAlreadyComplete); - ensure!(!votes.is_expired(now), Error::::ProposalExpired); - - let status = votes.try_to_complete(::get(), ::get()); - >::insert(src_id, (nonce, prop.clone()), votes.clone()); - - match status { - ProposalStatus::Approved => Self::finalize_execution(src_id, nonce, prop), - ProposalStatus::Rejected => Self::cancel_execution(src_id, nonce), - _ => Ok(()), - } - } else { - Err(Error::::ProposalDoesNotExist)? - } - } - - /// Commits a vote in favour of the proposal and executes it if the vote threshold is met. - fn vote_for( - who: T::AccountId, - nonce: DepositNonce, - src_id: ChainId, - prop: Box, - ) -> DispatchResult { - Self::commit_vote(who, nonce, src_id, prop.clone(), true)?; - Self::try_resolve_proposal(nonce, src_id, prop) - } - - /// Commits a vote against the proposal and cancels it if more than (relayers.len() - threshold) - /// votes against exist. - fn vote_against( - who: T::AccountId, - nonce: DepositNonce, - src_id: ChainId, - prop: Box, - ) -> DispatchResult { - Self::commit_vote(who, nonce, src_id, prop.clone(), false)?; - Self::try_resolve_proposal(nonce, src_id, prop) - } - - /// Execute the proposal and signals the result as an event - fn finalize_execution( - src_id: ChainId, - nonce: DepositNonce, - call: Box, - ) -> DispatchResult { - Self::deposit_event(RawEvent::ProposalApproved(src_id, nonce)); - call.dispatch(frame_system::RawOrigin::Signed(Self::account_id()).into()) - .map(|_| ()) - .map_err(|e| e.error)?; - Self::deposit_event(RawEvent::ProposalSucceeded(src_id, nonce)); - Ok(()) - } - - /// Cancels a proposal. - fn cancel_execution(src_id: ChainId, nonce: DepositNonce) -> DispatchResult { - Self::deposit_event(RawEvent::ProposalRejected(src_id, nonce)); - Ok(()) - } - - /// Initiates a transfer of a fungible asset out of the chain. This should be called by another - /// pallet. - pub fn transfer_fungible( - dest_id: ChainId, - resource_id: ResourceId, - to: Vec, - amount: U256, - ) -> DispatchResult { - ensure!(Self::chain_whitelisted(dest_id), Error::::ChainNotWhitelisted); - ensure!(Self::resource_exists(resource_id), Error::::ResourceDoesNotExist); - let nonce = Self::bump_nonce(dest_id); - Self::deposit_event(RawEvent::FungibleTransfer(dest_id, nonce, resource_id, amount, to)); - Ok(()) - } - - /// Initiates a transfer of a nonfungible asset out of the chain. This should be called by - /// another pallet. - pub fn transfer_nonfungible( - dest_id: ChainId, - resource_id: ResourceId, - token_id: Vec, - to: Vec, - metadata: Vec, - ) -> DispatchResult { - ensure!(Self::chain_whitelisted(dest_id), Error::::ChainNotWhitelisted); - ensure!(Self::resource_exists(resource_id), Error::::ResourceDoesNotExist); - let nonce = Self::bump_nonce(dest_id); - Self::deposit_event(RawEvent::NonFungibleTransfer( - dest_id, - nonce, - resource_id, - token_id, - to, - metadata, - )); - Ok(()) - } - - /// Initiates a transfer of generic data out of the chain. This should be called by another - /// pallet. - pub fn transfer_generic( - dest_id: ChainId, - resource_id: ResourceId, - metadata: Vec, - ) -> DispatchResult { - ensure!(Self::chain_whitelisted(dest_id), Error::::ChainNotWhitelisted); - ensure!(Self::resource_exists(resource_id), Error::::ResourceDoesNotExist); - let nonce = Self::bump_nonce(dest_id); - Self::deposit_event(RawEvent::GenericTransfer(dest_id, nonce, resource_id, metadata)); - Ok(()) - } + // *** Utility methods *** + + pub fn ensure_admin(o: T::Origin) -> DispatchResult { + T::AdminOrigin::try_origin(o) + .map(|_| ()) + .or_else(ensure_root)?; + Ok(()) + } + + /// Checks if who is a relayer + pub fn is_relayer(who: &T::AccountId) -> bool { + Self::relayers(who) + } + + /// Provides an AccountId for the pallet. + /// This is used both as an origin check and deposit/withdrawal account. + pub fn account_id() -> T::AccountId { + AccountIdConversion::::into_account_truncating(&MODULE_ID) + } + + /// Asserts if a resource is registered + pub fn resource_exists(id: ResourceId) -> bool { + return Self::resources(id) != None; + } + + /// Checks if a chain exists as a whitelisted destination + pub fn chain_whitelisted(id: ChainId) -> bool { + return Self::chains(id) != None; + } + + /// Increments the deposit nonce for the specified chain ID + fn bump_nonce(id: ChainId) -> DepositNonce { + let nonce = Self::chains(id).unwrap_or_default() + 1; + ::insert(id, nonce); + nonce + } + + // *** Admin methods *** + + /// Set a new voting threshold + pub fn set_relayer_threshold(threshold: u32) -> DispatchResult { + ensure!(threshold > 0, Error::::InvalidThreshold); + ::put(threshold); + Self::deposit_event(RawEvent::RelayerThresholdChanged(threshold)); + Ok(()) + } + + /// Register a method for a resource Id, enabling associated transfers + pub fn register_resource(id: ResourceId, method: Vec) -> DispatchResult { + ::insert(id, method); + Ok(()) + } + + /// Removes a resource ID, disabling associated transfer + pub fn unregister_resource(id: ResourceId) -> DispatchResult { + ::remove(id); + Ok(()) + } + + /// Whitelist a chain ID for transfer + pub fn whitelist(id: ChainId) -> DispatchResult { + // Cannot whitelist this chain + ensure!(id != T::ChainId::get(), Error::::InvalidChainId); + // Cannot whitelist with an existing entry + ensure!( + !Self::chain_whitelisted(id), + Error::::ChainAlreadyWhitelisted + ); + ::insert(&id, 0); + Self::deposit_event(RawEvent::ChainWhitelisted(id)); + Ok(()) + } + + /// Adds a new relayer to the set + pub fn register_relayer(relayer: T::AccountId) -> DispatchResult { + ensure!( + !Self::is_relayer(&relayer), + Error::::RelayerAlreadyExists + ); + >::insert(&relayer, true); + ::mutate(|i| *i += 1); + + Self::deposit_event(RawEvent::RelayerAdded(relayer)); + Ok(()) + } + + /// Removes a relayer from the set + pub fn unregister_relayer(relayer: T::AccountId) -> DispatchResult { + ensure!(Self::is_relayer(&relayer), Error::::RelayerInvalid); + >::remove(&relayer); + ::mutate(|i| *i -= 1); + Self::deposit_event(RawEvent::RelayerRemoved(relayer)); + Ok(()) + } + + // *** Proposal voting and execution methods *** + + /// Commits a vote for a proposal. If the proposal doesn't exist it will be created. + fn commit_vote( + who: T::AccountId, + nonce: DepositNonce, + src_id: ChainId, + prop: Box, + in_favour: bool, + ) -> DispatchResult { + let now = >::block_number(); + let mut votes = match >::get(src_id, (nonce, prop.clone())) { + Some(v) => v, + None => { + let mut v = ProposalVotes::default(); + v.expiry = now + T::ProposalLifetime::get(); + v + } + }; + + // Ensure the proposal isn't complete and relayer hasn't already voted + ensure!(!votes.is_complete(), Error::::ProposalAlreadyComplete); + ensure!(!votes.is_expired(now), Error::::ProposalExpired); + ensure!(!votes.has_voted(&who), Error::::RelayerAlreadyVoted); + + if in_favour { + votes.votes_for.push(who.clone()); + Self::deposit_event(RawEvent::VoteFor(src_id, nonce, who.clone())); + } else { + votes.votes_against.push(who.clone()); + Self::deposit_event(RawEvent::VoteAgainst(src_id, nonce, who.clone())); + } + + >::insert(src_id, (nonce, prop.clone()), votes.clone()); + + Ok(()) + } + + /// Attempts to finalize or cancel the proposal if the vote count allows. + fn try_resolve_proposal( + nonce: DepositNonce, + src_id: ChainId, + prop: Box, + ) -> DispatchResult { + if let Some(mut votes) = >::get(src_id, (nonce, prop.clone())) { + let now = >::block_number(); + ensure!(!votes.is_complete(), Error::::ProposalAlreadyComplete); + ensure!(!votes.is_expired(now), Error::::ProposalExpired); + + let status = votes.try_to_complete(::get(), ::get()); + >::insert(src_id, (nonce, prop.clone()), votes.clone()); + + match status { + ProposalStatus::Approved => Self::finalize_execution(src_id, nonce, prop), + ProposalStatus::Rejected => Self::cancel_execution(src_id, nonce), + _ => Ok(()), + } + } else { + Err(Error::::ProposalDoesNotExist)? + } + } + + /// Commits a vote in favour of the proposal and executes it if the vote threshold is met. + fn vote_for( + who: T::AccountId, + nonce: DepositNonce, + src_id: ChainId, + prop: Box, + ) -> DispatchResult { + Self::commit_vote(who, nonce, src_id, prop.clone(), true)?; + Self::try_resolve_proposal(nonce, src_id, prop) + } + + /// Commits a vote against the proposal and cancels it if more than (relayers.len() - threshold) + /// votes against exist. + fn vote_against( + who: T::AccountId, + nonce: DepositNonce, + src_id: ChainId, + prop: Box, + ) -> DispatchResult { + Self::commit_vote(who, nonce, src_id, prop.clone(), false)?; + Self::try_resolve_proposal(nonce, src_id, prop) + } + + /// Execute the proposal and signals the result as an event + fn finalize_execution( + src_id: ChainId, + nonce: DepositNonce, + call: Box, + ) -> DispatchResult { + Self::deposit_event(RawEvent::ProposalApproved(src_id, nonce)); + call.dispatch(frame_system::RawOrigin::Signed(Self::account_id()).into()) + .map(|_| ()) + .map_err(|e| e.error)?; + Self::deposit_event(RawEvent::ProposalSucceeded(src_id, nonce)); + Ok(()) + } + + /// Cancels a proposal. + fn cancel_execution(src_id: ChainId, nonce: DepositNonce) -> DispatchResult { + Self::deposit_event(RawEvent::ProposalRejected(src_id, nonce)); + Ok(()) + } + + /// Initiates a transfer of a fungible asset out of the chain. This should be called by another pallet. + pub fn transfer_fungible( + dest_id: ChainId, + resource_id: ResourceId, + to: Vec, + amount: U256, + ) -> DispatchResult { + ensure!( + Self::chain_whitelisted(dest_id), + Error::::ChainNotWhitelisted + ); + ensure!( + Self::resource_exists(resource_id), + Error::::ResourceDoesNotExist + ); + let nonce = Self::bump_nonce(dest_id); + Self::deposit_event(RawEvent::FungibleTransfer( + dest_id, + nonce, + resource_id, + amount, + to, + )); + Ok(()) + } + + /// Initiates a transfer of a nonfungible asset out of the chain. This should be called by another pallet. + pub fn transfer_nonfungible( + dest_id: ChainId, + resource_id: ResourceId, + token_id: Vec, + to: Vec, + metadata: Vec, + ) -> DispatchResult { + ensure!( + Self::chain_whitelisted(dest_id), + Error::::ChainNotWhitelisted + ); + ensure!( + Self::resource_exists(resource_id), + Error::::ResourceDoesNotExist + ); + let nonce = Self::bump_nonce(dest_id); + Self::deposit_event(RawEvent::NonFungibleTransfer( + dest_id, + nonce, + resource_id, + token_id, + to, + metadata, + )); + Ok(()) + } + + /// Initiates a transfer of generic data out of the chain. This should be called by another pallet. + pub fn transfer_generic( + dest_id: ChainId, + resource_id: ResourceId, + metadata: Vec, + ) -> DispatchResult { + ensure!( + Self::chain_whitelisted(dest_id), + Error::::ChainNotWhitelisted + ); + ensure!( + Self::resource_exists(resource_id), + Error::::ResourceDoesNotExist + ); + let nonce = Self::bump_nonce(dest_id); + Self::deposit_event(RawEvent::GenericTransfer( + dest_id, + nonce, + resource_id, + metadata, + )); + Ok(()) + } } /// Simple ensure origin for the bridge account pub struct EnsureBridge(sp_std::marker::PhantomData); -impl EnsureOrigin for EnsureBridge { - type Success = T::AccountId; - fn try_origin(o: T::RuntimeOrigin) -> Result { - let bridge_id = AccountIdConversion::::into_account_truncating(&MODULE_ID); - o.into().and_then(|o| match o { - system::RawOrigin::Signed(who) if who == bridge_id => Ok(bridge_id), - r => Err(T::RuntimeOrigin::from(r)), - }) - } +impl EnsureOrigin for EnsureBridge { + type Success = T::AccountId; + fn try_origin(o: T::Origin) -> Result { + let bridge_id = AccountIdConversion::::into_account_truncating(&MODULE_ID); + o.into().and_then(|o| match o { + system::RawOrigin::Signed(who) if who == bridge_id => Ok(bridge_id), + r => Err(T::Origin::from(r)), + }) + } #[cfg(feature = "runtime-benchmarks")] - fn successful_origin() -> T::RuntimeOrigin { - T::RuntimeOrigin::from(system::RawOrigin::Signed(>::account_id())) + fn successful_origin() -> T::Origin { + T::Origin::from(system::RawOrigin::Signed(>::account_id())) } } diff --git a/pallets/chainbridge/src/mock.rs b/pallets/chainbridge/src/mock.rs index 15a6a235b..bf49533e8 100644 --- a/pallets/chainbridge/src/mock.rs +++ b/pallets/chainbridge/src/mock.rs @@ -3,102 +3,103 @@ use super::*; use frame_support::{ - assert_ok, ord_parameter_types, parameter_types, traits::Everything, weights::Weight, PalletId, + assert_ok, ord_parameter_types, parameter_types, weights::Weight, PalletId, + traits::{Everything} }; use frame_system::{self as system}; use sp_core::H256; use sp_runtime::{ - testing::Header, - traits::{AccountIdConversion, BlakeTwo256, Block as BlockT, IdentityLookup}, - Perbill, + testing::Header, + traits::{AccountIdConversion, BlakeTwo256, Block as BlockT, IdentityLookup}, + Perbill, }; use crate::{self as bridge, Config}; pub use pallet_balances as balances; parameter_types! { - pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); - pub const MaximumBlockLength: u32 = 2 * 1024; - pub const AvailableBlockRatio: Perbill = Perbill::one(); - pub const MaxLocks: u32 = 50; + pub const BlockHashCount: u64 = 250; + pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockLength: u32 = 2 * 1024; + pub const AvailableBlockRatio: Perbill = Perbill::one(); + pub const MaxLocks: u32 = 50; } impl frame_system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type DbWeight = (); - type Version = (); - // type ModuleToIndex = (); - type PalletInfo = PalletInfo; - // type MaxLocks = MaxLocks; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type DbWeight = (); + type Version = (); + // type ModuleToIndex = (); + type PalletInfo = PalletInfo; + // type MaxLocks = MaxLocks; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { - pub const ExistentialDeposit: u64 = 1; + pub const ExistentialDeposit: u64 = 1; } ord_parameter_types! { - pub const One: u64 = 1; + pub const One: u64 = 1; } impl pallet_balances::Config for Test { - type Balance = u64; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = (); + type Balance = u64; + type DustRemoval = (); + type Event = Event; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = (); } parameter_types! { - pub const TestChainId: u8 = 5; - pub const ProposalLifetime: u64 = 50; + pub const TestChainId: u8 = 5; + pub const ProposalLifetime: u64 = 50; } impl Config for Test { - type RuntimeEvent = RuntimeEvent; - type AdminOrigin = frame_system::EnsureRoot; - type Proposal = RuntimeCall; - type ChainId = TestChainId; - type ProposalLifetime = ProposalLifetime; + type Event = Event; + type AdminOrigin = frame_system::EnsureRoot; + type Proposal = Call; + type ChainId = TestChainId; + type ProposalLifetime = ProposalLifetime; } type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - System: system::{Pallet, Call, Event}, - Balances: balances::{Pallet, Call, Storage, Config, Event}, - Bridge: bridge::{Pallet, Call, Storage, Event}, - } + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic + { + System: system::{Pallet, Call, Event}, + Balances: balances::{Pallet, Call, Storage, Config, Event}, + Bridge: bridge::{Pallet, Call, Storage, Event}, + } ); // pub const BRIDGE_ID: u64 = @@ -109,49 +110,55 @@ pub const ENDOWED_BALANCE: u64 = 100_000_000; pub const TEST_THRESHOLD: u32 = 2; pub fn new_test_ext() -> sp_io::TestExternalities { - let bridge_id = AccountIdConversion::into_account_truncating(&MODULE_ID); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - pallet_balances::GenesisConfig:: { balances: vec![(bridge_id, ENDOWED_BALANCE)] } - .assimilate_storage(&mut t) - .unwrap(); - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext + let bridge_id = AccountIdConversion::into_account_truncating(&MODULE_ID); + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + pallet_balances::GenesisConfig:: { + balances: vec![(bridge_id, ENDOWED_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext } pub fn new_test_ext_initialized( - src_id: ChainId, - r_id: ResourceId, - resource: Vec, + src_id: ChainId, + r_id: ResourceId, + resource: Vec, ) -> sp_io::TestExternalities { - let mut t = new_test_ext(); - t.execute_with(|| { - // Set and check threshold - assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD)); - assert_eq!(Bridge::relayer_threshold(), TEST_THRESHOLD); - // Add relayers - assert_ok!(Bridge::add_relayer(RuntimeOrigin::root(), RELAYER_A)); - assert_ok!(Bridge::add_relayer(RuntimeOrigin::root(), RELAYER_B)); - assert_ok!(Bridge::add_relayer(RuntimeOrigin::root(), RELAYER_C)); - // Whitelist chain - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), src_id)); - // Set and check resource ID mapped to some junk data - assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), r_id, resource)); - assert_eq!(Bridge::resource_exists(r_id), true); - }); - t + let mut t = new_test_ext(); + t.execute_with(|| { + // Set and check threshold + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD)); + assert_eq!(Bridge::relayer_threshold(), TEST_THRESHOLD); + // Add relayers + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_A)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_B)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_C)); + // Whitelist chain + assert_ok!(Bridge::whitelist_chain(Origin::root(), src_id)); + // Set and check resource ID mapped to some junk data + assert_ok!(Bridge::set_resource(Origin::root(), r_id, resource)); + assert_eq!(Bridge::resource_exists(r_id), true); + }); + t } // Checks events against the latest. A contiguous set of events must be provided. They must // include the most recent event, but do not have to include every past event. -pub fn assert_events(mut expected: Vec) { - let mut actual: Vec = - system::Module::::events().iter().map(|e| e.event.clone()).collect(); - - expected.reverse(); - - for evt in expected { - let next = actual.pop().expect("event expected"); - assert_eq!(next, evt.into(), "Events don't match (actual,expected)"); - } +pub fn assert_events(mut expected: Vec) { + let mut actual: Vec = system::Module::::events() + .iter() + .map(|e| e.event.clone()) + .collect(); + + expected.reverse(); + + for evt in expected { + let next = actual.pop().expect("event expected"); + assert_eq!(next, evt.into(), "Events don't match (actual,expected)"); + } } diff --git a/pallets/chainbridge/src/tests.rs b/pallets/chainbridge/src/tests.rs index c7b3b18a2..7ceb70f69 100644 --- a/pallets/chainbridge/src/tests.rs +++ b/pallets/chainbridge/src/tests.rs @@ -1,569 +1,564 @@ #![cfg(test)] -use super::{ - mock::{ - assert_events, new_test_ext, Balances, Bridge, ProposalLifetime, RuntimeCall, RuntimeEvent, - RuntimeOrigin, System, Test, TestChainId, ENDOWED_BALANCE, RELAYER_A, RELAYER_B, RELAYER_C, - TEST_THRESHOLD, - }, - *, +use super::mock::{ + assert_events, new_test_ext, Balances, Bridge, Call, Event, Origin, ProposalLifetime, System, + Test, TestChainId, ENDOWED_BALANCE, RELAYER_A, RELAYER_B, RELAYER_C, TEST_THRESHOLD, }; +use super::*; use crate::mock::new_test_ext_initialized; use frame_support::{assert_noop, assert_ok}; -use frame_system::Origin; #[test] fn derive_ids() { - let chain = 1; - let id = [ - 0x21, 0x60, 0x5f, 0x71, 0x84, 0x5f, 0x37, 0x2a, 0x9e, 0xd8, 0x42, 0x53, 0xd2, 0xd0, 0x24, - 0xb7, 0xb1, 0x09, 0x99, 0xf4, - ]; - let r_id = derive_resource_id(chain, &id); - let expected = [ - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x21, 0x60, 0x5f, 0x71, 0x84, 0x5f, - 0x37, 0x2a, 0x9e, 0xd8, 0x42, 0x53, 0xd2, 0xd0, 0x24, 0xb7, 0xb1, 0x09, 0x99, 0xf4, chain, - ]; - assert_eq!(r_id, expected); + let chain = 1; + let id = [ + 0x21, 0x60, 0x5f, 0x71, 0x84, 0x5f, 0x37, 0x2a, 0x9e, 0xd8, 0x42, 0x53, 0xd2, 0xd0, 0x24, + 0xb7, 0xb1, 0x09, 0x99, 0xf4, + ]; + let r_id = derive_resource_id(chain, &id); + let expected = [ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x21, 0x60, 0x5f, 0x71, 0x84, 0x5f, + 0x37, 0x2a, 0x9e, 0xd8, 0x42, 0x53, 0xd2, 0xd0, 0x24, 0xb7, 0xb1, 0x09, 0x99, 0xf4, chain, + ]; + assert_eq!(r_id, expected); } #[test] fn complete_proposal_approved() { - let mut prop = ProposalVotes { - votes_for: vec![1, 2], - votes_against: vec![3], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get(), - }; - - prop.try_to_complete(2, 3); - assert_eq!(prop.status, ProposalStatus::Approved); + let mut prop = ProposalVotes { + votes_for: vec![1, 2], + votes_against: vec![3], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get(), + }; + + prop.try_to_complete(2, 3); + assert_eq!(prop.status, ProposalStatus::Approved); } #[test] fn complete_proposal_rejected() { - let mut prop = ProposalVotes { - votes_for: vec![1], - votes_against: vec![2, 3], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get(), - }; - - prop.try_to_complete(2, 3); - assert_eq!(prop.status, ProposalStatus::Rejected); + let mut prop = ProposalVotes { + votes_for: vec![1], + votes_against: vec![2, 3], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get(), + }; + + prop.try_to_complete(2, 3); + assert_eq!(prop.status, ProposalStatus::Rejected); } #[test] fn complete_proposal_bad_threshold() { - let mut prop = ProposalVotes { - votes_for: vec![1, 2], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get(), - }; - - prop.try_to_complete(3, 2); - assert_eq!(prop.status, ProposalStatus::Initiated); - - let mut prop = ProposalVotes { - votes_for: vec![], - votes_against: vec![1, 2], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get(), - }; - - prop.try_to_complete(3, 2); - assert_eq!(prop.status, ProposalStatus::Initiated); + let mut prop = ProposalVotes { + votes_for: vec![1, 2], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get(), + }; + + prop.try_to_complete(3, 2); + assert_eq!(prop.status, ProposalStatus::Initiated); + + let mut prop = ProposalVotes { + votes_for: vec![], + votes_against: vec![1, 2], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get(), + }; + + prop.try_to_complete(3, 2); + assert_eq!(prop.status, ProposalStatus::Initiated); } #[test] fn setup_resources() { - new_test_ext().execute_with(|| { - let id: ResourceId = [1; 32]; - let method = "Pallet.do_something".as_bytes().to_vec(); - let method2 = "Pallet.do_somethingElse".as_bytes().to_vec(); + new_test_ext().execute_with(|| { + let id: ResourceId = [1; 32]; + let method = "Pallet.do_something".as_bytes().to_vec(); + let method2 = "Pallet.do_somethingElse".as_bytes().to_vec(); - assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), id, method.clone())); - assert_eq!(Bridge::resources(id), Some(method)); + assert_ok!(Bridge::set_resource(Origin::root(), id, method.clone())); + assert_eq!(Bridge::resources(id), Some(method)); - assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), id, method2.clone())); - assert_eq!(Bridge::resources(id), Some(method2)); + assert_ok!(Bridge::set_resource(Origin::root(), id, method2.clone())); + assert_eq!(Bridge::resources(id), Some(method2)); - assert_ok!(Bridge::remove_resource(RuntimeOrigin::root(), id)); - assert_eq!(Bridge::resources(id), None); - }) + assert_ok!(Bridge::remove_resource(Origin::root(), id)); + assert_eq!(Bridge::resources(id), None); + }) } #[test] fn whitelist_chain() { - new_test_ext().execute_with(|| { - assert!(!Bridge::chain_whitelisted(0)); + new_test_ext().execute_with(|| { + assert!(!Bridge::chain_whitelisted(0)); - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), 0)); - assert_noop!( - Bridge::whitelist_chain(RuntimeOrigin::root(), TestChainId::get()), - Error::::InvalidChainId - ); + assert_ok!(Bridge::whitelist_chain(Origin::root(), 0)); + assert_noop!( + Bridge::whitelist_chain(Origin::root(), TestChainId::get()), + Error::::InvalidChainId + ); - assert_events(vec![RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(0))]); - }) + assert_events(vec![Event::Bridge(RawEvent::ChainWhitelisted(0))]); + }) } #[test] fn set_get_threshold() { - new_test_ext().execute_with(|| { - assert_eq!(::get(), 1); + new_test_ext().execute_with(|| { + assert_eq!(::get(), 1); - assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD)); - assert_eq!(::get(), TEST_THRESHOLD); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD)); + assert_eq!(::get(), TEST_THRESHOLD); - assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), 5)); - assert_eq!(::get(), 5); + assert_ok!(Bridge::set_threshold(Origin::root(), 5)); + assert_eq!(::get(), 5); - assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::RelayerThresholdChanged(TEST_THRESHOLD)), - RuntimeEvent::Bridge(RawEvent::RelayerThresholdChanged(5)), - ]); - }) + assert_events(vec![ + Event::Bridge(RawEvent::RelayerThresholdChanged(TEST_THRESHOLD)), + Event::Bridge(RawEvent::RelayerThresholdChanged(5)), + ]); + }) } #[test] fn asset_transfer_success() { - new_test_ext().execute_with(|| { - let dest_id = 2; - let to = vec![2]; - let resource_id = [1; 32]; - let metadata = vec![]; - let amount = 100; - let token_id = vec![1, 2, 3, 4]; - let method = "Erc20.transfer".as_bytes().to_vec(); - - assert_ok!(Bridge::set_resource(RuntimeOrigin::root(), resource_id, method.clone())); - assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD,)); - - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id.clone())); - assert_ok!(Bridge::transfer_fungible( - dest_id.clone(), - resource_id.clone(), - to.clone(), - amount.into() - )); - assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(dest_id.clone())), - RuntimeEvent::Bridge(RawEvent::FungibleTransfer( - dest_id.clone(), - 1, - resource_id.clone(), - amount.into(), - to.clone(), - )), - ]); - - assert_ok!(Bridge::transfer_nonfungible( - dest_id.clone(), - resource_id.clone(), - token_id.clone(), - to.clone(), - metadata.clone() - )); - assert_events(vec![RuntimeEvent::Bridge(RawEvent::NonFungibleTransfer( - dest_id.clone(), - 2, - resource_id.clone(), - token_id, - to.clone(), - metadata.clone(), - ))]); - - assert_ok!(Bridge::transfer_generic( - dest_id.clone(), - resource_id.clone(), - metadata.clone() - )); - assert_events(vec![RuntimeEvent::Bridge(RawEvent::GenericTransfer( - dest_id.clone(), - 3, - resource_id, - metadata, - ))]); - }) + new_test_ext().execute_with(|| { + let dest_id = 2; + let to = vec![2]; + let resource_id = [1; 32]; + let metadata = vec![]; + let amount = 100; + let token_id = vec![1, 2, 3, 4]; + let method = "Erc20.transfer".as_bytes().to_vec(); + + assert_ok!(Bridge::set_resource(Origin::root(), resource_id, method.clone())); + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); + + assert_ok!(Bridge::whitelist_chain(Origin::root(), dest_id.clone())); + assert_ok!(Bridge::transfer_fungible( + dest_id.clone(), + resource_id.clone(), + to.clone(), + amount.into() + )); + assert_events(vec![ + Event::Bridge(RawEvent::ChainWhitelisted(dest_id.clone())), + Event::Bridge(RawEvent::FungibleTransfer( + dest_id.clone(), + 1, + resource_id.clone(), + amount.into(), + to.clone(), + )), + ]); + + assert_ok!(Bridge::transfer_nonfungible( + dest_id.clone(), + resource_id.clone(), + token_id.clone(), + to.clone(), + metadata.clone() + )); + assert_events(vec![Event::Bridge(RawEvent::NonFungibleTransfer( + dest_id.clone(), + 2, + resource_id.clone(), + token_id, + to.clone(), + metadata.clone(), + ))]); + + assert_ok!(Bridge::transfer_generic( + dest_id.clone(), + resource_id.clone(), + metadata.clone() + )); + assert_events(vec![Event::Bridge(RawEvent::GenericTransfer( + dest_id.clone(), + 3, + resource_id, + metadata, + ))]); + }) } #[test] fn asset_transfer_invalid_resource_id() { - new_test_ext().execute_with(|| { - let dest_id = 2; - let to = vec![2]; - let resource_id = [1; 32]; - let amount = 100; - - assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD,)); - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), dest_id.clone())); - - assert_noop!( - Bridge::transfer_fungible( - dest_id.clone(), - resource_id.clone(), - to.clone(), - amount.into() - ), - Error::::ResourceDoesNotExist - ); - - assert_noop!( - Bridge::transfer_nonfungible( - dest_id.clone(), - resource_id.clone(), - vec![], - vec![], - vec![] - ), - Error::::ResourceDoesNotExist - ); - - assert_noop!( - Bridge::transfer_generic(dest_id.clone(), resource_id.clone(), vec![]), - Error::::ResourceDoesNotExist - ); - }) + new_test_ext().execute_with(|| { + let dest_id = 2; + let to = vec![2]; + let resource_id = [1; 32]; + let amount = 100; + + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); + assert_ok!(Bridge::whitelist_chain(Origin::root(), dest_id.clone())); + + assert_noop!( + Bridge::transfer_fungible(dest_id.clone(), resource_id.clone(), to.clone(), amount.into()), + Error::::ResourceDoesNotExist + ); + + assert_noop!( + Bridge::transfer_nonfungible(dest_id.clone(), resource_id.clone(), vec![], vec![], vec![]), + Error::::ResourceDoesNotExist + ); + + assert_noop!( + Bridge::transfer_generic(dest_id.clone(), resource_id.clone(), vec![]), + Error::::ResourceDoesNotExist + ); + }) } #[test] fn asset_transfer_invalid_chain() { - new_test_ext().execute_with(|| { - let chain_id = 2; - let bad_dest_id = 3; - let resource_id = [4; 32]; - - assert_ok!(Bridge::whitelist_chain(RuntimeOrigin::root(), chain_id.clone())); - assert_events(vec![RuntimeEvent::Bridge(RawEvent::ChainWhitelisted(chain_id.clone()))]); - - assert_noop!( - Bridge::transfer_fungible(bad_dest_id, resource_id.clone(), vec![], U256::zero()), - Error::::ChainNotWhitelisted - ); - - assert_noop!( - Bridge::transfer_nonfungible(bad_dest_id, resource_id.clone(), vec![], vec![], vec![]), - Error::::ChainNotWhitelisted - ); - - assert_noop!( - Bridge::transfer_generic(bad_dest_id, resource_id.clone(), vec![]), - Error::::ChainNotWhitelisted - ); - }) + new_test_ext().execute_with(|| { + let chain_id = 2; + let bad_dest_id = 3; + let resource_id = [4; 32]; + + assert_ok!(Bridge::whitelist_chain(Origin::root(), chain_id.clone())); + assert_events(vec![Event::Bridge(RawEvent::ChainWhitelisted( + chain_id.clone(), + ))]); + + assert_noop!( + Bridge::transfer_fungible(bad_dest_id, resource_id.clone(), vec![], U256::zero()), + Error::::ChainNotWhitelisted + ); + + assert_noop!( + Bridge::transfer_nonfungible(bad_dest_id, resource_id.clone(), vec![], vec![], vec![]), + Error::::ChainNotWhitelisted + ); + + assert_noop!( + Bridge::transfer_generic(bad_dest_id, resource_id.clone(), vec![]), + Error::::ChainNotWhitelisted + ); + }) } #[test] fn add_remove_relayer() { - new_test_ext().execute_with(|| { - assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), TEST_THRESHOLD,)); - assert_eq!(Bridge::relayer_count(), 0); - - assert_ok!(Bridge::add_relayer(RuntimeOrigin::root(), RELAYER_A)); - assert_ok!(Bridge::add_relayer(RuntimeOrigin::root(), RELAYER_B)); - assert_ok!(Bridge::add_relayer(RuntimeOrigin::root(), RELAYER_C)); - assert_eq!(Bridge::relayer_count(), 3); - - // Already exists - assert_noop!( - Bridge::add_relayer(RuntimeOrigin::root(), RELAYER_A), - Error::::RelayerAlreadyExists - ); - - // Confirm removal - assert_ok!(Bridge::remove_relayer(RuntimeOrigin::root(), RELAYER_B)); - assert_eq!(Bridge::relayer_count(), 2); - assert_noop!( - Bridge::remove_relayer(RuntimeOrigin::root(), RELAYER_B), - Error::::RelayerInvalid - ); - assert_eq!(Bridge::relayer_count(), 2); - - assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::RelayerAdded(RELAYER_A)), - RuntimeEvent::Bridge(RawEvent::RelayerAdded(RELAYER_B)), - RuntimeEvent::Bridge(RawEvent::RelayerAdded(RELAYER_C)), - RuntimeEvent::Bridge(RawEvent::RelayerRemoved(RELAYER_B)), - ]); - }) + new_test_ext().execute_with(|| { + assert_ok!(Bridge::set_threshold(Origin::root(), TEST_THRESHOLD,)); + assert_eq!(Bridge::relayer_count(), 0); + + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_A)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_B)); + assert_ok!(Bridge::add_relayer(Origin::root(), RELAYER_C)); + assert_eq!(Bridge::relayer_count(), 3); + + // Already exists + assert_noop!( + Bridge::add_relayer(Origin::root(), RELAYER_A), + Error::::RelayerAlreadyExists + ); + + // Confirm removal + assert_ok!(Bridge::remove_relayer(Origin::root(), RELAYER_B)); + assert_eq!(Bridge::relayer_count(), 2); + assert_noop!( + Bridge::remove_relayer(Origin::root(), RELAYER_B), + Error::::RelayerInvalid + ); + assert_eq!(Bridge::relayer_count(), 2); + + assert_events(vec![ + Event::Bridge(RawEvent::RelayerAdded(RELAYER_A)), + Event::Bridge(RawEvent::RelayerAdded(RELAYER_B)), + Event::Bridge(RawEvent::RelayerAdded(RELAYER_C)), + Event::Bridge(RawEvent::RelayerRemoved(RELAYER_B)), + ]); + }) } -fn make_proposal(r: Vec) -> mock::RuntimeCall { - RuntimeCall::System(system::Call::remark { remark: r }) +fn make_proposal(r: Vec) -> mock::Call { + Call::System(system::Call::remark{ remark: r }) } #[test] fn create_sucessful_proposal() { - let src_id = 1; - let r_id = derive_resource_id(src_id, b"remark"); - - new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { - let prop_id = 1; - let proposal = make_proposal(vec![10]); - - // Create proposal (& vote) - assert_ok!(Bridge::acknowledge_proposal( - RuntimeOrigin::signed(RELAYER_A), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - // Second relayer votes against - assert_ok!(Bridge::reject_proposal( - RuntimeOrigin::signed(RELAYER_B), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![RELAYER_B], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - // Third relayer votes in favour - assert_ok!(Bridge::acknowledge_proposal( - RuntimeOrigin::signed(RELAYER_C), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A, RELAYER_C], - votes_against: vec![RELAYER_B], - status: ProposalStatus::Approved, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_A)), - RuntimeEvent::Bridge(RawEvent::VoteAgainst(src_id, prop_id, RELAYER_B)), - RuntimeEvent::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_C)), - RuntimeEvent::Bridge(RawEvent::ProposalApproved(src_id, prop_id)), - RuntimeEvent::Bridge(RawEvent::ProposalSucceeded(src_id, prop_id)), - ]); - }) + let src_id = 1; + let r_id = derive_resource_id(src_id, b"remark"); + + new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { + let prop_id = 1; + let proposal = make_proposal(vec![10]); + + // Create proposal (& vote) + assert_ok!(Bridge::acknowledge_proposal( + Origin::signed(RELAYER_A), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + // Second relayer votes against + assert_ok!(Bridge::reject_proposal( + Origin::signed(RELAYER_B), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![RELAYER_B], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + // Third relayer votes in favour + assert_ok!(Bridge::acknowledge_proposal( + Origin::signed(RELAYER_C), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A, RELAYER_C], + votes_against: vec![RELAYER_B], + status: ProposalStatus::Approved, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + assert_events(vec![ + Event::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_A)), + Event::Bridge(RawEvent::VoteAgainst(src_id, prop_id, RELAYER_B)), + Event::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_C)), + Event::Bridge(RawEvent::ProposalApproved(src_id, prop_id)), + Event::Bridge(RawEvent::ProposalSucceeded(src_id, prop_id)), + ]); + }) } #[test] fn create_unsucessful_proposal() { - let src_id = 1; - let r_id = derive_resource_id(src_id, b"transfer"); - - new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { - let prop_id = 1; - let proposal = make_proposal(vec![11]); - - // Create proposal (& vote) - assert_ok!(Bridge::acknowledge_proposal( - RuntimeOrigin::signed(RELAYER_A), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - // Second relayer votes against - assert_ok!(Bridge::reject_proposal( - RuntimeOrigin::signed(RELAYER_B), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![RELAYER_B], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - // Third relayer votes against - assert_ok!(Bridge::reject_proposal( - RuntimeOrigin::signed(RELAYER_C), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![RELAYER_B, RELAYER_C], - status: ProposalStatus::Rejected, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - assert_eq!(Balances::free_balance(RELAYER_B), 0); - assert_eq!(Balances::free_balance(Bridge::account_id()), ENDOWED_BALANCE); - - assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_A)), - RuntimeEvent::Bridge(RawEvent::VoteAgainst(src_id, prop_id, RELAYER_B)), - RuntimeEvent::Bridge(RawEvent::VoteAgainst(src_id, prop_id, RELAYER_C)), - RuntimeEvent::Bridge(RawEvent::ProposalRejected(src_id, prop_id)), - ]); - }) + let src_id = 1; + let r_id = derive_resource_id(src_id, b"transfer"); + + new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { + let prop_id = 1; + let proposal = make_proposal(vec![11]); + + // Create proposal (& vote) + assert_ok!(Bridge::acknowledge_proposal( + Origin::signed(RELAYER_A), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + // Second relayer votes against + assert_ok!(Bridge::reject_proposal( + Origin::signed(RELAYER_B), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![RELAYER_B], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + // Third relayer votes against + assert_ok!(Bridge::reject_proposal( + Origin::signed(RELAYER_C), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![RELAYER_B, RELAYER_C], + status: ProposalStatus::Rejected, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + assert_eq!(Balances::free_balance(RELAYER_B), 0); + assert_eq!( + Balances::free_balance(Bridge::account_id()), + ENDOWED_BALANCE + ); + + assert_events(vec![ + Event::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_A)), + Event::Bridge(RawEvent::VoteAgainst(src_id, prop_id, RELAYER_B)), + Event::Bridge(RawEvent::VoteAgainst(src_id, prop_id, RELAYER_C)), + Event::Bridge(RawEvent::ProposalRejected(src_id, prop_id)), + ]); + }) } #[test] fn execute_after_threshold_change() { - let src_id = 1; - let r_id = derive_resource_id(src_id, b"transfer"); - - new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { - let prop_id = 1; - let proposal = make_proposal(vec![11]); - - // Create proposal (& vote) - assert_ok!(Bridge::acknowledge_proposal( - RuntimeOrigin::signed(RELAYER_A), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - // Change threshold - assert_ok!(Bridge::set_threshold(RuntimeOrigin::root(), 1)); - - // Attempt to execute - assert_ok!(Bridge::eval_vote_state( - RuntimeOrigin::signed(RELAYER_A), - prop_id, - src_id, - Box::new(proposal.clone()) - )); - - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![], - status: ProposalStatus::Approved, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - assert_eq!(Balances::free_balance(RELAYER_B), 0); - assert_eq!(Balances::free_balance(Bridge::account_id()), ENDOWED_BALANCE); - - assert_events(vec![ - RuntimeEvent::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_A)), - RuntimeEvent::Bridge(RawEvent::RelayerThresholdChanged(1)), - RuntimeEvent::Bridge(RawEvent::ProposalApproved(src_id, prop_id)), - RuntimeEvent::Bridge(RawEvent::ProposalSucceeded(src_id, prop_id)), - ]); - }) + let src_id = 1; + let r_id = derive_resource_id(src_id, b"transfer"); + + new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { + let prop_id = 1; + let proposal = make_proposal(vec![11]); + + // Create proposal (& vote) + assert_ok!(Bridge::acknowledge_proposal( + Origin::signed(RELAYER_A), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + // Change threshold + assert_ok!(Bridge::set_threshold(Origin::root(), 1)); + + // Attempt to execute + assert_ok!(Bridge::eval_vote_state( + Origin::signed(RELAYER_A), + prop_id, + src_id, + Box::new(proposal.clone()) + )); + + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![], + status: ProposalStatus::Approved, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + assert_eq!(Balances::free_balance(RELAYER_B), 0); + assert_eq!( + Balances::free_balance(Bridge::account_id()), + ENDOWED_BALANCE + ); + + assert_events(vec![ + Event::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_A)), + Event::Bridge(RawEvent::RelayerThresholdChanged(1)), + Event::Bridge(RawEvent::ProposalApproved(src_id, prop_id)), + Event::Bridge(RawEvent::ProposalSucceeded(src_id, prop_id)), + ]); + }) } #[test] fn proposal_expires() { - let src_id = 1; - let r_id = derive_resource_id(src_id, b"remark"); - - new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { - let prop_id = 1; - let proposal = make_proposal(vec![10]); - - // Create proposal (& vote) - assert_ok!(Bridge::acknowledge_proposal( - RuntimeOrigin::signed(RELAYER_A), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - )); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - // Increment enough blocks such that now == expiry - System::set_block_number(ProposalLifetime::get() + 1); - - // Attempt to submit a vote should fail - assert_noop!( - Bridge::reject_proposal( - RuntimeOrigin::signed(RELAYER_B), - prop_id, - src_id, - r_id, - Box::new(proposal.clone()) - ), - Error::::ProposalExpired - ); - - // Proposal state should remain unchanged - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - // eval_vote_state should have no effect - assert_noop!( - Bridge::eval_vote_state( - RuntimeOrigin::signed(RELAYER_C), - prop_id, - src_id, - Box::new(proposal.clone()) - ), - Error::::ProposalExpired - ); - let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); - let expected = ProposalVotes { - votes_for: vec![RELAYER_A], - votes_against: vec![], - status: ProposalStatus::Initiated, - expiry: ProposalLifetime::get() + 1, - }; - assert_eq!(prop, expected); - - assert_events(vec![RuntimeEvent::Bridge(RawEvent::VoteFor(src_id, prop_id, RELAYER_A))]); - }) + let src_id = 1; + let r_id = derive_resource_id(src_id, b"remark"); + + new_test_ext_initialized(src_id, r_id, b"System.remark".to_vec()).execute_with(|| { + let prop_id = 1; + let proposal = make_proposal(vec![10]); + + // Create proposal (& vote) + assert_ok!(Bridge::acknowledge_proposal( + Origin::signed(RELAYER_A), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + )); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + // Increment enough blocks such that now == expiry + System::set_block_number(ProposalLifetime::get() + 1); + + // Attempt to submit a vote should fail + assert_noop!( + Bridge::reject_proposal( + Origin::signed(RELAYER_B), + prop_id, + src_id, + r_id, + Box::new(proposal.clone()) + ), + Error::::ProposalExpired + ); + + // Proposal state should remain unchanged + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + // eval_vote_state should have no effect + assert_noop!( + Bridge::eval_vote_state( + Origin::signed(RELAYER_C), + prop_id, + src_id, + Box::new(proposal.clone()) + ), + Error::::ProposalExpired + ); + let prop = Bridge::votes(src_id, (prop_id.clone(), proposal.clone())).unwrap(); + let expected = ProposalVotes { + votes_for: vec![RELAYER_A], + votes_against: vec![], + status: ProposalStatus::Initiated, + expiry: ProposalLifetime::get() + 1, + }; + assert_eq!(prop, expected); + + assert_events(vec![Event::Bridge(RawEvent::VoteFor( + src_id, prop_id, RELAYER_A, + ))]); + }) } diff --git a/pallets/ddc-metrics-offchain-worker/Cargo.toml b/pallets/ddc-metrics-offchain-worker/Cargo.toml index e9de68b71..cbc8209f2 100644 --- a/pallets/ddc-metrics-offchain-worker/Cargo.toml +++ b/pallets/ddc-metrics-offchain-worker/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-ddc-metrics-offchain-worker" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" license = "Unlicense" @@ -14,19 +14,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["full"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } serde = { version = "1.0.136", optional = true } -sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts = { version = '4.0.0-dev', default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-keystore = { version = "0.12.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts = { version = '4.0.0-dev', default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } lite-json = { version = "0.2.0", default-features = false } alt_serde = { version = "1", default-features = false, features = ["derive"] } serde_json = { version = "1", default-features = false, git = "https://github.com/Cerebellum-Network/json", branch = "no-std-cere", features = ["alloc"] } -# pallet-contracts-rpc-runtime-api = { version = "0.8.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +# pallet-contracts-rpc-runtime-api = { version = "0.8.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } hex-literal = "^0.3.1" hex = { version = "0.4", default-features = false } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } @@ -49,7 +49,7 @@ std = [ ] [dev-dependencies] -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-randomness-collective-flip = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-randomness-collective-flip = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } pretty_assertions = "0.6.1" diff --git a/pallets/ddc-metrics-offchain-worker/src/lib.rs b/pallets/ddc-metrics-offchain-worker/src/lib.rs index 5c6c07892..34e8798d1 100644 --- a/pallets/ddc-metrics-offchain-worker/src/lib.rs +++ b/pallets/ddc-metrics-offchain-worker/src/lib.rs @@ -9,22 +9,22 @@ mod tests; use alt_serde::{de::DeserializeOwned, Deserialize}; use codec::{Decode, Encode, HasCompact}; +use frame_support::traits::{Currency, Get}; use frame_support::{ - decl_event, decl_module, decl_storage, - log::{error, info, warn}, - traits::{Currency, Get}, + log::{error, info, warn}, + decl_event, decl_module, decl_storage, }; use frame_system::offchain::{ - AppCrypto, CreateSignedTransaction, SendSignedTransaction, Signer, SigningTypes, + AppCrypto, CreateSignedTransaction, SendSignedTransaction, Signer, SigningTypes, }; use hex_literal::hex; use pallet_contracts; use sp_core::crypto::{KeyTypeId, UncheckedFrom}; use sp_runtime::{ - offchain::{http, storage::StorageValueRef, Duration}, - traits::StaticLookup, - AccountId32, + offchain::{http, storage::StorageValueRef, Duration}, + traits::StaticLookup, + AccountId32, }; use sp_std::vec::Vec; @@ -47,40 +47,39 @@ pub const CURRENT_PERIOD_MS: [u8; 4] = hex!("ace4ecb3"); pub const GET_ALL_DDC_NODES_SELECTOR: [u8; 4] = hex!("e6c98b60"); pub const FINALIZE_METRIC_PERIOD: [u8; 4] = hex!("b269d557"); -type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; +type BalanceOf = +<::Currency as Currency<::AccountId>>::Balance; #[derive(Encode, Decode)] pub struct DDCNode { - p2p_id: String, - p2p_addr: String, - url: String, - permissions: u64, + p2p_id: String, + p2p_addr: String, + url: String, + permissions: u64, } struct Metric { - app_id: String, - storage_bytes: u64, - wcu_used: u64, - rcu_used: u64, + app_id: String, + storage_bytes: u64, + wcu_used: u64, + rcu_used: u64, } struct MetricDDN { - p2p_id: String, - storage_bytes: u64, - wcu_used: u64, - rcu_used: u64, + p2p_id: String, + storage_bytes: u64, + wcu_used: u64, + rcu_used: u64, } #[derive(Deserialize)] #[serde(crate = "alt_serde")] #[allow(non_snake_case)] struct ApiMetric { - appPubKey: String, - storageBytes: u64, - wcuUsed: u64, - rcuUsed: u64, + appPubKey: String, + storageBytes: u64, + wcuUsed: u64, + rcuUsed: u64, } /// Defines application identifier for crypto keys of this module. @@ -103,30 +102,30 @@ pub const HTTP_TIMEOUT_MS: u64 = 30_000; // in milli-seconds /// We can use from supported crypto kinds (`sr25519`, `ed25519` and `ecdsa`) and augment /// the types with this pallet-specific identifier. pub mod crypto { - use super::KEY_TYPE; - use frame_system::offchain::AppCrypto; - use sp_core::sr25519::Signature as Sr25519Signature; - use sp_runtime::{ - app_crypto::{app_crypto, sr25519}, - traits::Verify, - }; - app_crypto!(sr25519, KEY_TYPE); - - use sp_runtime::{MultiSignature, MultiSigner}; - - pub struct TestAuthId; - - impl AppCrypto<::Signer, Sr25519Signature> for TestAuthId { - type RuntimeAppPublic = Public; - type GenericSignature = sp_core::sr25519::Signature; - type GenericPublic = sp_core::sr25519::Public; - } - - impl AppCrypto for TestAuthId { - type RuntimeAppPublic = Public; - type GenericSignature = sp_core::sr25519::Signature; - type GenericPublic = sp_core::sr25519::Public; - } + use super::KEY_TYPE; + use frame_system::offchain::AppCrypto; + use sp_core::sr25519::Signature as Sr25519Signature; + use sp_runtime::{ + app_crypto::{app_crypto, sr25519}, + traits::Verify, + }; + app_crypto!(sr25519, KEY_TYPE); + + use sp_runtime::{MultiSignature, MultiSigner}; + + pub struct TestAuthId; + + impl AppCrypto<::Signer, Sr25519Signature> for TestAuthId { + type RuntimeAppPublic = Public; + type GenericSignature = sp_core::sr25519::Signature; + type GenericPublic = sp_core::sr25519::Public; + } + + impl AppCrypto for TestAuthId { + type RuntimeAppPublic = Public; + type GenericSignature = sp_core::sr25519::Signature; + type GenericPublic = sp_core::sr25519::Public; + } } type ResultStr = Result; @@ -134,288 +133,291 @@ type ResultStr = Result; const MS_PER_DAY: u64 = 24 * 3600 * 1000; decl_module! { - /// A public part of the pallet. - pub struct Module for enum Call where - origin: T::RuntimeOrigin, - ::AccountId: AsRef<[u8]>, - ::AccountId: UncheckedFrom, - as HasCompact>::Type: Clone, - as HasCompact>::Type: Eq, - as HasCompact>::Type: PartialEq, - as HasCompact>::Type: Debug, - as HasCompact>::Type: TypeInfo, - as HasCompact>::Type: Encode { - //fn deposit_event() = default; - - /// Offchain Worker entry point. - /// - /// By implementing `fn offchain_worker` within `decl_module!` you declare a new offchain - /// worker. - /// This function will be called when the node is fully synced and a new best block is - /// succesfuly imported. - /// Note that it's not guaranteed for offchain workers to run on EVERY block, there might - /// be cases where some blocks are skipped, or for some the worker runs twice (re-orgs), - /// so the code should be able to handle that. - /// You can use `Local Storage` API to coordinate runs of the worker. - /// You can use `debug::native` namespace to not log in wasm mode. - fn offchain_worker(block_number: T::BlockNumber) { - let res = Self::offchain_worker_main(block_number); - match res { - Ok(()) => info!("[OCW] Offchain Worker complete."), - Err(err) => error!("[OCW] Error in Offchain Worker: {}", err), - }; - } - } + /// A public part of the pallet. + pub struct Module for enum Call where + origin: T::Origin, + ::AccountId: AsRef<[u8]>, + ::AccountId: UncheckedFrom, + as HasCompact>::Type: Clone, + as HasCompact>::Type: Eq, + as HasCompact>::Type: PartialEq, + as HasCompact>::Type: Debug, + as HasCompact>::Type: TypeInfo, + as HasCompact>::Type: Encode { + //fn deposit_event() = default; + + /// Offchain Worker entry point. + /// + /// By implementing `fn offchain_worker` within `decl_module!` you declare a new offchain + /// worker. + /// This function will be called when the node is fully synced and a new best block is + /// succesfuly imported. + /// Note that it's not guaranteed for offchain workers to run on EVERY block, there might + /// be cases where some blocks are skipped, or for some the worker runs twice (re-orgs), + /// so the code should be able to handle that. + /// You can use `Local Storage` API to coordinate runs of the worker. + /// You can use `debug::native` namespace to not log in wasm mode. + fn offchain_worker(block_number: T::BlockNumber) { + let res = Self::offchain_worker_main(block_number); + match res { + Ok(()) => info!("[OCW] Offchain Worker complete."), + Err(err) => error!("[OCW] Error in Offchain Worker: {}", err), + }; + } + } } decl_storage! { - trait Store for Module as DdcMetricsOffchainWorker - where ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode { - } + trait Store for Module as DdcMetricsOffchainWorker + where ::AccountId: AsRef<[u8]> + UncheckedFrom, + as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode { + } } impl Module -where - ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, -{ - fn offchain_worker_main(block_number: T::BlockNumber) -> ResultStr<()> { - let signer = match Self::get_signer() { - Err(e) => { - warn!("{:?}", e); - return Ok(()) - }, - Ok(signer) => signer, - }; - - let contract_address = match Self::get_contract_id() { - None => return Ok(()), - Some(contract_address) => contract_address, - }; - - let should_proceed = Self::check_if_should_proceed(block_number); - if should_proceed == false { - return Ok(()) - } + where ::AccountId: AsRef<[u8]> + UncheckedFrom, + as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode { + fn offchain_worker_main(block_number: T::BlockNumber) -> ResultStr<()> { + let signer = match Self::get_signer() { + Err(e) => { + warn!("{:?}", e); + return Ok(()); + } + Ok(signer) => signer, + }; + + let contract_address = match Self::get_contract_id() { + None => return Ok(()), + Some(contract_address) => contract_address, + }; + + let should_proceed = Self::check_if_should_proceed(block_number); + if should_proceed == false { + return Ok(()); + } + + let day_start_ms = + Self::sc_get_current_period_ms(contract_address.clone()).map_err(|err| { + error!("[OCW] Contract error occurred: {:?}", err); + "Could not call get_current_period_ms TX" + })?; + + let day_end_ms = day_start_ms + MS_PER_DAY; + + let (aggregated_metrics, ddn_aggregated_metrics, offline_nodes) = + Self::fetch_all_metrics(contract_address.clone(), day_start_ms).map_err(|err| { + error!("[OCW] HTTP error occurred: {:?}", err); + "could not fetch metrics" + })?; + + for offline_node in offline_nodes { + let p2p_id = offline_node.p2p_id; + let contract_id = contract_address.clone(); + Self::report_ddn_status_to_sc(contract_id, &signer, &p2p_id, false).map_err(|err| { + error!("[OCW] Contract error occurred: {:?}", err); + "could not submit report_ddn_status TX" + })?; + } + + Self::send_metrics_to_sc( + contract_address.clone(), + &signer, + day_start_ms, + aggregated_metrics, + ) + .map_err(|err| { + error!("[OCW] Contract error occurred: {:?}", err); + "could not submit report_metrics TX" + })?; + + Self::send_metrics_ddn_to_sc( + contract_address.clone(), + &signer, + day_start_ms, + ddn_aggregated_metrics, + ) + .map_err(|err| { + error!("[OCW] Contract error occurred: {:?}", err); + "could not submit report_metrics_ddn TX" + })?; + + let block_timestamp = sp_io::offchain::timestamp().unix_millis(); + + if day_end_ms < block_timestamp { + Self::finalize_metric_period(contract_address.clone(), &signer, day_start_ms).map_err( + |err| { + error!("[OCW] Contract error occurred: {:?}", err); + "could not call finalize_metric_period TX" + }, + )?; + } + + Ok(()) + } + + fn get_contract_id() -> Option<::AccountId> { + let value = StorageValueRef::persistent(b"ddc-metrics-offchain-worker::sc_address").get(); + + match value { + Ok(None) => { + warn!("[OCW] Smart Contract is not configured. Please configure it using offchain_localStorageSet with key=ddc-metrics-offchain-worker::sc_address"); + None + } + Ok(Some(contract_address)) => Some(contract_address), + Err(_) => { + error!("[OCW] Smart Contract is configured but the value could not be decoded to an account ID"); + None + } + } + } - let day_start_ms = - Self::sc_get_current_period_ms(contract_address.clone()).map_err(|err| { - error!("[OCW] Contract error occurred: {:?}", err); - "Could not call get_current_period_ms TX" - })?; - - let day_end_ms = day_start_ms + MS_PER_DAY; - - let (aggregated_metrics, ddn_aggregated_metrics, offline_nodes) = - Self::fetch_all_metrics(contract_address.clone(), day_start_ms).map_err(|err| { - error!("[OCW] HTTP error occurred: {:?}", err); - "could not fetch metrics" - })?; - - for offline_node in offline_nodes { - let p2p_id = offline_node.p2p_id; - let contract_id = contract_address.clone(); - Self::report_ddn_status_to_sc(contract_id, &signer, &p2p_id, false).map_err(|err| { - error!("[OCW] Contract error occurred: {:?}", err); - "could not submit report_ddn_status TX" - })?; - } - - Self::send_metrics_to_sc( - contract_address.clone(), - &signer, - day_start_ms, - aggregated_metrics, - ) - .map_err(|err| { - error!("[OCW] Contract error occurred: {:?}", err); - "could not submit report_metrics TX" - })?; - - Self::send_metrics_ddn_to_sc( - contract_address.clone(), - &signer, - day_start_ms, - ddn_aggregated_metrics, - ) - .map_err(|err| { - error!("[OCW] Contract error occurred: {:?}", err); - "could not submit report_metrics_ddn TX" - })?; - - let block_timestamp = sp_io::offchain::timestamp().unix_millis(); - - if day_end_ms < block_timestamp { - Self::finalize_metric_period(contract_address.clone(), &signer, day_start_ms).map_err( - |err| { - error!("[OCW] Contract error occurred: {:?}", err); - "could not call finalize_metric_period TX" - }, - )?; - } - - Ok(()) - } - - fn get_contract_id() -> Option<::AccountId> { - let value = StorageValueRef::persistent(b"ddc-metrics-offchain-worker::sc_address").get(); + fn get_block_interval() -> Option { + let value = StorageValueRef::persistent(b"ddc-metrics-offchain-worker::block_interval").get::(); match value { Ok(None) => { - warn!("[OCW] Smart Contract is not configured. Please configure it using offchain_localStorageSet with key=ddc-metrics-offchain-worker::sc_address"); None - }, - Ok(Some(contract_address)) => Some(contract_address), - Err(_) => { - error!("[OCW] Smart Contract is configured but the value could not be decoded to an account ID"); - None - }, + } + Ok(Some(block_interval)) => Some(block_interval), + Err(_) => { + error!("[OCW] Block Interval could not be decoded"); + None + } } } - fn get_block_interval() -> Option { - let value = StorageValueRef::persistent(b"ddc-metrics-offchain-worker::block_interval") - .get::(); + fn check_if_should_proceed(block_number: T::BlockNumber) -> bool { + let s_next_at = StorageValueRef::persistent(b"ddc-metrics-offchain-worker::next-at"); - match value { - Ok(None) => None, - Ok(Some(block_interval)) => Some(block_interval), - Err(_) => { - error!("[OCW] Block Interval could not be decoded"); - None - }, - } - } + match s_next_at.mutate(|current_next_at| { + let current_next_at = match current_next_at { + Ok(Some(val)) => Some(val), + _ => Some(T::BlockNumber::default()), + }; - fn check_if_should_proceed(block_number: T::BlockNumber) -> bool { - let s_next_at = StorageValueRef::persistent(b"ddc-metrics-offchain-worker::next-at"); - - match s_next_at.mutate(|current_next_at| { - let current_next_at = match current_next_at { - Ok(Some(val)) => Some(val), - _ => Some(T::BlockNumber::default()), - }; - - if let Some(current_next_at) = current_next_at { - if current_next_at > block_number { - info!( - "[OCW] Too early to execute. Current: {:?}, next execution at: {:?}", - block_number, current_next_at - ); - Err("Skipping") - } else { + if let Some(current_next_at) = current_next_at { + if current_next_at > block_number { + info!( + "[OCW] Too early to execute. Current: {:?}, next execution at: {:?}", + block_number, current_next_at + ); + Err("Skipping") + } else { let block_interval_configured = Self::get_block_interval(); let mut block_interval = T::BlockInterval::get(); if block_interval_configured.is_some() { - block_interval = ::BlockNumber::from( - block_interval_configured.unwrap(), - ); + block_interval = ::BlockNumber::from(block_interval_configured.unwrap()); } - // set new value - Ok(block_interval + block_number) - } - } else { - error!("[OCW] Something went wrong in `check_if_should_proceed`"); - Err("Unexpected error") - } - }) { - Ok(_val) => true, - Err(_e) => false, - } - } - - fn get_start_of_day_ms() -> u64 { - let now = sp_io::offchain::timestamp(); - let day_start_ms = (now.unix_millis() / MS_PER_DAY) * MS_PER_DAY; - day_start_ms - } - - fn get_signer() -> ResultStr> { - let signer = Signer::<_, _>::any_account(); - if !signer.can_sign() { - return Err("[OCW] No local accounts available. Consider adding one via `author_insertKey` RPC."); - } - Ok(signer) - } - - fn sc_get_current_period_ms( - contract_id: ::AccountId, - ) -> ResultStr { - let call_data = Self::encode_get_current_period_ms(); - let nobody = T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()); - let contract_exec_result = pallet_contracts::Pallet::::bare_call( - nobody.unwrap(), - contract_id, - 0u32.into(), - Weight::from_ref_time(100_000_000_000), - None, - call_data, - false, - ); - - let mut data = match &contract_exec_result.result { - Ok(v) => &v.data[..], - Err(exec_error) => { - // Return default value in case of error - warn!("[OCW] Error in call get_current_period_ms of smart contract. Return default value for period. Details: {:?}", exec_error); - return Ok(Self::get_start_of_day_ms()) - }, - }; - - let current_period_ms = u64::decode(&mut data) - .map_err(|_| "[OCW] error decoding get_current_period_ms result")?; - - info!("[OCW] sc_get_current_period_ms - data response from sc: {:?}", current_period_ms); - - Ok(current_period_ms) - } - - fn finalize_metric_period( - contract_id: ::AccountId, - signer: &Signer, - in_day_start_ms: u64, - ) -> ResultStr<()> { - let contract_id_unl = - <::Lookup as StaticLookup>::unlookup(contract_id); - - let call_data = Self::encode_finalize_metric_period(in_day_start_ms); - - let results = signer.send_signed_transaction(|_account| pallet_contracts::Call::call { - dest: contract_id_unl.clone(), - value: 0u32.into(), - gas_limit: Weight::from_ref_time(100_000_000_000), - storage_deposit_limit: None, - data: call_data.clone(), - }); - - match &results { - None | Some((_, Err(()))) => - return Err("Error while submitting finalize_metric_period TX to SC"), - Some((_, Ok(()))) => {}, - } - - Ok(()) - } - - fn send_metrics_to_sc( - contract_id: ::AccountId, - signer: &Signer, - day_start_ms: u64, - metrics: Vec, - ) -> ResultStr<()> { - info!("[OCW] Using Contract Address: {:?}", contract_id); - - for one_metric in metrics.iter() { - let app_id = Self::account_id_from_hex(&one_metric.app_id)?; - - if one_metric.storage_bytes == 0 && one_metric.wcu_used == 0 && one_metric.rcu_used == 0 - { - continue - } - - let results = signer.send_signed_transaction(|account| { + // set new value + Ok(block_interval + block_number) + } + } else { + error!("[OCW] Something went wrong in `check_if_should_proceed`"); + Err("Unexpected error") + } + }) { + Ok(_val) => true, + Err(_e) => false, + } + } + + fn get_start_of_day_ms() -> u64 { + let now = sp_io::offchain::timestamp(); + let day_start_ms = (now.unix_millis() / MS_PER_DAY) * MS_PER_DAY; + day_start_ms + } + + fn get_signer() -> ResultStr> { + let signer = Signer::<_, _>::any_account(); + if !signer.can_sign() { + return Err("[OCW] No local accounts available. Consider adding one via `author_insertKey` RPC."); + } + Ok(signer) + } + + fn sc_get_current_period_ms( + contract_id: ::AccountId, + ) -> ResultStr { + let call_data = Self::encode_get_current_period_ms(); + let nobody = T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()); + let contract_exec_result = pallet_contracts::Pallet::::bare_call( + nobody.unwrap(), + contract_id, + 0u32.into(), + Weight::from_ref_time(100_000_000_000), + None, + call_data, + false, + ); + + let mut data = match &contract_exec_result.result { + Ok(v) => &v.data[..], + Err(exec_error) => { + // Return default value in case of error + warn!("[OCW] Error in call get_current_period_ms of smart contract. Return default value for period. Details: {:?}", exec_error); + return Ok(Self::get_start_of_day_ms()); + } + }; + + let current_period_ms = u64::decode(&mut data) + .map_err(|_| "[OCW] error decoding get_current_period_ms result")?; + + info!( + "[OCW] sc_get_current_period_ms - data response from sc: {:?}", + current_period_ms + ); + + Ok(current_period_ms) + } + + fn finalize_metric_period( + contract_id: ::AccountId, + signer: &Signer, + in_day_start_ms: u64, + ) -> ResultStr<()> { + let contract_id_unl = + <::Lookup as StaticLookup>::unlookup(contract_id); + + let call_data = Self::encode_finalize_metric_period(in_day_start_ms); + + let results = signer.send_signed_transaction(|_account| { + pallet_contracts::Call::call { + dest: contract_id_unl.clone(), + value: 0u32.into(), + gas_limit: Weight::from_ref_time(100_000_000_000), + storage_deposit_limit: None, + data: call_data.clone(), + } + }); + + match &results { + None | Some((_, Err(()))) => { + return Err("Error while submitting finalize_metric_period TX to SC") + } + Some((_, Ok(()))) => {} + } + + Ok(()) + } + + fn send_metrics_to_sc( + contract_id: ::AccountId, + signer: &Signer, + day_start_ms: u64, + metrics: Vec, + ) -> ResultStr<()> { + info!("[OCW] Using Contract Address: {:?}", contract_id); + + for one_metric in metrics.iter() { + let app_id = Self::account_id_from_hex(&one_metric.app_id)?; + + if one_metric.storage_bytes == 0 && one_metric.wcu_used == 0 && one_metric.rcu_used == 0 + { + continue; + } + + let results = signer.send_signed_transaction(|account| { info!( "[OCW] Sending transactions from {:?}: report_metrics({:?}, {:?}, {:?}, {:?}, {:?})", account.id, @@ -448,25 +450,25 @@ where } }); - match &results { - None | Some((_, Err(()))) => return Err("Error while submitting TX to SC"), - Some((_, Ok(()))) => {}, - } - } - - Ok(()) - } - - fn send_metrics_ddn_to_sc( - contract_id: ::AccountId, - signer: &Signer, - day_start_ms: u64, - metrics: Vec, - ) -> ResultStr<()> { - info!("[OCW] Using Contract Address: {:?}", contract_id); - - for one_metric in metrics.iter() { - let results = signer.send_signed_transaction(|account| { + match &results { + None | Some((_, Err(()))) => return Err("Error while submitting TX to SC"), + Some((_, Ok(()))) => {} + } + } + + Ok(()) + } + + fn send_metrics_ddn_to_sc( + contract_id: ::AccountId, + signer: &Signer, + day_start_ms: u64, + metrics: Vec, + ) -> ResultStr<()> { + info!("[OCW] Using Contract Address: {:?}", contract_id); + + for one_metric in metrics.iter() { + let results = signer.send_signed_transaction(|account| { info!( "[OCW] Sending transactions from {:?}: report_metrics_ddn({:?}, {:?}, {:?}, {:?}, {:?})", account.id, @@ -498,346 +500,362 @@ where } }); - match &results { - None | Some((_, Err(()))) => return Err("Error while submitting TX to SC"), - Some((_, Ok(()))) => {}, - } - } - - Ok(()) - } - - fn report_ddn_status_to_sc( - contract_id: ::AccountId, - signer: &Signer, - p2p_id: &String, - is_online: bool, - ) -> ResultStr<()> { - info!("[OCW] Using Contract Address: {:?}", contract_id); - - let results = signer.send_signed_transaction(|account| { - info!( - "[OCW] Sending transactions from {:?}: report_ddn_status({:?}, {:?})", - account.id, p2p_id, is_online, - ); - - let call_data = Self::encode_report_ddn_status(&p2p_id, is_online); - - let contract_id_unl = <::Lookup as StaticLookup>::unlookup( - contract_id.clone(), - ); - - pallet_contracts::Call::call { - dest: contract_id_unl, - value: 0u32.into(), - gas_limit: Weight::from_ref_time(100_000_000_000), - storage_deposit_limit: None, - data: call_data, - } - }); - - match &results { - None | Some((_, Err(()))) => return Err("Error while submitting TX to SC"), - Some((_, Ok(()))) => {}, - } - - Ok(()) - } - - fn fetch_all_metrics( - contract_id: ::AccountId, - day_start_ms: u64, - ) -> ResultStr<(Vec, Vec, Vec)> { - let a_moment_ago_ms = sp_io::offchain::timestamp() - .sub(Duration::from_millis(END_TIME_DELAY_MS)) - .unix_millis(); - - let mut aggregated_metrics = MetricsAggregator::default(); - let mut ddn_aggregated_metrics = DDNMetricsAggregator::default(); - - let nodes = Self::fetch_nodes(contract_id)?; - let mut offline_nodes: Vec = Vec::new(); - - for node in nodes { - let metrics_of_node = - match Self::fetch_node_metrics(&node.url, day_start_ms, a_moment_ago_ms) { - Ok(value) => value, - Err(_) => { - offline_nodes.push(node); - continue - }, - }; - - ddn_aggregated_metrics.add(node.p2p_id.clone(), &metrics_of_node); - - for metric in &metrics_of_node { - aggregated_metrics.add(metric); - } - } - - Ok((aggregated_metrics.finish(), ddn_aggregated_metrics.finish(), offline_nodes)) - } - - fn fetch_nodes(contract_id: ::AccountId) -> ResultStr> { - let nobody = T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()); - let call_data = Self::encode_get_all_ddc_nodes(); - let contract_exec_result = pallet_contracts::Pallet::::bare_call( - nobody.unwrap(), - contract_id, - 0u32.into(), - Weight::from_ref_time(100_000_000_000), - None, - call_data, - false, - ); - - let mut data = match &contract_exec_result.result { - Ok(v) => &v.data[..], - Err(exec_error) => { - warn!( - "[OCW] Error in call get_all_ddc_nodes of smart contract. Error: {:?}", - exec_error - ); - return Ok(Vec::new()) - }, - }; - - let ddc_nodes = Vec::::decode(&mut data) - .map_err(|_| "[OCW] error decoding get_all_ddc_nodes result")?; - - Ok(ddc_nodes) - } - - fn fetch_node_metrics( - node_url: &str, - day_start_ms: u64, - end_ms: u64, - ) -> ResultStr> { - let metrics_url = format!( - "{}{}{}{}{}{}", - node_url, - HTTP_METRICS, - METRICS_PARAM_FROM, - day_start_ms / 1000, - METRICS_PARAM_TO, - end_ms / 1000 - ); - - let metrics: Vec = Self::http_get_json(&metrics_url)?; - - Ok(metrics - .into_iter() - .map(|data| Metric { - app_id: data.appPubKey, - storage_bytes: data.storageBytes, - wcu_used: data.wcuUsed, - rcu_used: data.rcuUsed, - }) - .collect()) - } - - fn http_get_json(url: &str) -> ResultStr { - let body = Self::http_get_request(url).map_err(|err| { - error!("[OCW] Error while getting {}: {:?}", url, err); - "HTTP GET error" - })?; - - let parsed = serde_json::from_slice(&body).map_err(|err| { - warn!("[OCW] Error while parsing JSON from {}: {:?}", url, err); - "HTTP JSON parse error" - }); - - parsed - } - - fn http_get_request(http_url: &str) -> Result, http::Error> { - info!("[OCW] Sending request to: {:?}", http_url); - - // Initiate an external HTTP GET request. This is using high-level wrappers from - // `sp_runtime`. - let request = http::Request::get(http_url); - - let deadline = sp_io::offchain::timestamp().add(Duration::from_millis(HTTP_TIMEOUT_MS)); - - let pending = request.deadline(deadline).send().map_err(|_| http::Error::IoError)?; - - let response = pending.try_wait(deadline).map_err(|_| http::Error::DeadlineReached)??; - - if response.code != 200 { - warn!("[OCW] http_get_request unexpected status code: {}", response.code); - return Err(http::Error::Unknown) - } - - // Next we fully read the response body and collect it to a vector of bytes. - Ok(response.body().collect::>()) - } - - /// Prepare get_current_period_ms call params. - /// Must match the contract function here: https://github.com/Cerebellum-Network/cere-enterprise-smart-contracts/blob/dev/cere02/lib.rs - fn encode_get_current_period_ms() -> Vec { - CURRENT_PERIOD_MS.to_vec() - } - - /// Prepare encode_get_current_period_ms call params. - fn encode_get_all_ddc_nodes() -> Vec { - GET_ALL_DDC_NODES_SELECTOR.to_vec() - } - - /// Prepare finalize_metric_period call params. - /// Must match the contract function here: https://github.com/Cerebellum-Network/cere-enterprise-smart-contracts/blob/dev/cere02/lib.rs - fn encode_finalize_metric_period(in_day_start_ms: u64) -> Vec { - let mut call_data = FINALIZE_METRIC_PERIOD.to_vec(); - in_day_start_ms.encode_to(&mut call_data); - - call_data - } - - /// Prepare report_metrics call params. - /// Must match the contract function here: https://github.com/Cerebellum-Network/cere-enterprise-smart-contracts/blob/dev/cere02/lib.rs - fn encode_report_metrics( - app_id: &AccountId32, - day_start_ms: u64, - storage_bytes: u64, - wcu_used: u64, - rcu_used: u64, - ) -> Vec { - let mut call_data = REPORT_METRICS_SELECTOR.to_vec(); - app_id.encode_to(&mut call_data); - day_start_ms.encode_to(&mut call_data); - storage_bytes.encode_to(&mut call_data); - wcu_used.encode_to(&mut call_data); - rcu_used.encode_to(&mut call_data); - - call_data - } - - fn encode_report_metrics_ddn( - p2p_id: String, - day_start_ms: u64, - storage_bytes: u64, - wcu_used: u64, - rcu_used: u64, - ) -> Vec { - let mut call_data = REPORT_METRICS_DDN_SELECTOR.to_vec(); - p2p_id.encode_to(&mut call_data); - day_start_ms.encode_to(&mut call_data); - storage_bytes.encode_to(&mut call_data); - wcu_used.encode_to(&mut call_data); - rcu_used.encode_to(&mut call_data); - - call_data - } - - fn encode_report_ddn_status(p2p_id: &String, is_online: bool) -> Vec { - let mut call_data = REPORT_DDN_STATUS_SELECTOR.to_vec(); - p2p_id.encode_to(&mut call_data); - is_online.encode_to(&mut call_data); - call_data - } + match &results { + None | Some((_, Err(()))) => return Err("Error while submitting TX to SC"), + Some((_, Ok(()))) => {} + } + } + + Ok(()) + } + + fn report_ddn_status_to_sc( + contract_id: ::AccountId, + signer: &Signer, + p2p_id: &String, + is_online: bool, + ) -> ResultStr<()> { + info!("[OCW] Using Contract Address: {:?}", contract_id); + + let results = signer.send_signed_transaction(|account| { + info!( + "[OCW] Sending transactions from {:?}: report_ddn_status({:?}, {:?})", + account.id, p2p_id, is_online, + ); + + let call_data = Self::encode_report_ddn_status(&p2p_id, is_online); + + let contract_id_unl = + <::Lookup as StaticLookup>::unlookup( + contract_id.clone(), + ); - fn account_id_from_hex(id_hex: &str) -> ResultStr { - let id_hex = id_hex.trim_start_matches("0x"); - if id_hex.len() != 64 { - return Err("Wrong length of hex-encoded account ID, expected 64") - } - let mut bytes = [0u8; 32]; - hex::decode_to_slice(id_hex, &mut bytes).map_err(|_| "invalid hex address.")?; - Ok(AccountId32::from(bytes)) - } + pallet_contracts::Call::call { + dest: contract_id_unl, + value: 0u32.into(), + gas_limit: Weight::from_ref_time(100_000_000_000), + storage_deposit_limit: None, + data: call_data, + } + }); + + match &results { + None | Some((_, Err(()))) => return Err("Error while submitting TX to SC"), + Some((_, Ok(()))) => {} + } + + Ok(()) + } + + fn fetch_all_metrics( + contract_id: ::AccountId, + day_start_ms: u64, + ) -> ResultStr<(Vec, Vec, Vec)> { + let a_moment_ago_ms = sp_io::offchain::timestamp() + .sub(Duration::from_millis(END_TIME_DELAY_MS)) + .unix_millis(); + + let mut aggregated_metrics = MetricsAggregator::default(); + let mut ddn_aggregated_metrics = DDNMetricsAggregator::default(); + + let nodes = Self::fetch_nodes(contract_id)?; + let mut offline_nodes: Vec = Vec::new(); + + for node in nodes { + let metrics_of_node = + match Self::fetch_node_metrics(&node.url, day_start_ms, a_moment_ago_ms) { + Ok(value) => value, + Err(_) => { + offline_nodes.push(node); + continue; + } + }; + + ddn_aggregated_metrics.add(node.p2p_id.clone(), &metrics_of_node); + + for metric in &metrics_of_node { + aggregated_metrics.add(metric); + } + } + + Ok(( + aggregated_metrics.finish(), + ddn_aggregated_metrics.finish(), + offline_nodes, + )) + } + + fn fetch_nodes( + contract_id: ::AccountId, + ) -> ResultStr> { + let nobody = T::AccountId::decode(&mut sp_runtime::traits::TrailingZeroInput::zeroes()); + let call_data = Self::encode_get_all_ddc_nodes(); + let contract_exec_result = pallet_contracts::Pallet::::bare_call( + nobody.unwrap(), + contract_id, + 0u32.into(), + Weight::from_ref_time(100_000_000_000), + None, + call_data, + false + ); + + let mut data = match &contract_exec_result.result { + Ok(v) => &v.data[..], + Err(exec_error) => { + warn!( + "[OCW] Error in call get_all_ddc_nodes of smart contract. Error: {:?}", + exec_error + ); + return Ok(Vec::new()); + } + }; + + let ddc_nodes = Vec::::decode(&mut data) + .map_err(|_| "[OCW] error decoding get_all_ddc_nodes result")?; + + Ok(ddc_nodes) + } + + fn fetch_node_metrics( + node_url: &str, + day_start_ms: u64, + end_ms: u64, + ) -> ResultStr> { + let metrics_url = format!( + "{}{}{}{}{}{}", + node_url, + HTTP_METRICS, + METRICS_PARAM_FROM, + day_start_ms / 1000, + METRICS_PARAM_TO, + end_ms / 1000 + ); + + let metrics: Vec = Self::http_get_json(&metrics_url)?; + + Ok(metrics + .into_iter() + .map(|data| Metric { + app_id: data.appPubKey, + storage_bytes: data.storageBytes, + wcu_used: data.wcuUsed, + rcu_used: data.rcuUsed, + }) + .collect()) + } + + fn http_get_json(url: &str) -> ResultStr { + let body = Self::http_get_request(url).map_err(|err| { + error!("[OCW] Error while getting {}: {:?}", url, err); + "HTTP GET error" + })?; + + let parsed = serde_json::from_slice(&body).map_err(|err| { + warn!("[OCW] Error while parsing JSON from {}: {:?}", url, err); + "HTTP JSON parse error" + }); + + parsed + } + + fn http_get_request(http_url: &str) -> Result, http::Error> { + info!("[OCW] Sending request to: {:?}", http_url); + + // Initiate an external HTTP GET request. This is using high-level wrappers from `sp_runtime`. + let request = http::Request::get(http_url); + + let deadline = sp_io::offchain::timestamp().add(Duration::from_millis(HTTP_TIMEOUT_MS)); + + let pending = request + .deadline(deadline) + .send() + .map_err(|_| http::Error::IoError)?; + + let response = pending + .try_wait(deadline) + .map_err(|_| http::Error::DeadlineReached)??; + + if response.code != 200 { + warn!( + "[OCW] http_get_request unexpected status code: {}", + response.code + ); + return Err(http::Error::Unknown); + } + + // Next we fully read the response body and collect it to a vector of bytes. + Ok(response.body().collect::>()) + } + + /// Prepare get_current_period_ms call params. + /// Must match the contract function here: https://github.com/Cerebellum-Network/cere-enterprise-smart-contracts/blob/dev/cere02/lib.rs + fn encode_get_current_period_ms() -> Vec { + CURRENT_PERIOD_MS.to_vec() + } + + /// Prepare encode_get_current_period_ms call params. + fn encode_get_all_ddc_nodes() -> Vec { + GET_ALL_DDC_NODES_SELECTOR.to_vec() + } + + /// Prepare finalize_metric_period call params. + /// Must match the contract function here: https://github.com/Cerebellum-Network/cere-enterprise-smart-contracts/blob/dev/cere02/lib.rs + fn encode_finalize_metric_period(in_day_start_ms: u64) -> Vec { + let mut call_data = FINALIZE_METRIC_PERIOD.to_vec(); + in_day_start_ms.encode_to(&mut call_data); + + call_data + } + + /// Prepare report_metrics call params. + /// Must match the contract function here: https://github.com/Cerebellum-Network/cere-enterprise-smart-contracts/blob/dev/cere02/lib.rs + fn encode_report_metrics( + app_id: &AccountId32, + day_start_ms: u64, + storage_bytes: u64, + wcu_used: u64, + rcu_used: u64, + ) -> Vec { + let mut call_data = REPORT_METRICS_SELECTOR.to_vec(); + app_id.encode_to(&mut call_data); + day_start_ms.encode_to(&mut call_data); + storage_bytes.encode_to(&mut call_data); + wcu_used.encode_to(&mut call_data); + rcu_used.encode_to(&mut call_data); + + call_data + } + + fn encode_report_metrics_ddn( + p2p_id: String, + day_start_ms: u64, + storage_bytes: u64, + wcu_used: u64, + rcu_used: u64, + ) -> Vec { + let mut call_data = REPORT_METRICS_DDN_SELECTOR.to_vec(); + p2p_id.encode_to(&mut call_data); + day_start_ms.encode_to(&mut call_data); + storage_bytes.encode_to(&mut call_data); + wcu_used.encode_to(&mut call_data); + rcu_used.encode_to(&mut call_data); + + call_data + } + + fn encode_report_ddn_status(p2p_id: &String, is_online: bool) -> Vec { + let mut call_data = REPORT_DDN_STATUS_SELECTOR.to_vec(); + p2p_id.encode_to(&mut call_data); + is_online.encode_to(&mut call_data); + call_data + } + + fn account_id_from_hex(id_hex: &str) -> ResultStr { + let id_hex = id_hex.trim_start_matches("0x"); + if id_hex.len() != 64 { + return Err("Wrong length of hex-encoded account ID, expected 64"); + } + let mut bytes = [0u8; 32]; + hex::decode_to_slice(id_hex, &mut bytes).map_err(|_| "invalid hex address.")?; + Ok(AccountId32::from(bytes)) + } } #[derive(Default)] struct MetricsAggregator(Vec); impl MetricsAggregator { - fn add(&mut self, metric: &Metric) { - let existing_pubkey_index = - self.0.iter().position(|one_result_obj| metric.app_id == one_result_obj.app_id); - - if existing_pubkey_index.is_none() { - // New app. - let new_metric_obj = Metric { - app_id: metric.app_id.clone(), - storage_bytes: metric.storage_bytes, - wcu_used: metric.wcu_used, - rcu_used: metric.rcu_used, - }; - self.0.push(new_metric_obj); - } else { - // Add to metrics of an existing app. - self.0[existing_pubkey_index.unwrap()].storage_bytes += metric.storage_bytes; - self.0[existing_pubkey_index.unwrap()].wcu_used += metric.wcu_used; - self.0[existing_pubkey_index.unwrap()].rcu_used += metric.rcu_used; - } - } - - fn finish(self) -> Vec { - self.0 - } + fn add(&mut self, metric: &Metric) { + let existing_pubkey_index = self + .0 + .iter() + .position(|one_result_obj| metric.app_id == one_result_obj.app_id); + + if existing_pubkey_index.is_none() { + // New app. + let new_metric_obj = Metric { + app_id: metric.app_id.clone(), + storage_bytes: metric.storage_bytes, + wcu_used: metric.wcu_used, + rcu_used: metric.rcu_used, + }; + self.0.push(new_metric_obj); + } else { + // Add to metrics of an existing app. + self.0[existing_pubkey_index.unwrap()].storage_bytes += metric.storage_bytes; + self.0[existing_pubkey_index.unwrap()].wcu_used += metric.wcu_used; + self.0[existing_pubkey_index.unwrap()].rcu_used += metric.rcu_used; + } + } + + fn finish(self) -> Vec { + self.0 + } } #[derive(Default)] struct DDNMetricsAggregator(Vec); impl DDNMetricsAggregator { - fn add(&mut self, p2p_id: String, metrics: &Vec) { - let existing_pubkey_index = - self.0.iter().position(|one_result_obj| p2p_id == one_result_obj.p2p_id); - - // Only if key does not exists - add new item, otherwise - skip - if existing_pubkey_index.is_none() { - let mut storage_bytes_sum = 0; - let mut wcu_used_sum = 0; - let mut rcu_used_sum = 0; - - for metric_item in metrics.iter() { - storage_bytes_sum += metric_item.storage_bytes; - wcu_used_sum += metric_item.wcu_used; - rcu_used_sum += metric_item.rcu_used; - } - - let new_metric_obj = MetricDDN { - p2p_id, - storage_bytes: storage_bytes_sum, - wcu_used: wcu_used_sum, - rcu_used: rcu_used_sum, - }; - self.0.push(new_metric_obj); - } - } - - fn finish(self) -> Vec { - self.0 - } + fn add(&mut self, p2p_id: String, metrics: &Vec) { + let existing_pubkey_index = self + .0 + .iter() + .position(|one_result_obj| p2p_id == one_result_obj.p2p_id); + + // Only if key does not exists - add new item, otherwise - skip + if existing_pubkey_index.is_none() { + let mut storage_bytes_sum = 0; + let mut wcu_used_sum = 0; + let mut rcu_used_sum = 0; + + for metric_item in metrics.iter() { + storage_bytes_sum += metric_item.storage_bytes; + wcu_used_sum += metric_item.wcu_used; + rcu_used_sum += metric_item.rcu_used; + } + + let new_metric_obj = MetricDDN { + p2p_id, + storage_bytes: storage_bytes_sum, + wcu_used: wcu_used_sum, + rcu_used: rcu_used_sum, + }; + self.0.push(new_metric_obj); + } + } + + fn finish(self) -> Vec { + self.0 + } } // TODO: remove, or write meaningful events. decl_event!( - /// Events generated by the module. - pub enum Event - where - AccountId = ::AccountId, - { - NewDdcMetric(AccountId, Vec), - } + /// Events generated by the module. + pub enum Event + where + AccountId = ::AccountId, + { + NewDdcMetric(AccountId, Vec), + } ); -pub trait Config: - frame_system::Config - + pallet_contracts::Config - + CreateSignedTransaction> -where - ::AccountId: AsRef<[u8]> + UncheckedFrom, - as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode, -{ - /// The identifier type for an offchain worker. - type AuthorityId: AppCrypto<::Public, ::Signature>; - - // TODO: remove, or use Event and Call. - /// The overarching event type. - type RuntimeEvent: From> + Into<::RuntimeEvent>; - /// The overarching dispatch call type. - type RuntimeCall: From>; - - type BlockInterval: Get; +pub trait Config: frame_system::Config + pallet_contracts::Config + CreateSignedTransaction> + where ::AccountId: AsRef<[u8]> + UncheckedFrom, + as HasCompact>::Type: Clone + Eq + PartialEq + Debug + TypeInfo + Encode { + /// The identifier type for an offchain worker. + type AuthorityId: AppCrypto< + ::Public, + ::Signature, + >; + + // TODO: remove, or use Event and Call. + /// The overarching event type. + type Event: From> + Into<::Event>; + /// The overarching dispatch call type. + type Call: From>; + + type BlockInterval: Get; } diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs b/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs index 6c0dbbe09..461016c3f 100644 --- a/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs +++ b/pallets/ddc-metrics-offchain-worker/src/tests/mod.rs @@ -1,20 +1,21 @@ use frame_support::traits::{Currency, OffchainWorker}; use frame_system::Config as FSC; use pallet_contracts::{self as contracts, Config as CC}; -use sp_core::offchain::{ - testing, OffchainDbExt, OffchainWorkerExt, Timestamp as OCWTimestamp, TransactionPoolExt, +use sp_core::{ + offchain::{testing, OffchainWorkerExt, OffchainDbExt, Timestamp as OCWTimestamp, TransactionPoolExt} }; use sp_runtime::{traits::Hash, AccountId32, RuntimeAppPublic}; use test_runtime::{ - AccountId, Balance, Balances, Contracts, DdcMetricsOffchainWorker, RuntimeOrigin, System, Test, - Timestamp, + AccountId, Balance, Balances, Contracts, DdcMetricsOffchainWorker, Origin, System, Test, + Timestamp, }; -use sp_keystore::{testing::KeyStore, KeystoreExt, SyncCryptoStore}; +use sp_keystore::{KeystoreExt, testing::KeyStore}; +use sp_keystore::SyncCryptoStore; use std::sync::Arc; use crate::{ - CURRENT_PERIOD_MS, FINALIZE_METRIC_PERIOD, REPORT_DDN_STATUS_SELECTOR, REPORT_METRICS_SELECTOR, + CURRENT_PERIOD_MS, FINALIZE_METRIC_PERIOD, REPORT_DDN_STATUS_SELECTOR, REPORT_METRICS_SELECTOR, }; use codec::Encode; use frame_support::weights::Weight; @@ -27,123 +28,145 @@ type T = Test; #[test] fn test_contract_api() { - // Parse the contract spec. - let contract_meta = include_str!("./test_data/metadata.json"); - let contract_meta: serde_json::Value = serde_json::from_str(contract_meta).unwrap(); - let messages = contract_meta.pointer("/spec/messages").unwrap().as_array().unwrap(); - - // Find the report_metrics function. - let report_metrics = messages - .iter() - .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "report_metrics") - .unwrap(); - - // Check the selector. - let selector = from_hex(report_metrics.get("selector").unwrap().as_str().unwrap()).unwrap(); - assert_eq!(REPORT_METRICS_SELECTOR.to_vec(), selector); - - // Find the get_current_period_ms function. - let get_current_period_ms = messages - .iter() - .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "get_current_period_ms") - .unwrap(); - - // Check the selector for get_current_period_ms - let selector_get_current_period_ms = - from_hex(get_current_period_ms.get("selector").unwrap().as_str().unwrap()).unwrap(); - assert_eq!(CURRENT_PERIOD_MS.to_vec(), selector_get_current_period_ms); - - // Find the finalize_metric_period function. - let finalize_metric_period = messages - .iter() - .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "finalize_metric_period") - .unwrap(); - - // Check the selector for finalize_metric_period - let selector_finalize_metric_period = - from_hex(finalize_metric_period.get("selector").unwrap().as_str().unwrap()).unwrap(); - assert_eq!(FINALIZE_METRIC_PERIOD.to_vec(), selector_finalize_metric_period); - - // Find the report_ddn_status function. - let report_ddn_status = messages - .iter() - .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "report_ddn_status") - .unwrap(); - - // Check the selector for report_ddn_status - let selector_report_ddn_status = - from_hex(report_ddn_status.get("selector").unwrap().as_str().unwrap()).unwrap(); - assert_eq!(REPORT_DDN_STATUS_SELECTOR.to_vec(), selector_report_ddn_status); + // Parse the contract spec. + let contract_meta = include_str!("./test_data/metadata.json"); + let contract_meta: serde_json::Value = serde_json::from_str(contract_meta).unwrap(); + let messages = contract_meta + .pointer("/spec/messages") + .unwrap() + .as_array() + .unwrap(); + + // Find the report_metrics function. + let report_metrics = messages + .iter() + .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "report_metrics") + .unwrap(); + + // Check the selector. + let selector = from_hex(report_metrics.get("selector").unwrap().as_str().unwrap()).unwrap(); + assert_eq!(REPORT_METRICS_SELECTOR.to_vec(), selector); + + // Find the get_current_period_ms function. + let get_current_period_ms = messages + .iter() + .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "get_current_period_ms") + .unwrap(); + + // Check the selector for get_current_period_ms + let selector_get_current_period_ms = from_hex( + get_current_period_ms + .get("selector") + .unwrap() + .as_str() + .unwrap(), + ) + .unwrap(); + assert_eq!(CURRENT_PERIOD_MS.to_vec(), selector_get_current_period_ms); + + // Find the finalize_metric_period function. + let finalize_metric_period = messages + .iter() + .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "finalize_metric_period") + .unwrap(); + + // Check the selector for finalize_metric_period + let selector_finalize_metric_period = from_hex( + finalize_metric_period + .get("selector") + .unwrap() + .as_str() + .unwrap(), + ) + .unwrap(); + assert_eq!( + FINALIZE_METRIC_PERIOD.to_vec(), + selector_finalize_metric_period + ); + + // Find the report_ddn_status function. + let report_ddn_status = messages + .iter() + .find(|msg| msg.pointer("/name/0").unwrap().as_str().unwrap() == "report_ddn_status") + .unwrap(); + + // Check the selector for report_ddn_status + let selector_report_ddn_status = + from_hex(report_ddn_status.get("selector").unwrap().as_str().unwrap()).unwrap(); + assert_eq!( + REPORT_DDN_STATUS_SELECTOR.to_vec(), + selector_report_ddn_status + ); } #[test] fn test_encode_report_metrics() { - let call_data = DdcMetricsOffchainWorker::encode_report_metrics( - &AccountId32::from([2; 32]), - 3 + (4 << 8), - 5 + (6 << 16), - 7 + (8 << 24), - 9 + (16 << 24), - ); - assert_eq!( - call_data, - vec![ - 53, 50, 11, 190, // Selector - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, // 32 bytes, app_id - 3, 4, 0, 0, 0, 0, 0, 0, // 8 bytes, day_start_ms - 5, 0, 6, 0, 0, 0, 0, 0, // 8 bytes, storage_bytes - 7, 0, 0, 8, 0, 0, 0, 0, // 8 bytes, wcu_used - 9, 0, 0, 16, 0, 0, 0, 0 // 8 bytes, rcu_used - ] - ); + let call_data = DdcMetricsOffchainWorker::encode_report_metrics( + &AccountId32::from([2; 32]), + 3 + (4 << 8), + 5 + (6 << 16), + 7 + (8 << 24), + 9 + (16 << 24), + ); + assert_eq!( + call_data, + vec![ + 53, 50, 11, 190, // Selector + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, // 32 bytes, app_id + 3, 4, 0, 0, 0, 0, 0, 0, // 8 bytes, day_start_ms + 5, 0, 6, 0, 0, 0, 0, 0, // 8 bytes, storage_bytes + 7, 0, 0, 8, 0, 0, 0, 0, // 8 bytes, wcu_used + 9, 0, 0, 16, 0, 0, 0, 0 // 8 bytes, rcu_used + ] + ); } #[test] fn test_encode_get_current_period_ms() { - let call_data = DdcMetricsOffchainWorker::encode_get_current_period_ms(); - assert_eq!( - call_data, - vec![ + let call_data = DdcMetricsOffchainWorker::encode_get_current_period_ms(); + assert_eq!( + call_data, + vec![ 172, 228, 236, 179, // Selector ] - ); + ); } #[test] fn test_encode_finalize_metric_period() { - let call_data = DdcMetricsOffchainWorker::encode_finalize_metric_period(INIT_TIME_MS); - assert_eq!( - call_data, - vec![ - 178, 105, 213, 87, // Selector - 80, 152, 94, 120, 118, 1, 0, 0, // 8 bytes, in_day_start_ms - ] - ); + let call_data = DdcMetricsOffchainWorker::encode_finalize_metric_period(INIT_TIME_MS); + assert_eq!( + call_data, + vec![ + 178, 105, 213, 87, // Selector + 80, 152, 94, 120, 118, 1, 0, 0, // 8 bytes, in_day_start_ms + ] + ); } #[test] fn test_encode_report_ddn_status() { - let call_data = DdcMetricsOffchainWorker::encode_report_ddn_status( - &String::from_utf8(vec![0, 1, 2, 3]).unwrap(), - true, - ); - assert_eq!( - call_data, - [ - REPORT_DDN_STATUS_SELECTOR.to_vec(), // Selector - vec![ - 16, // size of p2p_id - 0, 1, 2, 3, // p2p_id - 1 // is_online - ], - ] - .concat() - ); + let call_data = DdcMetricsOffchainWorker::encode_report_ddn_status( + &String::from_utf8(vec![0, 1, 2, 3]).unwrap(), + true, + ); + assert_eq!( + call_data, + [ + REPORT_DDN_STATUS_SELECTOR.to_vec(), // Selector + vec![ + 16, // size of p2p_id + 0, 1, 2, 3, // p2p_id + 1 // is_online + ], + ] + .concat() + ); } fn build_ext() -> sp_io::TestExternalities { - build_ext_for_contracts() + build_ext_for_contracts() } // Some day, and some time during that day. @@ -152,232 +175,241 @@ const INIT_TIME_MS: u64 = INIT_DAY_MS + 1234 * 1000; // Taken from pallet_contracts::tests::ExtBuilder fn build_ext_for_contracts() -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - pallet_balances::GenesisConfig:: { balances: vec![] } - .assimilate_storage(&mut t) - .unwrap(); - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - System::set_block_number(1); - Timestamp::set_timestamp(INIT_TIME_MS); - }); - ext + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + pallet_balances::GenesisConfig:: { balances: vec![] } + .assimilate_storage(&mut t) + .unwrap(); + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + System::set_block_number(1); + Timestamp::set_timestamp(INIT_TIME_MS); + }); + ext } #[test] fn should_submit_signed_transaction_on_chain() { - let mut t = build_ext(); - - let (pool, pool_state) = testing::TestTransactionPoolExt::new(); - t.register_extension(TransactionPoolExt::new(pool)); - - const PHRASE: &str = - "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; - let keystore = KeyStore::new(); - keystore - .sr25519_generate_new(crate::crypto::Public::ID, Some(&format!("{}/hunter1", PHRASE))) - .unwrap(); - t.register_extension(KeystoreExt(Arc::new(keystore))); - - let (offchain, offchain_state) = testing::TestOffchainExt::new(); - t.register_extension(OffchainDbExt::new(offchain.clone())); - t.register_extension(OffchainWorkerExt::new(offchain)); - - { - let mut state = offchain_state.write(); - - state.timestamp = OCWTimestamp::from_unix_millis(INIT_TIME_MS); - - let mut expect_request = |url: &str, response: &[u8]| { - state.expect_request(testing::PendingRequest { - method: "GET".into(), - uri: url.to_string(), - response: Some(response.to_vec()), - sent: true, - ..Default::default() - }); - }; - - // List partitions from a boot node. - expect_request("https://node-0.ddc.stage.cere.network/api/rest/metrics?isMaster=true&active=true&from=1608336000&to=1608337114", + let mut t = build_ext(); + + let (pool, pool_state) = testing::TestTransactionPoolExt::new(); + t.register_extension(TransactionPoolExt::new(pool)); + + const PHRASE: &str = + "news slush supreme milk chapter athlete soap sausage put clutch what kitten"; + let keystore = KeyStore::new(); + keystore + .sr25519_generate_new( + crate::crypto::Public::ID, + Some(&format!("{}/hunter1", PHRASE)), + ) + .unwrap(); + t.register_extension(KeystoreExt(Arc::new(keystore))); + + let (offchain, offchain_state) = testing::TestOffchainExt::new(); + t.register_extension(OffchainDbExt::new(offchain.clone())); + t.register_extension(OffchainWorkerExt::new(offchain)); + + { + let mut state = offchain_state.write(); + + state.timestamp = OCWTimestamp::from_unix_millis(INIT_TIME_MS); + + let mut expect_request = |url: &str, response: &[u8]| { + state.expect_request(testing::PendingRequest { + method: "GET".into(), + uri: url.to_string(), + response: Some(response.to_vec()), + sent: true, + ..Default::default() + }); + }; + + // List partitions from a boot node. + expect_request("https://node-0.ddc.stage.cere.network/api/rest/metrics?isMaster=true&active=true&from=1608336000&to=1608337114", include_bytes!("test_data/ddc_metrics_node-0.json")); - // List partitions from a boot node. - expect_request("https://node-3.ddc.stage.cere.network/api/rest/metrics?isMaster=true&active=true&from=1608336000&to=1608337114", + // List partitions from a boot node. + expect_request("https://node-3.ddc.stage.cere.network/api/rest/metrics?isMaster=true&active=true&from=1608336000&to=1608337114", include_bytes!("test_data/ddc_metrics_node-3.json")); - } - - t.execute_with(|| { - let contract_id = deploy_contract(); - - let kind = sp_core::offchain::StorageKind::PERSISTENT; - sp_io::offchain::local_storage_set( - kind, - b"ddc-metrics-offchain-worker::sc_address", - contract_id.as_ref(), - ); - - // Trigger the worker. - DdcMetricsOffchainWorker::offchain_worker(0); - - let events = System::events(); - eprintln!("Events: {:?}\n", events); - - // Get the transaction from the worker. - let transactions = pool_state.read().transactions.clone(); - eprintln!("Transactions: {:?}\n", transactions); - assert_eq!(transactions.len(), 4); // (2 x send_metrics_to_sc) + (2 x send_metrics_ddn_to_sc) - - // Check metrics of an app based on ddc_metrics_node-0.json and ddc_metrics_node-3.json. - let app_id = AccountId32::from(hex!( - "00a2e826451b78afb99241b1331e7594526329225ff8937dbc62f43ec20d1830" - )); - let expected_call = - DdcMetricsOffchainWorker::encode_report_metrics(&app_id, INIT_DAY_MS, 2 + 20, 0, 0); - assert!( - transactions[0].ends_with(&expected_call), - "Expected a specific call to the report_metrics function" - ); - - // Check metrics of the second app. - let app_id = AccountId32::from(hex!( - "100ad4097b6e60700a5d5c5294cb6d663090ef5f547e84cc20ec6bcc7a552f13" - )); - let expected_call = - DdcMetricsOffchainWorker::encode_report_metrics(&app_id, INIT_DAY_MS, 200, 0, 0); - assert!( - transactions[1].ends_with(&expected_call), - "Expected a specific call to the report_metrics function" - ); - - let expected_call = DdcMetricsOffchainWorker::encode_report_metrics_ddn( - "12D3KooWB4SMhKK12ASU4qH1ZYh3pN9vsW9QbFTwkjZxUhTqmYaS".to_string(), - INIT_DAY_MS, - 2 + 200, - 0, - 0, - ); - assert!( - transactions[2].ends_with(&expected_call), - "Expected a specific call to the report_metrics_ddn function" - ); - - let expected_call = DdcMetricsOffchainWorker::encode_report_metrics_ddn( - "12D3KooWJLuJEmtYf3bakUwe2q1uMcnbCBKRg7GkpG6Ws74Aq6NC".to_string(), - INIT_DAY_MS, - 20, - 0, - 0, - ); - assert!( - transactions[3].ends_with(&expected_call), - "Expected a specific call to the report_metrics_ddn function" - ); - }); + } + + t.execute_with(|| { + let contract_id = deploy_contract(); + + let kind = sp_core::offchain::StorageKind::PERSISTENT; + sp_io::offchain::local_storage_set( + kind, + b"ddc-metrics-offchain-worker::sc_address", + contract_id.as_ref(), + ); + + // Trigger the worker. + DdcMetricsOffchainWorker::offchain_worker(0); + + let events = System::events(); + eprintln!("Events: {:?}\n", events); + + // Get the transaction from the worker. + let transactions = pool_state.read().transactions.clone(); + eprintln!("Transactions: {:?}\n", transactions); + assert_eq!(transactions.len(), 4); // (2 x send_metrics_to_sc) + (2 x send_metrics_ddn_to_sc) + + // Check metrics of an app based on ddc_metrics_node-0.json and ddc_metrics_node-3.json. + let app_id = AccountId32::from(hex!( + "00a2e826451b78afb99241b1331e7594526329225ff8937dbc62f43ec20d1830" + )); + let expected_call = + DdcMetricsOffchainWorker::encode_report_metrics(&app_id, INIT_DAY_MS, 2 + 20, 0, 0); + assert!( + transactions[0].ends_with(&expected_call), + "Expected a specific call to the report_metrics function" + ); + + // Check metrics of the second app. + let app_id = AccountId32::from(hex!( + "100ad4097b6e60700a5d5c5294cb6d663090ef5f547e84cc20ec6bcc7a552f13" + )); + let expected_call = + DdcMetricsOffchainWorker::encode_report_metrics(&app_id, INIT_DAY_MS, 200, 0, 0); + assert!( + transactions[1].ends_with(&expected_call), + "Expected a specific call to the report_metrics function" + ); + + let expected_call = DdcMetricsOffchainWorker::encode_report_metrics_ddn( + "12D3KooWB4SMhKK12ASU4qH1ZYh3pN9vsW9QbFTwkjZxUhTqmYaS".to_string(), + INIT_DAY_MS, + 2 + 200, + 0, + 0, + ); + assert!( + transactions[2].ends_with(&expected_call), + "Expected a specific call to the report_metrics_ddn function" + ); + + let expected_call = DdcMetricsOffchainWorker::encode_report_metrics_ddn( + "12D3KooWJLuJEmtYf3bakUwe2q1uMcnbCBKRg7GkpG6Ws74Aq6NC".to_string(), + INIT_DAY_MS, + 20, + 0, + 0, + ); + assert!( + transactions[3].ends_with(&expected_call), + "Expected a specific call to the report_metrics_ddn function" + ); + }); } #[test] fn should_run_contract() { - let mut t = build_ext(); - - t.execute_with(|| { - let alice = AccountId::from([1; 32]); - let contract_id = deploy_contract(); - let call_data = DdcMetricsOffchainWorker::encode_get_current_period_ms(); - - pallet_contracts::Module::::call( - RuntimeOrigin::signed(alice.clone()), - contract_id.clone(), - 0, - Weight::from_ref_time(100_000_000_000), - None, - call_data.clone(), - ) - .unwrap(); - - let contract_exec_result = pallet_contracts::Pallet::::bare_call( - alice.clone(), - contract_id, - 0, - Weight::from_ref_time(100_000_000_000), - None, - call_data, - false, - ); - match &contract_exec_result.result { - Ok(res) => { - //println!("XXX Contract returned {:?}", res.data); - assert_eq!(res.data.len(), 8); // size of u64 - }, - Err(_) => panic!("error in contract call"), - }; - }); + let mut t = build_ext(); + + t.execute_with(|| { + let alice = AccountId::from([1; 32]); + let contract_id = deploy_contract(); + let call_data = DdcMetricsOffchainWorker::encode_get_current_period_ms(); + + pallet_contracts::Module::::call( + Origin::signed(alice.clone()), + contract_id.clone(), + 0, + Weight::from_ref_time(100_000_000_000), + None, + call_data.clone(), + ) + .unwrap(); + + let contract_exec_result = pallet_contracts::Pallet::::bare_call( + alice.clone(), + contract_id, + 0, + Weight::from_ref_time(100_000_000_000), + None, + call_data, + false, + ); + match &contract_exec_result.result { + Ok(res) => { + //println!("XXX Contract returned {:?}", res.data); + assert_eq!(res.data.len(), 8); // size of u64 + } + Err(_) => panic!("error in contract call"), + }; + }); } pub const CTOR_SELECTOR: [u8; 4] = hex!("9bae9d5e"); fn encode_constructor() -> Vec { - let mut call_data = CTOR_SELECTOR.to_vec(); - let x = 0 as u128; - for _ in 0..9 { - x.encode_to(&mut call_data); - } - call_data + let mut call_data = CTOR_SELECTOR.to_vec(); + let x = 0 as u128; + for _ in 0..9 { + x.encode_to(&mut call_data); + } + call_data } fn deploy_contract() -> AccountId { - // Admin account who deploys the contract. - let alice = AccountId::from([1; 32]); - let _ = Balances::deposit_creating(&alice, 1_000_000_000_000); - - // Load the contract code. - let wasm = &include_bytes!("./test_data/ddc.wasm")[..]; - let wasm_hash = ::Hashing::hash(wasm); - let contract_args = encode_constructor(); - - // Deploy the contract. - //let endowment = contracts::Config::::subsistence_threshold_uncached(); - const GAS_LIMIT: frame_support::weights::Weight = Weight::from_ref_time(100_000_000_000); - const ENDOWMENT: Balance = 100_000_000_000; - Contracts::instantiate_with_code( - RuntimeOrigin::signed(alice.clone()), - ENDOWMENT, - GAS_LIMIT, - None, - wasm.to_vec(), - contract_args.clone(), - vec![], - ) - .unwrap(); - - // Configure worker with the contract address. - let contract_id = Contracts::contract_address(&alice, &wasm_hash, &vec![]); - - pub const ADD_DDC_NODE_SELECTOR: [u8; 4] = hex!("11a9e1b9"); - - let call_data_items = vec![ + // Admin account who deploys the contract. + let alice = AccountId::from([1; 32]); + let _ = Balances::deposit_creating(&alice, 1_000_000_000_000); + + // Load the contract code. + let wasm = &include_bytes!("./test_data/ddc.wasm")[..]; + let wasm_hash = ::Hashing::hash(wasm); + let contract_args = encode_constructor(); + + // Deploy the contract. + //let endowment = contracts::Config::::subsistence_threshold_uncached(); + const GAS_LIMIT: frame_support::weights::Weight = Weight::from_ref_time(100_000_000_000); + const ENDOWMENT: Balance = 100_000_000_000; + Contracts::instantiate_with_code( + Origin::signed(alice.clone()), + ENDOWMENT, + GAS_LIMIT, + None, + wasm.to_vec(), + contract_args.clone(), + vec![] + ) + .unwrap(); + + // Configure worker with the contract address. + let contract_id = Contracts::contract_address( + &alice, + &wasm_hash, + &vec![], + ); + + pub const ADD_DDC_NODE_SELECTOR: [u8; 4] = hex!("11a9e1b9"); + + let call_data_items = vec![ ["12D3KooWB4SMhKK12ASU4qH1ZYh3pN9vsW9QbFTwkjZxUhTqmYaS", "/dns4/node-0.ddc.dev.cere.network/tcp/5000/p2p/12D3KooWB4SMhKK12ASU4qH1ZYh3pN9vsW9QbFTwkjZxUhTqmYaS", "https://node-0.ddc.stage.cere.network"], ["12D3KooWJLuJEmtYf3bakUwe2q1uMcnbCBKRg7GkpG6Ws74Aq6NC", "/dns4/node-3.ddc.dev.cere.network/tcp/5000/p2p/12D3KooWJLuJEmtYf3bakUwe2q1uMcnbCBKRg7GkpG6Ws74Aq6NC", "https://node-3.ddc.stage.cere.network"], ]; - let permissions: u64 = 1; - - for call_data_item in call_data_items { - let mut call_data = ADD_DDC_NODE_SELECTOR.to_vec(); - call_data_item[0].encode_to(&mut call_data); - call_data_item[1].encode_to(&mut call_data); - call_data_item[2].encode_to(&mut call_data); - permissions.encode_to(&mut call_data); - - let results = Contracts::call( - RuntimeOrigin::signed(alice.clone()), - contract_id.clone(), - 0, - Weight::from_ref_time(1_000_000_000_000), - None, - call_data, - ); - results.unwrap(); - } - - contract_id + let permissions: u64 = 1; + + for call_data_item in call_data_items { + let mut call_data = ADD_DDC_NODE_SELECTOR.to_vec(); + call_data_item[0].encode_to(&mut call_data); + call_data_item[1].encode_to(&mut call_data); + call_data_item[2].encode_to(&mut call_data); + permissions.encode_to(&mut call_data); + + let results = Contracts::call( + Origin::signed(alice.clone()), + contract_id.clone(), + 0, + Weight::from_ref_time(1_000_000_000_000), + None, + call_data, + ); + results.unwrap(); + } + + contract_id } diff --git a/pallets/ddc-metrics-offchain-worker/src/tests/test_runtime.rs b/pallets/ddc-metrics-offchain-worker/src/tests/test_runtime.rs index 10cee8408..5f851003f 100644 --- a/pallets/ddc-metrics-offchain-worker/src/tests/test_runtime.rs +++ b/pallets/ddc-metrics-offchain-worker/src/tests/test_runtime.rs @@ -2,22 +2,19 @@ // // Inspired from pos-network-node/frame/contracts/src/tests.rs -use crate::{self as pallet_ddc_metrics_offchain_worker, *}; +use crate::{*, self as pallet_ddc_metrics_offchain_worker}; use codec::{Decode, Encode}; -use frame_support::{ - parameter_types, - traits::{ConstU32, Currency, Everything, Get, Nothing}, - weights::Weight, -}; +use frame_support::{ parameter_types, traits::Get, weights::Weight }; +use frame_support::traits::{ConstU32, Currency, Everything, Nothing}; use sp_core::H256; use sp_runtime::{ - generic, - testing::TestXt, - traits::{ - BlakeTwo256, Convert, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify, - }, - MultiSignature, Perbill, + generic, + testing::TestXt, + traits::{ + BlakeTwo256, Convert, Extrinsic as ExtrinsicT, IdentifyAccount, IdentityLookup, Verify, + }, + MultiSignature, Perbill, }; use std::cell::RefCell; @@ -45,178 +42,179 @@ frame_support::construct_runtime!( { System: frame_system::{Pallet, Call, Config, Storage, Event}, Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - Contracts: contracts::{Pallet, Call, Storage, Event}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - Randomness: pallet_randomness_collective_flip::{Pallet, Storage}, - DdcMetricsOffchainWorker: pallet_ddc_metrics_offchain_worker::{Pallet, Call, Event}, - } + Contracts: contracts::{Pallet, Call, Storage, Event}, + Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + Randomness: pallet_randomness_collective_flip::{Pallet, Storage}, + DdcMetricsOffchainWorker: pallet_ddc_metrics_offchain_worker::{Pallet, Call, Event}, + } ); parameter_types! { - pub const BlockHashCount: BlockNumber = 250; - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); - pub const MaximumBlockLength: u32 = 2 * 1024; - pub const AvailableBlockRatio: Perbill = Perbill::one(); + pub const BlockHashCount: BlockNumber = 250; + pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockLength: u32 = 2 * 1024; + pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type RuntimeOrigin = RuntimeOrigin; - type Index = u64; - type BlockNumber = BlockNumber; - type Hash = H256; - type RuntimeCall = RuntimeCall; - type Hashing = BlakeTwo256; - type AccountId = AccountId; - // u64; // sp_core::sr25519::Public; - type Lookup = IdentityLookup; - type Header = generic::Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type DbWeight = (); - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type Origin = Origin; + type Index = u64; + type BlockNumber = BlockNumber; + type Hash = H256; + type Call = Call; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + // u64; // sp_core::sr25519::Public; + type Lookup = IdentityLookup; + type Header = generic::Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type DbWeight = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = pallet_balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } impl pallet_balances::Config for Test { - type Balance = Balance; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = (); + type Balance = Balance; + type DustRemoval = (); + type Event = Event; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = (); } thread_local! { - static EXISTENTIAL_DEPOSIT: RefCell = RefCell::new(1); + static EXISTENTIAL_DEPOSIT: RefCell = RefCell::new(1); } pub struct ExistentialDeposit; impl Get for ExistentialDeposit { - fn get() -> Balance { - EXISTENTIAL_DEPOSIT.with(|v| *v.borrow()) - } + fn get() -> Balance { + EXISTENTIAL_DEPOSIT.with(|v| *v.borrow()) + } } parameter_types! { - pub const MinimumPeriod: u64 = 1; + pub const MinimumPeriod: u64 = 1; } impl pallet_timestamp::Config for Test { - type Moment = Moment; - type OnTimestampSet = (); - type MinimumPeriod = MinimumPeriod; - type WeightInfo = (); + type Moment = Moment; + type OnTimestampSet = (); + type MinimumPeriod = MinimumPeriod; + type WeightInfo = (); } parameter_types! { - pub const SignedClaimHandicap: BlockNumber = 2; - pub const TombstoneDeposit: Balance = 16; - pub const StorageSizeOffset: u32 = 8; - pub const RentByteFee: Balance = 4; - pub const RentDepositOffset: Balance = 10_000; - pub const SurchargeReward: Balance = 150; - pub const MaxDepth: u32 = 100; - pub const MaxValueSize: u32 = 16_384; - pub Schedule: pallet_contracts::Schedule = Default::default(); + pub const SignedClaimHandicap: BlockNumber = 2; + pub const TombstoneDeposit: Balance = 16; + pub const StorageSizeOffset: u32 = 8; + pub const RentByteFee: Balance = 4; + pub const RentDepositOffset: Balance = 10_000; + pub const SurchargeReward: Balance = 150; + pub const MaxDepth: u32 = 100; + pub const MaxValueSize: u32 = 16_384; + pub Schedule: pallet_contracts::Schedule = Default::default(); } // Contracts for Test Runtime. -use contracts::Config as contractsConfig; +use contracts::{Config as contractsConfig}; -type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; +type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; impl contracts::Config for Test { - type Time = Timestamp; - type Randomness = Randomness; - type Currency = Balances; - type RuntimeEvent = RuntimeEvent; - type CallStack = [pallet_contracts::Frame; 31]; - type WeightPrice = Self; //pallet_transaction_payment::Module; - type WeightInfo = (); - type ChainExtension = (); - type DeletionQueueDepth = (); - type DeletionWeightLimit = (); - type Schedule = Schedule; - type RuntimeCall = RuntimeCall; - type CallFilter = Nothing; - type DepositPerByte = DepositPerByte; - type DepositPerItem = DepositPerItem; - type AddressGenerator = pallet_contracts::DefaultAddressGenerator; - type ContractAccessWeight = (); - type MaxCodeLen = ConstU32<{ 128 * 1024 }>; - type MaxStorageKeyLen = ConstU32<128>; + type Time = Timestamp; + type Randomness = Randomness; + type Currency = Balances; + type Event = Event; + type CallStack = [pallet_contracts::Frame; 31]; + type WeightPrice = Self; //pallet_transaction_payment::Module; + type WeightInfo = (); + type ChainExtension = (); + type DeletionQueueDepth = (); + type DeletionWeightLimit = (); + type Schedule = Schedule; + type Call = Call; + type CallFilter = Nothing; + type DepositPerByte = DepositPerByte; + type DepositPerItem = DepositPerItem; + type AddressGenerator = pallet_contracts::DefaultAddressGenerator; + type ContractAccessWeight = (); + type MaxCodeLen = ConstU32<{ 128 * 1024 }>; + type RelaxedMaxCodeLen = ConstU32<{ 256 * 1024 }>; + type MaxStorageKeyLen = ConstU32<128>; } parameter_types! { - pub const TransactionByteFee: u64 = 0; - pub const DepositPerItem: Balance = 0; + pub const TransactionByteFee: u64 = 0; + pub const DepositPerItem: Balance = 0; pub const DepositPerByte: Balance = 0; } impl Convert> for Test { - fn convert(w: Weight) -> BalanceOf { - w.ref_time().into() - } + fn convert(w: Weight) -> BalanceOf { + w.ref_time().into() + } } // -- End contracts runtime -- use frame_system::offchain::{ - AppCrypto, CreateSignedTransaction, SendTransactionTypes, SigningTypes, + AppCrypto, CreateSignedTransaction, SendTransactionTypes, SigningTypes, }; -pub type Extrinsic = TestXt; +pub type Extrinsic = TestXt; impl SigningTypes for Test { - type Public = ::Signer; - type Signature = Signature; + type Public = ::Signer; + type Signature = Signature; } impl SendTransactionTypes for Test where - RuntimeCall: From, + Call: From, { - type OverarchingCall = RuntimeCall; - type Extrinsic = Extrinsic; + type OverarchingCall = Call; + type Extrinsic = Extrinsic; + } impl pallet_randomness_collective_flip::Config for Test {} impl CreateSignedTransaction for Test where - RuntimeCall: From, + Call: From, { - fn create_transaction>( - call: RuntimeCall, - _public: ::Signer, - _account: AccountId, - nonce: u64, - ) -> Option<(RuntimeCall, ::SignaturePayload)> { - Some((call, (nonce, ()))) - } + fn create_transaction>( + call: Call, + _public: ::Signer, + _account: AccountId, + nonce: u64, + ) -> Option<(Call, ::SignaturePayload)> { + Some((call, (nonce, ()))) + } } parameter_types! { - pub const OcwBlockInterval: u32 = crate::BLOCK_INTERVAL; + pub const OcwBlockInterval: u32 = crate::BLOCK_INTERVAL; } impl Config for Test { - type BlockInterval = OcwBlockInterval; + type BlockInterval = OcwBlockInterval; - type AuthorityId = crypto::TestAuthId; + type AuthorityId = crypto::TestAuthId; - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; } diff --git a/pallets/ddc-staking/Cargo.toml b/pallets/ddc-staking/Cargo.toml index c5a4e6873..aef51993e 100644 --- a/pallets/ddc-staking/Cargo.toml +++ b/pallets/ddc-staking/Cargo.toml @@ -1,26 +1,22 @@ [package] name = "pallet-ddc-staking" -version = "4.8.0" +version = "4.7.0" edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } [dev-dependencies] -pallet-balances = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-timestamp = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-tracing = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -substrate-test-utils = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +substrate-test-utils = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } [features] default = ["std"] diff --git a/pallets/ddc-staking/README.md b/pallets/ddc-staking/README.md index ef00bef50..ce688f876 100644 --- a/pallets/ddc-staking/README.md +++ b/pallets/ddc-staking/README.md @@ -1,16 +1 @@ # DDC Staking Pallet - -The DDC Staking module is used to manage funds at stake by Cere DDC participants. - -## Overview - -The DDC Staking module is the means by which an account can voluntarily place funds under deposit to join DDC CDN or storage network. - -### Terminology - -- DDC Staking: The process of locking up funds for some time in order to become a participant of the DDC. -- Stash account: The account holding an owner's funds used for staking. -- Controller account: The account that controls an owner's funds for staking. -- Edge: CDN participant. -- Storage: Storage network participant. -- Era: A time period of DDC participants activity data capture and accumulation which will further be used to calculate pay outs. diff --git a/pallets/ddc-staking/src/benchmarking.rs b/pallets/ddc-staking/src/benchmarking.rs index 87b671426..bb1d513c1 100644 --- a/pallets/ddc-staking/src/benchmarking.rs +++ b/pallets/ddc-staking/src/benchmarking.rs @@ -86,9 +86,6 @@ benchmarks! { let (edge_stash, edge_controller) = create_stash_controller_with_balance::(0, T::DefaultEdgeBondSize::get())?; DdcStaking::::serve(RawOrigin::Signed(edge_controller.clone()).into(), 1)?; assert!(Edges::::contains_key(&edge_stash)); - CurrentEra::::put(1); - DdcStaking::::chill(RawOrigin::Signed(edge_controller.clone()).into())?; - CurrentEra::::put(1 + Settings::::get(1).edge_chill_delay); whitelist_account!(edge_controller); }: _(RawOrigin::Signed(edge_controller)) diff --git a/pallets/ddc-staking/src/lib.rs b/pallets/ddc-staking/src/lib.rs index 27d430ede..2105e53f9 100644 --- a/pallets/ddc-staking/src/lib.rs +++ b/pallets/ddc-staking/src/lib.rs @@ -1,35 +1,17 @@ -//! # DDC Staking Pallet -//! -//! The DDC Staking pallet is used to manage funds at stake by CDN and storage network maintainers. -//! -//! - [`Config`] -//! - [`Call`] -//! - [`Pallet`] -//! -//! ## GenesisConfig -//! -//! The DDC Staking pallet depends on the [`GenesisConfig`]. The -//! `GenesisConfig` is optional and allow to set some initial stakers in DDC. - #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; + #[cfg(any(feature = "runtime-benchmarks", test))] pub mod testing_utils; -#[cfg(test)] -pub(crate) mod mock; -#[cfg(test)] -mod tests; - pub mod weights; use crate::weights::WeightInfo; use codec::{Decode, Encode, HasCompact}; use frame_support::{ - assert_ok, pallet_prelude::*, parameter_types, traits::{ @@ -196,7 +178,7 @@ pub mod pallet { #[pallet::constant] type DefaultStorageChillDelay: Get; - type RuntimeEvent: From> + IsType<::RuntimeEvent>; + type Event: From> + IsType<::Event>; /// Number of eras that staked funds must remain bonded for. #[pallet::constant] type BondingDuration: Get; @@ -245,83 +227,6 @@ pub mod pallet { #[pallet::getter(fn current_era)] pub type CurrentEra = StorageValue<_, EraIndex>; - #[pallet::genesis_config] - pub struct GenesisConfig { - pub edges: Vec<(T::AccountId, T::AccountId, BalanceOf, ClusterId)>, - pub storages: Vec<(T::AccountId, T::AccountId, BalanceOf, ClusterId)>, - pub settings: Vec<(ClusterId, BalanceOf, EraIndex, BalanceOf, EraIndex)>, - } - - #[cfg(feature = "std")] - impl Default for GenesisConfig { - fn default() -> Self { - GenesisConfig { - edges: Default::default(), - storages: Default::default(), - settings: Default::default(), - } - } - } - - #[pallet::genesis_build] - impl GenesisBuild for GenesisConfig { - fn build(&self) { - // clusters' settings - for &( - cluster, - edge_bond_size, - edge_chill_delay, - storage_bond_size, - storage_chill_delay, - ) in &self.settings - { - Settings::::insert( - cluster, - ClusterSettings:: { - edge_bond_size, - edge_chill_delay, - storage_bond_size, - storage_chill_delay, - }, - ); - } - - // Add initial CDN participants - for &(ref stash, ref controller, balance, cluster) in &self.edges { - assert!( - T::Currency::free_balance(&stash) >= balance, - "Stash do not have enough balance to participate in CDN." - ); - assert_ok!(Pallet::::bond( - T::RuntimeOrigin::from(Some(stash.clone()).into()), - T::Lookup::unlookup(controller.clone()), - balance, - )); - assert_ok!(Pallet::::serve( - T::RuntimeOrigin::from(Some(controller.clone()).into()), - cluster, - )); - } - - // Add initial storage network participants - for &(ref stash, ref controller, balance, cluster) in &self.storages { - assert!( - T::Currency::free_balance(&stash) >= balance, - "Stash do not have enough balance to participate in storage network." - ); - assert_ok!(Pallet::::bond( - T::RuntimeOrigin::from(Some(stash.clone()).into()), - T::Lookup::unlookup(controller.clone()), - balance, - )); - assert_ok!(Pallet::::store( - T::RuntimeOrigin::from(Some(controller.clone()).into()), - cluster, - )); - } - } - } - #[pallet::event] #[pallet::generate_deposit(pub(crate) fn deposit_event)] pub enum Event { @@ -804,6 +709,10 @@ pub mod pallet { /// This function will add a CDN participant to the `Edges` storage map. /// /// If the CDN participant already exists, their cluster will be updated. + /// + /// NOTE: you must ALWAYS use this function to add a CDN participant to the system. Any + /// access to `Edges` outside of this function is almost certainly + /// wrong. pub fn do_add_edge(who: &T::AccountId, cluster: ClusterId) { Edges::::insert(who, cluster); } @@ -811,6 +720,10 @@ pub mod pallet { /// This function will remove a CDN participant from the `Edges` map. /// /// Returns true if `who` was removed from `Edges`, otherwise false. + /// + /// NOTE: you must ALWAYS use this function to remove a storage network participant from the + /// system. Any access to `Edges` outside of this function is almost certainly + /// wrong. pub fn do_remove_edge(who: &T::AccountId) -> bool { Edges::::take(who).is_some() } @@ -818,6 +731,10 @@ pub mod pallet { /// This function will add a storage network participant to the `Storages` storage map. /// /// If the storage network participant already exists, their cluster will be updated. + /// + /// NOTE: you must ALWAYS use this function to add a storage network participant to the + /// system. Any access to `Storages` outside of this function is almost certainly + /// wrong. pub fn do_add_storage(who: &T::AccountId, cluster: ClusterId) { Storages::::insert(who, cluster); } @@ -825,6 +742,10 @@ pub mod pallet { /// This function will remove a storage network participant from the `Storages` map. /// /// Returns true if `who` was removed from `Storages`, otherwise false. + /// + /// NOTE: you must ALWAYS use this function to remove a storage network participant from the + /// system. Any access to `Storages` outside of this function is almost certainly + /// wrong. pub fn do_remove_storage(who: &T::AccountId) -> bool { Storages::::take(who).is_some() } diff --git a/pallets/ddc-staking/src/mock.rs b/pallets/ddc-staking/src/mock.rs deleted file mode 100644 index dea8eb524..000000000 --- a/pallets/ddc-staking/src/mock.rs +++ /dev/null @@ -1,244 +0,0 @@ -//! Test utilities - -#![allow(dead_code)] - -use crate::{self as pallet_ddc_staking, *}; -use frame_support::{ - construct_runtime, - traits::{ConstU32, ConstU64, Everything, GenesisBuild}, - weights::constants::RocksDbWeight, -}; -use frame_system::mocking::{MockBlock, MockUncheckedExtrinsic}; -use sp_core::H256; -use sp_io::TestExternalities; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, -}; -use sp_std::collections::btree_map::BTreeMap; - -/// The AccountId alias in this test module. -pub(crate) type AccountId = u64; -pub(crate) type AccountIndex = u64; -pub(crate) type BlockNumber = u64; -pub(crate) type Balance = u128; - -type UncheckedExtrinsic = MockUncheckedExtrinsic; -type Block = MockBlock; - -construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Pallet, Call, Config, Storage, Event}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - DdcStaking: pallet_ddc_staking::{Pallet, Call, Config, Storage, Event}, - } -); - -parameter_types! { - pub static ExistentialDeposit: Balance = 1; -} - -impl frame_system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = RocksDbWeight; - type RuntimeOrigin = RuntimeOrigin; - type Index = AccountIndex; - type BlockNumber = BlockNumber; - type RuntimeCall = RuntimeCall; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = ConstU64<250>; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = ConstU32<16>; -} - -impl pallet_balances::Config for Test { - type MaxLocks = ConstU32<1024>; - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; - type Balance = Balance; - type RuntimeEvent = RuntimeEvent; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); -} - -impl pallet_timestamp::Config for Test { - type Moment = u64; - type OnTimestampSet = (); - type MinimumPeriod = ConstU64<5>; - type WeightInfo = (); -} - -parameter_types! { - pub const BondingDuration: EraIndex = 10; - pub const DefaultEdgeBondSize: Balance = 100; - pub const DefaultEdgeChillDelay: EraIndex = 1; - pub const DefaultStorageBondSize: Balance = 100; - pub const DefaultStorageChillDelay: EraIndex = 1; -} - -impl crate::pallet::Config for Test { - type BondingDuration = BondingDuration; - type Currency = Balances; - type DefaultEdgeBondSize = DefaultEdgeBondSize; - type DefaultEdgeChillDelay = DefaultEdgeChillDelay; - type DefaultStorageBondSize = DefaultStorageBondSize; - type DefaultStorageChillDelay = DefaultStorageChillDelay; - type RuntimeEvent = RuntimeEvent; - type UnixTime = Timestamp; - type WeightInfo = (); -} - -pub(crate) type DdcStakingCall = crate::Call; -pub(crate) type TestRuntimeCall = ::RuntimeCall; - -pub struct ExtBuilder { - has_edges: bool, - has_storages: bool, - stakes: BTreeMap, - edges: Vec<(AccountId, AccountId, Balance, ClusterId)>, - storages: Vec<(AccountId, AccountId, Balance, ClusterId)>, -} - -impl Default for ExtBuilder { - fn default() -> Self { - Self { - has_edges: true, - has_storages: true, - stakes: Default::default(), - edges: Default::default(), - storages: Default::default(), - } - } -} - -impl ExtBuilder { - pub fn has_edges(mut self, has: bool) -> Self { - self.has_edges = has; - self - } - pub fn has_storages(mut self, has: bool) -> Self { - self.has_storages = has; - self - } - pub fn set_stake(mut self, who: AccountId, stake: Balance) -> Self { - self.stakes.insert(who, stake); - self - } - pub fn add_edge( - mut self, - stash: AccountId, - controller: AccountId, - stake: Balance, - cluster: ClusterId, - ) -> Self { - self.edges.push((stash, controller, stake, cluster)); - self - } - pub fn add_storage( - mut self, - stash: AccountId, - controller: AccountId, - stake: Balance, - cluster: ClusterId, - ) -> Self { - self.storages.push((stash, controller, stake, cluster)); - self - } - fn build(self) -> TestExternalities { - sp_tracing::try_init_simple(); - let mut storage = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - let _ = pallet_balances::GenesisConfig:: { - balances: vec![ - (1, 100), - (2, 100), - (3, 100), - (4, 100), - // edge controllers - (10, 100), - (20, 100), - // storage controllers - (30, 100), - (40, 100), - // edge stashes - (11, 100), - (21, 100), - // storage stashes - (31, 100), - (41, 100), - ], - } - .assimilate_storage(&mut storage); - let mut edges = vec![]; - if self.has_edges { - edges = vec![ - // (stash, controller, stake, cluster) - (11, 10, 100, 1), - (21, 20, 100, 1), - ]; - } - let mut storages = vec![]; - if self.has_storages { - storages = vec![ - // (stash, controller, stake, cluster) - (31, 30, 100, 1), - (41, 40, 100, 1), - ]; - } - - let _ = pallet_ddc_staking::GenesisConfig:: { edges, storages, ..Default::default() } - .assimilate_storage(&mut storage); - - TestExternalities::new(storage) - } - pub fn build_and_execute(self, test: impl FnOnce() -> ()) { - sp_tracing::try_init_simple(); - let mut ext = self.build(); - ext.execute_with(test); - ext.execute_with(post_condition); - } -} - -fn post_condition() { - check_ledgers(); -} - -fn check_ledgers() { - // check the ledger of all stakers. - Bonded::::iter().for_each(|(_, controller)| assert_ledger_consistent(controller)) -} - -fn assert_ledger_consistent(controller: AccountId) { - // ensures ledger.total == ledger.active + sum(ledger.unlocking). - let ledger = DdcStaking::ledger(controller).expect("Not a controller."); - let real_total: Balance = ledger.unlocking.iter().fold(ledger.active, |a, c| a + c.value); - assert_eq!(real_total, ledger.total); - assert!( - ledger.active >= Balances::minimum_balance() || ledger.active == 0, - "{}: active ledger amount ({}) must be greater than ED {}", - controller, - ledger.active, - Balances::minimum_balance() - ); -} diff --git a/pallets/ddc-staking/src/tests.rs b/pallets/ddc-staking/src/tests.rs deleted file mode 100644 index 461f064d5..000000000 --- a/pallets/ddc-staking/src/tests.rs +++ /dev/null @@ -1,178 +0,0 @@ -//! Tests for the module. - -use super::{mock::*, *}; -use frame_support::{assert_noop, assert_ok, traits::ReservableCurrency}; -use pallet_balances::Error as BalancesError; - -pub const BLOCK_TIME: u64 = 1000; -pub const INIT_TIMESTAMP: u64 = 30_000; - -#[test] -fn set_settings_works() { - ExtBuilder::default().build_and_execute(|| { - // setting works - assert_ok!(DdcStaking::set_settings( - RuntimeOrigin::root(), - 1, - Some(ClusterSettings { - edge_bond_size: 10, - edge_chill_delay: 2, - storage_bond_size: 10, - storage_chill_delay: 2, - }), - )); - let settings = DdcStaking::settings(1); - assert_eq!(settings.edge_bond_size, 10); - assert_eq!(settings.edge_chill_delay, 2); - assert_eq!(settings.storage_bond_size, 10); - assert_eq!(settings.storage_chill_delay, 2); - - // removing works - assert_ok!(DdcStaking::set_settings(RuntimeOrigin::root(), 1, None)); - let settings = DdcStaking::settings(1); - let default_settings: ClusterSettings = Default::default(); - assert_eq!(settings.edge_bond_size, default_settings.edge_bond_size); - assert_eq!(settings.edge_chill_delay, default_settings.edge_chill_delay); - assert_eq!(settings.storage_bond_size, default_settings.storage_bond_size); - assert_eq!(settings.storage_chill_delay, default_settings.storage_chill_delay); - }); -} - -#[test] -fn basic_setup_works() { - // Verifies initial conditions of mock - ExtBuilder::default().build_and_execute(|| { - // Account 11 is stashed and locked, and account 10 is the controller - assert_eq!(DdcStaking::bonded(&11), Some(10)); - // Account 21 is stashed and locked, and account 20 is the controller - assert_eq!(DdcStaking::bonded(&21), Some(20)); - // Account 1 is not a stashed - assert_eq!(DdcStaking::bonded(&1), None); - - // Account 10 controls the stash from account 11, which is 100 units - assert_eq!( - DdcStaking::ledger(&10), - Some(StakingLedger { - stash: 11, - total: 100, - active: 100, - chilling: Default::default(), - unlocking: Default::default(), - }) - ); - // Account 20 controls the stash from account 21, which is 100 units - assert_eq!( - DdcStaking::ledger(&20), - Some(StakingLedger { - stash: 21, - total: 100, - active: 100, - chilling: Default::default(), - unlocking: Default::default(), - }) - ); - // Account 1 does not control any stash - assert_eq!(DdcStaking::ledger(&1), None); - - // Cluster 1 settings are default - assert_eq!(DdcStaking::settings(1), Default::default()); - }); -} - -#[test] -fn change_controller_works() { - ExtBuilder::default().build_and_execute(|| { - // 10 and 11 are bonded as stash controller. - assert_eq!(DdcStaking::bonded(&11), Some(10)); - - // 10 can control 11 who is initially a validator. - assert_ok!(DdcStaking::withdraw_unbonded(RuntimeOrigin::signed(10))); - - // Change controller. - assert_ok!(DdcStaking::set_controller(RuntimeOrigin::signed(11), 3)); - assert_eq!(DdcStaking::bonded(&11), Some(3)); - - // 10 is no longer in control. - assert_noop!(DdcStaking::serve(RuntimeOrigin::signed(10), 1), Error::::NotController); - // 3 is a new controller. - assert_ok!(DdcStaking::serve(RuntimeOrigin::signed(3), 1)); - }) -} - -#[test] -fn staking_should_work() { - ExtBuilder::default().build_and_execute(|| { - // Put some money in account that we'll use. - for i in 1..5 { - let _ = Balances::make_free_balance_be(&i, 2000); - } - - // Add new CDN participant, account 3 controlled by 4. - assert_ok!(DdcStaking::bond(RuntimeOrigin::signed(3), 4, 1500)); - assert_ok!(DdcStaking::serve(RuntimeOrigin::signed(4), 1)); - - // Account 4 controls the stash from account 3, which is 1500 units and 3 is a CDN - // participant. - assert_eq!(DdcStaking::bonded(&3), Some(4)); - assert_eq!( - DdcStaking::ledger(&4), - Some(StakingLedger { - stash: 3, - total: 1500, - active: 1500, - chilling: Default::default(), - unlocking: Default::default(), - }) - ); - assert_eq!(DdcStaking::edges(3), Some(1)); - - // Set `CurrentEra`. - Timestamp::set_timestamp(System::block_number() * BLOCK_TIME + INIT_TIMESTAMP); - DdcStaking::on_finalize(System::block_number()); - - // Schedule CDN participant removal. - assert_ok!(DdcStaking::chill(RuntimeOrigin::signed(4))); - - // Removal is scheduled, stashed value of 4 is still lock. - let chilling = - DdcStaking::current_era().unwrap() + DdcStaking::settings(1).edge_chill_delay; - assert_eq!( - DdcStaking::ledger(&4), - Some(StakingLedger { - stash: 3, - total: 1500, - active: 1500, - chilling: Some(chilling), - unlocking: Default::default(), - }) - ); - // It cannot reserve more than 500 that it has free from the total 2000 - assert_noop!(Balances::reserve(&3, 501), BalancesError::::LiquidityRestrictions); - assert_ok!(Balances::reserve(&3, 409)); - - // Set `CurrentEra` to the value allows us to chill. - while DdcStaking::current_era().unwrap() < chilling { - System::set_block_number(System::block_number() + 1); - Timestamp::set_timestamp(System::block_number() * BLOCK_TIME + INIT_TIMESTAMP); - DdcStaking::on_finalize(System::block_number()); - } - - // Ledger is not changed until we make another call to `chill`. - assert_eq!( - DdcStaking::ledger(&4), - Some(StakingLedger { - stash: 3, - total: 1500, - active: 1500, - chilling: Some(chilling), - unlocking: Default::default(), - }) - ); - - // Actual CDN participant removal. - assert_ok!(DdcStaking::chill(RuntimeOrigin::signed(4))); - - // Account 3 is no longer a CDN participant. - assert_eq!(DdcStaking::edges(3), None); - }); -} diff --git a/pallets/ddc-staking/src/weights.rs b/pallets/ddc-staking/src/weights.rs old mode 100644 new mode 100755 index 937eece23..f08655fb9 --- a/pallets/ddc-staking/src/weights.rs +++ b/pallets/ddc-staking/src/weights.rs @@ -1,8 +1,8 @@ -//! Autogenerated weights for pallet_ddc_staking + +//! Autogenerated weights for `pallet_ddc_staking` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-04, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `e14`, CPU: `11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz` +//! DATE: 2023-03-02, STEPS: `500`, REPEAT: 200, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 // Executed Command: @@ -10,23 +10,23 @@ // benchmark // pallet // --chain=dev -// --steps=50 -// --repeat=20 +// --steps=500 +// --repeat=200 // --pallet=pallet_ddc_staking // --extrinsic=* // --execution=wasm // --wasm-execution=compiled -// --template=./.maintain/frame-weight-template.hbs -// --output=./pallets/ddc-staking/src +// --output=./frame/ddc-staking/src #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weight functions needed for pallet_ddc_staking. + +/// Weight functions needed for pallet_staking. pub trait WeightInfo { fn bond() -> Weight; fn unbond() -> Weight; @@ -37,137 +37,63 @@ pub trait WeightInfo { fn set_controller() -> Weight; } -/// Weights for pallet_ddc_staking using the Substrate node and recommended hardware. +/// Weight functions for `pallet_ddc_staking`. pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:1 w:1) // Storage: Balances Locks (r:1 w:1) fn bond() -> Weight { - Weight::from_ref_time(49_113_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - // Storage: DdcStaking Ledger (r:1 w:1) - // Storage: DdcStaking Edges (r:1 w:0) - // Storage: DdcStaking Storages (r:1 w:0) - // Storage: DdcStaking CurrentEra (r:1 w:0) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) - fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - // Storage: DdcStaking Ledger (r:1 w:1) - // Storage: DdcStaking CurrentEra (r:1 w:0) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) - fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - // Storage: DdcStaking Ledger (r:1 w:0) - // Storage: DdcStaking Settings (r:1 w:0) - // Storage: DdcStaking Edges (r:1 w:0) - // Storage: DdcStaking Storages (r:1 w:1) - fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_ref_time(51_000_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } // Storage: DdcStaking Ledger (r:1 w:0) - // Storage: DdcStaking Settings (r:1 w:0) - // Storage: DdcStaking Storages (r:1 w:0) - // Storage: DdcStaking Edges (r:1 w:1) - fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - // Storage: DdcStaking Ledger (r:1 w:1) - // Storage: DdcStaking CurrentEra (r:1 w:0) - // Storage: DdcStaking Edges (r:1 w:1) - // Storage: DdcStaking Settings (r:1 w:0) - // Storage: DdcStaking Storages (r:1 w:0) - fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) - } - // Storage: DdcStaking Bonded (r:1 w:1) - // Storage: DdcStaking Ledger (r:2 w:2) - fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - // Storage: DdcStaking Bonded (r:1 w:1) - // Storage: DdcStaking Ledger (r:1 w:1) - // Storage: Balances Locks (r:1 w:1) - fn bond() -> Weight { - Weight::from_ref_time(49_113_000 as u64) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) - } - // Storage: DdcStaking Ledger (r:1 w:1) - // Storage: DdcStaking Edges (r:1 w:0) - // Storage: DdcStaking Storages (r:1 w:0) - // Storage: DdcStaking CurrentEra (r:1 w:0) - // Storage: Balances Locks (r:1 w:1) - // Storage: System Account (r:1 w:1) fn unbond() -> Weight { - Weight::from_ref_time(47_727_000 as u64) - .saturating_add(RocksDbWeight::get().reads(6 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(10_000_000) + .saturating_add(T::DbWeight::get().reads(1)) } // Storage: DdcStaking Ledger (r:1 w:1) // Storage: DdcStaking CurrentEra (r:1 w:0) // Storage: Balances Locks (r:1 w:1) // Storage: System Account (r:1 w:1) fn withdraw_unbonded() -> Weight { - Weight::from_ref_time(69_750_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(46_000_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) } // Storage: DdcStaking Ledger (r:1 w:0) - // Storage: DdcStaking Settings (r:1 w:0) + // Storage: DdcStaking MinStorageBond (r:1 w:0) // Storage: DdcStaking Edges (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:1) + // Storage: DdcStaking CounterForStorages (r:1 w:1) fn store() -> Weight { - Weight::from_ref_time(26_112_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(22_000_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) } // Storage: DdcStaking Ledger (r:1 w:0) - // Storage: DdcStaking Settings (r:1 w:0) + // Storage: DdcStaking MinEdgeBond (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) // Storage: DdcStaking Edges (r:1 w:1) + // Storage: DdcStaking CounterForEdges (r:1 w:1) fn serve() -> Weight { - Weight::from_ref_time(19_892_000 as u64) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_ref_time(22_000_000) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(2)) } - // Storage: DdcStaking Ledger (r:1 w:1) - // Storage: DdcStaking CurrentEra (r:1 w:0) - // Storage: DdcStaking Edges (r:1 w:1) - // Storage: DdcStaking Settings (r:1 w:0) + // Storage: DdcStaking Ledger (r:1 w:0) // Storage: DdcStaking Storages (r:1 w:0) + // Storage: DdcStaking Edges (r:1 w:0) fn chill() -> Weight { - Weight::from_ref_time(77_450_000 as u64) - .saturating_add(RocksDbWeight::get().reads(5 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + Weight::from_ref_time(15_000_000) + .saturating_add(T::DbWeight::get().reads(3)) } // Storage: DdcStaking Bonded (r:1 w:1) // Storage: DdcStaking Ledger (r:2 w:2) fn set_controller() -> Weight { - Weight::from_ref_time(38_521_000 as u64) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(3 as u64)) + Weight::from_ref_time(20_000_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) } } diff --git a/pallets/ddc/Cargo.toml b/pallets/ddc/Cargo.toml index c15ee4ac7..94c517cea 100644 --- a/pallets/ddc/Cargo.toml +++ b/pallets/ddc/Cargo.toml @@ -6,7 +6,7 @@ homepage = 'https://www.cere.network/' license = 'Unlicense' name = 'pallet-cere-ddc' repository = 'https://github.com/Cerebellum-Network/ddc-pallet' -version = '4.8.0' +version = '4.7.0' readme = 'README.md' [package.metadata.docs.rs] @@ -14,15 +14,15 @@ targets = ['x86_64-unknown-linux-gnu'] [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } [dev-dependencies] -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } serde = { version = "1.0.101" } [features] diff --git a/pallets/ddc/src/lib.rs b/pallets/ddc/src/lib.rs index e1d572af6..d8008c2b8 100644 --- a/pallets/ddc/src/lib.rs +++ b/pallets/ddc/src/lib.rs @@ -1,13 +1,10 @@ #![cfg_attr(not(feature = "std"), no_std)] use frame_support::{ - decl_error, - decl_event, - decl_module, - decl_storage, + decl_error, decl_event, decl_module, decl_storage, // dispatch, ensure, - traits::Get, + traits::{ Get }, }; use frame_system::ensure_signed; @@ -25,7 +22,7 @@ mod tests; /// Configure the pallet by specifying the parameters and types on which it depends. pub trait Config: frame_system::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. - type RuntimeEvent: From> + Into<::RuntimeEvent>; + type Event: From> + Into<::Event>; /// The minimum length a name may be. type MinLength: Get; @@ -55,7 +52,7 @@ decl_event!( { /// A data string was set. \[who\] DataStringSet(AccountId), - + /// A data string was changed. \[who\] DataStringChanged(AccountId), } @@ -76,7 +73,7 @@ decl_error! { // Dispatchable functions must be annotated with a weight and must return a DispatchResult. decl_module! { /// CereDDCModule declaration. - pub struct Module for enum Call where origin: T::RuntimeOrigin { + pub struct Module for enum Call where origin: T::Origin { // Errors must be initialized if they are used by the pallet. type Error = Error; diff --git a/pallets/ddc/src/mock.rs b/pallets/ddc/src/mock.rs index 0bb912223..ff59e6902 100644 --- a/pallets/ddc/src/mock.rs +++ b/pallets/ddc/src/mock.rs @@ -1,12 +1,14 @@ -use crate as pallet_cere_ddc; -use crate::Module; -use frame_support::{construct_runtime, parameter_types, traits::Everything}; -use frame_system as system; +use crate::{Module}; use sp_core::H256; +use frame_support::{ + traits::{Everything}, + construct_runtime, parameter_types +}; use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, IdentityLookup}, + traits::{BlakeTwo256, IdentityLookup}, testing::Header, }; +use frame_system as system; +use crate as pallet_cere_ddc; // Configure a mock runtime to test the pallet. type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -31,8 +33,8 @@ impl system::Config for Test { type BaseCallFilter = Everything; type BlockWeights = (); type BlockLength = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; + type Origin = Origin; + type Call = Call; type Index = u64; type BlockNumber = u64; type Hash = H256; @@ -40,7 +42,7 @@ impl system::Config for Test { type AccountId = u64; type Lookup = IdentityLookup; type Header = Header; - type RuntimeEvent = (); + type Event = (); type BlockHashCount = BlockHashCount; type DbWeight = (); type Version = (); @@ -60,7 +62,7 @@ parameter_types! { } impl pallet_cere_ddc::Config for Test { - type RuntimeEvent = (); + type Event = (); type MinLength = MinLength; type MaxLength = MaxLength; } diff --git a/pallets/ddc/src/tests.rs b/pallets/ddc/src/tests.rs index 95f5927ae..512eaac29 100644 --- a/pallets/ddc/src/tests.rs +++ b/pallets/ddc/src/tests.rs @@ -7,7 +7,7 @@ const BOB: u64 = 2; fn send_data_works_valid_input() { new_test_ext().execute_with(|| { // Dispatch a signed extrinsic. - assert_ok!(CereDDCModule::send_data(RuntimeOrigin::signed(1), BOB, b"12345678".to_vec())); + assert_ok!(CereDDCModule::send_data(Origin::signed(1), BOB, b"12345678".to_vec())); }); } @@ -16,7 +16,7 @@ fn send_data_error_too_long() { new_test_ext().execute_with(|| { // Ensure the expected error is thrown when no value is present. assert_noop!( - CereDDCModule::send_data(RuntimeOrigin::signed(1), BOB, b"TestTooLongString".to_vec()), + CereDDCModule::send_data(Origin::signed(1), BOB, b"TestTooLongString".to_vec()), Error::::TooLong ); }); @@ -27,7 +27,7 @@ fn send_data_error_too_short() { new_test_ext().execute_with(|| { // Ensure the expected error is thrown when no value is present. assert_noop!( - CereDDCModule::send_data(RuntimeOrigin::signed(1), BOB, b"Short".to_vec()), + CereDDCModule::send_data(Origin::signed(1), BOB, b"Short".to_vec()), Error::::TooShort ); }); diff --git a/pallets/erc20/Cargo.toml b/pallets/erc20/Cargo.toml index fafa6ae83..8d1cb2536 100644 --- a/pallets/erc20/Cargo.toml +++ b/pallets/erc20/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-erc20" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" license = "Unlicense" @@ -15,19 +15,19 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } -sp-arithmetic = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false } +sp-arithmetic = { version = "5.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false } pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../chainbridge" } pallet-erc721 = { version = "4.2.0", default-features = false, path = "../erc721" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } [features] default = ["std"] diff --git a/pallets/erc20/src/lib.rs b/pallets/erc20/src/lib.rs index 8f861d10d..cd7fb21e2 100644 --- a/pallets/erc20/src/lib.rs +++ b/pallets/erc20/src/lib.rs @@ -4,49 +4,50 @@ use pallet_chainbridge as bridge; use pallet_erc721 as erc721; -use codec::{Decode, Encode}; +use sp_std::marker::PhantomData; use frame_support::{ - decl_error, decl_event, decl_module, decl_storage, - dispatch::DispatchResult, - ensure, + dispatch::{DispatchResult}, decl_module, decl_storage, decl_event, decl_error, traits::{Currency, EnsureOrigin, ExistenceRequirement::AllowDeath, Get}, - weights::{ClassifyDispatch, DispatchClass, Pays, PaysFee, WeighData, Weight}, + ensure, + weights::{DispatchClass, ClassifyDispatch, WeighData, Weight, PaysFee, Pays}, }; -use frame_system::{self as system, ensure_root, ensure_signed}; +use sp_std::prelude::*; +use frame_system::{self as system, ensure_signed, ensure_root}; use sp_arithmetic::traits::SaturatedConversion; use sp_core::U256; +use codec::{Encode, Decode}; use sp_runtime::{ - traits::{Bounded, DispatchInfoOf, SignedExtension, UniqueSaturatedInto}, + traits::{ + SignedExtension, Bounded, DispatchInfoOf, UniqueSaturatedInto, + }, transaction_validity::{ - InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, + ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity, }, }; -use sp_std::{marker::PhantomData, prelude::*}; type ResourceId = bridge::ResourceId; type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; + <::Currency as Currency<::AccountId>>::Balance; pub trait Config: system::Config + bridge::Config + erc721::Config { - type RuntimeEvent: From> + Into<::RuntimeEvent>; - /// Specifies the origin check provided by the bridge for calls that can only be called by the - /// bridge pallet - type BridgeOrigin: EnsureOrigin; - - /// The currency mechanism. - type Currency: Currency; - - /// Ids can be defined by the runtime and passed in, perhaps from blake2b_128 hashes. - type HashId: Get; - type NativeTokenId: Get; - type Erc721Id: Get; + type Event: From> + Into<::Event>; + /// Specifies the origin check provided by the bridge for calls that can only be called by the bridge pallet + type BridgeOrigin: EnsureOrigin; + + /// The currency mechanism. + type Currency: Currency; + + /// Ids can be defined by the runtime and passed in, perhaps from blake2b_128 hashes. + type HashId: Get; + type NativeTokenId: Get; + type Erc721Id: Get; } decl_error! { - pub enum Error for Module{ - InvalidTransfer, - } + pub enum Error for Module{ + InvalidTransfer, + } } decl_storage! { @@ -54,93 +55,93 @@ decl_storage! { } decl_event!( - pub enum Event where - ::Hash, - { - Remark(Hash), - } + pub enum Event where + ::Hash, + { + Remark(Hash), + } ); decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin { - const HashId: ResourceId = T::HashId::get(); - const NativeTokenId: ResourceId = T::NativeTokenId::get(); - const Erc721Id: ResourceId = T::Erc721Id::get(); - - fn deposit_event() = default; - - // - // Initiation calls. These start a bridge transfer. - // - - /// Transfers an arbitrary hash to a (whitelisted) destination chain. - #[weight = 195_000_000] - pub fn transfer_hash(origin, hash: T::Hash, dest_id: bridge::ChainId) -> DispatchResult { - ensure_signed(origin)?; - - let resource_id = T::HashId::get(); - let metadata: Vec = hash.as_ref().to_vec(); - >::transfer_generic(dest_id, resource_id, metadata) - } - - /// Transfers some amount of the native token to some recipient on a (whitelisted) destination chain. - #[weight = 195_000_000] - pub fn transfer_native(origin, amount: BalanceOf, recipient: Vec, dest_id: bridge::ChainId) -> DispatchResult { - let source = ensure_signed(origin)?; - ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); - let bridge_id = >::account_id(); - T::Currency::transfer(&source, &bridge_id, amount.into(), AllowDeath)?; - - let resource_id = T::NativeTokenId::get(); + pub struct Module for enum Call where origin: T::Origin { + const HashId: ResourceId = T::HashId::get(); + const NativeTokenId: ResourceId = T::NativeTokenId::get(); + const Erc721Id: ResourceId = T::Erc721Id::get(); + + fn deposit_event() = default; + + // + // Initiation calls. These start a bridge transfer. + // + + /// Transfers an arbitrary hash to a (whitelisted) destination chain. + #[weight = 195_000_000] + pub fn transfer_hash(origin, hash: T::Hash, dest_id: bridge::ChainId) -> DispatchResult { + ensure_signed(origin)?; + + let resource_id = T::HashId::get(); + let metadata: Vec = hash.as_ref().to_vec(); + >::transfer_generic(dest_id, resource_id, metadata) + } + + /// Transfers some amount of the native token to some recipient on a (whitelisted) destination chain. + #[weight = 195_000_000] + pub fn transfer_native(origin, amount: BalanceOf, recipient: Vec, dest_id: bridge::ChainId) -> DispatchResult { + let source = ensure_signed(origin)?; + ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); + let bridge_id = >::account_id(); + T::Currency::transfer(&source, &bridge_id, amount.into(), AllowDeath)?; + + let resource_id = T::NativeTokenId::get(); let number_amount: u128 = amount.saturated_into(); - >::transfer_fungible(dest_id, resource_id, recipient, U256::from(number_amount)) - } - - - /// Transfer a non-fungible token (erc721) to a (whitelisted) destination chain. - #[weight = 195_000_000] - pub fn transfer_erc721(origin, recipient: Vec, token_id: U256, dest_id: bridge::ChainId) -> DispatchResult { - let source = ensure_signed(origin)?; - ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); - match >::tokens(&token_id) { - Some(token) => { - >::burn_token(source, token_id)?; - let resource_id = T::Erc721Id::get(); - let tid: &mut [u8] = &mut[0; 32]; - token_id.to_big_endian(tid); - >::transfer_nonfungible(dest_id, resource_id, tid.to_vec(), recipient, token.metadata) - } - None => Err(Error::::InvalidTransfer)? - } - } - - // - // Executable calls. These can be triggered by a bridge transfer initiated on another chain - // - - /// Executes a simple currency transfer using the bridge account as the source - #[weight = 195_000_000] - pub fn transfer(origin, to: T::AccountId, amount: BalanceOf) -> DispatchResult { - let source = T::BridgeOrigin::ensure_origin(origin)?; - ::Currency::transfer(&source, &to, amount.into(), AllowDeath)?; - Ok(()) - } - - /// This can be called by the bridge to demonstrate an arbitrary call from a proposal. - #[weight = 195_000_000] - pub fn remark(origin, hash: T::Hash) -> DispatchResult { - T::BridgeOrigin::ensure_origin(origin)?; - Self::deposit_event(RawEvent::Remark(hash)); - Ok(()) - } - - /// Allows the bridge to issue new erc721 tokens - #[weight = 195_000_000] - pub fn mint_erc721(origin, recipient: T::AccountId, id: U256, metadata: Vec) -> DispatchResult { - T::BridgeOrigin::ensure_origin(origin)?; - >::mint_token(recipient, id, metadata)?; - Ok(()) - } - } + >::transfer_fungible(dest_id, resource_id, recipient, U256::from(number_amount)) + } + + + /// Transfer a non-fungible token (erc721) to a (whitelisted) destination chain. + #[weight = 195_000_000] + pub fn transfer_erc721(origin, recipient: Vec, token_id: U256, dest_id: bridge::ChainId) -> DispatchResult { + let source = ensure_signed(origin)?; + ensure!(>::chain_whitelisted(dest_id), Error::::InvalidTransfer); + match >::tokens(&token_id) { + Some(token) => { + >::burn_token(source, token_id)?; + let resource_id = T::Erc721Id::get(); + let tid: &mut [u8] = &mut[0; 32]; + token_id.to_big_endian(tid); + >::transfer_nonfungible(dest_id, resource_id, tid.to_vec(), recipient, token.metadata) + } + None => Err(Error::::InvalidTransfer)? + } + } + + // + // Executable calls. These can be triggered by a bridge transfer initiated on another chain + // + + /// Executes a simple currency transfer using the bridge account as the source + #[weight = 195_000_000] + pub fn transfer(origin, to: T::AccountId, amount: BalanceOf) -> DispatchResult { + let source = T::BridgeOrigin::ensure_origin(origin)?; + ::Currency::transfer(&source, &to, amount.into(), AllowDeath)?; + Ok(()) + } + + /// This can be called by the bridge to demonstrate an arbitrary call from a proposal. + #[weight = 195_000_000] + pub fn remark(origin, hash: T::Hash) -> DispatchResult { + T::BridgeOrigin::ensure_origin(origin)?; + Self::deposit_event(RawEvent::Remark(hash)); + Ok(()) + } + + /// Allows the bridge to issue new erc721 tokens + #[weight = 195_000_000] + pub fn mint_erc721(origin, recipient: T::AccountId, id: U256, metadata: Vec) -> DispatchResult { + T::BridgeOrigin::ensure_origin(origin)?; + >::mint_token(recipient, id, metadata)?; + Ok(()) + } + } } diff --git a/pallets/erc721/Cargo.toml b/pallets/erc721/Cargo.toml index 5f7d02e22..210c4f2f7 100644 --- a/pallets/erc721/Cargo.toml +++ b/pallets/erc721/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pallet-erc721" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" license = "Unlicense" @@ -15,17 +15,17 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] serde = { version = "1.0.136", optional = true } codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false,git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0", default-features = false,git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-core = { version = "6.0.0", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false } pallet-chainbridge = { version = "4.2.0", default-features = false, path = "../chainbridge" } scale-info = { version = "2.1.2", default-features = false, features = ["derive"] } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } [features] default = ["std"] diff --git a/pallets/erc721/src/lib.rs b/pallets/erc721/src/lib.rs index c0da9c7a3..f43413aec 100644 --- a/pallets/erc721/src/lib.rs +++ b/pallets/erc721/src/lib.rs @@ -1,24 +1,26 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -use codec::{Decode, Encode}; +use sp_std::marker::PhantomData; use frame_support::{ - decl_error, decl_event, decl_module, decl_storage, - dispatch::{ClassifyDispatch, DispatchClass, DispatchResult, Pays, PaysFee, WeighData}, + dispatch::{DispatchResult}, decl_module, decl_storage, decl_event, decl_error, ensure, traits::Get, - weights::Weight, + weights::{DispatchClass, ClassifyDispatch, WeighData, Weight, PaysFee, Pays}, }; -use frame_system::{self as system, ensure_root, ensure_signed}; +use sp_std::prelude::*; +use frame_system::{self as system, ensure_signed, ensure_root}; use sp_core::U256; +use codec::{Encode, Decode}; use sp_runtime::{ - traits::{Bounded, DispatchInfoOf, SaturatedConversion, SignedExtension}, + traits::{ + SignedExtension, Bounded, SaturatedConversion, DispatchInfoOf, + }, transaction_validity::{ - InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction, + ValidTransaction, TransactionValidityError, InvalidTransaction, TransactionValidity, }, RuntimeDebug, }; -use sp_std::{marker::PhantomData, prelude::*}; mod mock; mod tests; @@ -27,136 +29,135 @@ type TokenId = U256; #[derive(PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, scale_info::TypeInfo)] pub struct Erc721Token { - pub id: TokenId, - pub metadata: Vec, + pub id: TokenId, + pub metadata: Vec, } pub trait Config: system::Config { - type RuntimeEvent: From> + Into<::RuntimeEvent>; + type Event: From> + Into<::Event>; - /// Some identifier for this token type, possibly the originating ethereum address. - /// This is not explicitly used for anything, but may reflect the bridge's notion of resource - /// ID. - type Identifier: Get<[u8; 32]>; + /// Some identifier for this token type, possibly the originating ethereum address. + /// This is not explicitly used for anything, but may reflect the bridge's notion of resource ID. + type Identifier: Get<[u8; 32]>; } decl_error! { - pub enum Error for Module { - /// ID not recognized - TokenIdDoesNotExist, - /// Already exists with an owner - TokenAlreadyExists, - /// Origin is not owner - NotOwner, - } + pub enum Error for Module { + /// ID not recognized + TokenIdDoesNotExist, + /// Already exists with an owner + TokenAlreadyExists, + /// Origin is not owner + NotOwner, + } } decl_storage! { trait Store for Module as TokenStorage { - /// Maps tokenId to Erc721 object - Tokens get(fn tokens): map hasher(opaque_blake2_256) TokenId => Option; - /// Maps tokenId to owner - TokenOwner get(fn owner_of): map hasher(opaque_blake2_256) TokenId => Option; - /// Total number of tokens in existence - TokenCount get(fn token_count): U256 = U256::zero(); - } + /// Maps tokenId to Erc721 object + Tokens get(fn tokens): map hasher(opaque_blake2_256) TokenId => Option; + /// Maps tokenId to owner + TokenOwner get(fn owner_of): map hasher(opaque_blake2_256) TokenId => Option; + /// Total number of tokens in existence + TokenCount get(fn token_count): U256 = U256::zero(); + } } decl_event!( pub enum Event - where - ::AccountId, - { - /// New token created - Minted(AccountId, TokenId), - /// Token transfer between two parties - Transferred(AccountId, AccountId, TokenId), - /// Token removed from the system - Burned(TokenId), - } + where + ::AccountId, + { + /// New token created + Minted(AccountId, TokenId), + /// Token transfer between two parties + Transferred(AccountId, AccountId, TokenId), + /// Token removed from the system + Burned(TokenId), + } ); decl_module! { - pub struct Module for enum Call where origin: T::RuntimeOrigin { - type Error = Error; - fn deposit_event() = default; + pub struct Module for enum Call where origin: T::Origin { + type Error = Error; + fn deposit_event() = default; - /// Creates a new token with the given token ID and metadata, and gives ownership to owner - #[weight = 195_000_000] - pub fn mint(origin, owner: T::AccountId, id: TokenId, metadata: Vec) -> DispatchResult { - ensure_root(origin)?; + /// Creates a new token with the given token ID and metadata, and gives ownership to owner + #[weight = 195_000_000] + pub fn mint(origin, owner: T::AccountId, id: TokenId, metadata: Vec) -> DispatchResult { + ensure_root(origin)?; - Self::mint_token(owner, id, metadata)?; + Self::mint_token(owner, id, metadata)?; - Ok(()) - } + Ok(()) + } - /// Changes ownership of a token sender owns - #[weight = 195_000_000] - pub fn transfer(origin, to: T::AccountId, id: TokenId) -> DispatchResult { - let sender = ensure_signed(origin)?; + /// Changes ownership of a token sender owns + #[weight = 195_000_000] + pub fn transfer(origin, to: T::AccountId, id: TokenId) -> DispatchResult { + let sender = ensure_signed(origin)?; - Self::transfer_from(sender, to, id)?; + Self::transfer_from(sender, to, id)?; - Ok(()) - } + Ok(()) + } - /// Remove token from the system - #[weight = 195_000_000] - pub fn burn(origin, id: TokenId) -> DispatchResult { - ensure_root(origin)?; + /// Remove token from the system + #[weight = 195_000_000] + pub fn burn(origin, id: TokenId) -> DispatchResult { + ensure_root(origin)?; - let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; + let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; - Self::burn_token(owner, id)?; + Self::burn_token(owner, id)?; - Ok(()) - } - } + Ok(()) + } + } } impl Module { - /// Creates a new token in the system. - pub fn mint_token(owner: T::AccountId, id: TokenId, metadata: Vec) -> DispatchResult { - ensure!(!Tokens::contains_key(id), Error::::TokenAlreadyExists); + /// Creates a new token in the system. + pub fn mint_token(owner: T::AccountId, id: TokenId, metadata: Vec) -> DispatchResult { + ensure!(!Tokens::contains_key(id), Error::::TokenAlreadyExists); - let new_token = Erc721Token { id, metadata }; + let new_token = Erc721Token { id, metadata }; - ::insert(&id, new_token); - >::insert(&id, owner.clone()); - let new_total = ::get().saturating_add(U256::one()); - ::put(new_total); + ::insert(&id, new_token); + >::insert(&id, owner.clone()); + let new_total = ::get().saturating_add(U256::one()); + ::put(new_total); - Self::deposit_event(RawEvent::Minted(owner, id)); + Self::deposit_event(RawEvent::Minted(owner, id)); - Ok(()) - } + Ok(()) + } - /// Modifies ownership of a token - pub fn transfer_from(from: T::AccountId, to: T::AccountId, id: TokenId) -> DispatchResult { - // Check from is owner and token exists - let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; - ensure!(owner == from, Error::::NotOwner); - // Update owner - >::insert(&id, to.clone()); + /// Modifies ownership of a token + pub fn transfer_from(from: T::AccountId, to: T::AccountId, id: TokenId) -> DispatchResult { + // Check from is owner and token exists + let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; + ensure!(owner == from, Error::::NotOwner); + // Update owner + >::insert(&id, to.clone()); - Self::deposit_event(RawEvent::Transferred(from, to, id)); + Self::deposit_event(RawEvent::Transferred(from, to, id)); - Ok(()) - } + Ok(()) + } - /// Deletes a token from the system. - pub fn burn_token(from: T::AccountId, id: TokenId) -> DispatchResult { - let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; - ensure!(owner == from, Error::::NotOwner); + /// Deletes a token from the system. + pub fn burn_token(from: T::AccountId, id: TokenId) -> DispatchResult { + let owner = Self::owner_of(id).ok_or(Error::::TokenIdDoesNotExist)?; + ensure!(owner == from, Error::::NotOwner); - ::remove(&id); - >::remove(&id); - let new_total = ::get().saturating_sub(U256::one()); - ::put(new_total); + ::remove(&id); + >::remove(&id); + let new_total = ::get().saturating_sub(U256::one()); + ::put(new_total); - Self::deposit_event(RawEvent::Burned(id)); + Self::deposit_event(RawEvent::Burned(id)); - Ok(()) - } + Ok(()) + } } diff --git a/pallets/erc721/src/mock.rs b/pallets/erc721/src/mock.rs index 24ee23b92..bb872fa8f 100644 --- a/pallets/erc721/src/mock.rs +++ b/pallets/erc721/src/mock.rs @@ -1,94 +1,96 @@ #![cfg(test)] -use frame_support::{ord_parameter_types, parameter_types, traits::Everything, weights::Weight}; +use frame_support::{ord_parameter_types, parameter_types, weights::Weight}; +use frame_support::traits::Everything; use frame_system::{self as system}; -use sp_core::{hashing::blake2_128, H256}; +use sp_core::hashing::blake2_128; +use sp_core::H256; use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, Block as BlockT, IdentityLookup}, - BuildStorage, Perbill, + testing::Header, + traits::{BlakeTwo256, Block as BlockT, IdentityLookup}, + BuildStorage, Perbill, }; use crate::{self as erc721, Config}; -pub use pallet_balances as balances; use pallet_chainbridge as bridge; +pub use pallet_balances as balances; parameter_types! { - pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); - pub const MaximumBlockLength: u32 = 2 * 1024; - pub const AvailableBlockRatio: Perbill = Perbill::one(); + pub const BlockHashCount: u64 = 250; + pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockLength: u32 = 2 * 1024; + pub const AvailableBlockRatio: Perbill = Perbill::one(); } impl frame_system::Config for Test { - type BaseCallFilter = Everything; - type BlockWeights = (); - type BlockLength = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = BlakeTwo256; - type AccountId = u64; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type DbWeight = (); - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type Origin = Origin; + type Call = Call; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = u64; + type Lookup = IdentityLookup; + type Header = Header; + type Event = Event; + type BlockHashCount = BlockHashCount; + type DbWeight = (); + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = balances::AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = frame_support::traits::ConstU32<16>; } parameter_types! { - pub const ExistentialDeposit: u64 = 1; + pub const ExistentialDeposit: u64 = 1; } ord_parameter_types! { - pub const One: u64 = 1; + pub const One: u64 = 1; } impl pallet_balances::Config for Test { - type Balance = u64; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = (); + type Balance = u64; + type DustRemoval = (); + type Event = Event; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = (); } parameter_types! { - pub Erc721Id: bridge::ResourceId = bridge::derive_resource_id(1, &blake2_128(b"NFT")); + pub Erc721Id: bridge::ResourceId = bridge::derive_resource_id(1, &blake2_128(b"NFT")); } impl Config for Test { - type RuntimeEvent = RuntimeEvent; - type Identifier = Erc721Id; + type Event = Event; + type Identifier = Erc721Id; } pub type Block = sp_runtime::generic::Block; -pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic; +pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic; frame_support::construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic - { - System: system::{Pallet, Call, Event}, - Balances: balances::{Pallet, Call, Storage, Config, Event}, - Erc721: erc721::{Pallet, Call, Storage, Event}, - } + pub enum Test where + Block = Block, + NodeBlock = Block, + UncheckedExtrinsic = UncheckedExtrinsic + { + System: system::{Pallet, Call, Event}, + Balances: balances::{Pallet, Call, Storage, Config, Event}, + Erc721: erc721::{Pallet, Call, Storage, Event}, + } ); pub const USER_A: u64 = 0x1; @@ -97,10 +99,12 @@ pub const USER_C: u64 = 0x3; pub const ENDOWED_BALANCE: u64 = 100_000_000; pub fn new_test_ext() -> sp_io::TestExternalities { - GenesisConfig { - balances: balances::GenesisConfig { balances: vec![(USER_A, ENDOWED_BALANCE)] }, - } - .build_storage() - .unwrap() - .into() + GenesisConfig { + balances: balances::GenesisConfig { + balances: vec![(USER_A, ENDOWED_BALANCE)], + }, + } + .build_storage() + .unwrap() + .into() } diff --git a/pallets/erc721/src/tests.rs b/pallets/erc721/src/tests.rs index f273f83a3..416a71737 100644 --- a/pallets/erc721/src/tests.rs +++ b/pallets/erc721/src/tests.rs @@ -1,75 +1,99 @@ #![cfg(test)] -use super::{ - mock::{new_test_ext, Erc721, RuntimeOrigin, Test, USER_A, USER_B, USER_C}, - *, -}; +use super::mock::{new_test_ext, Erc721, Origin, Test, USER_A, USER_B, USER_C}; +use super::*; use frame_support::{assert_noop, assert_ok}; use sp_core::U256; #[test] fn mint_burn_tokens() { - new_test_ext().execute_with(|| { - let id_a: U256 = 1.into(); - let id_b: U256 = 2.into(); - let metadata_a: Vec = vec![1, 2, 3]; - let metadata_b: Vec = vec![4, 5, 6]; + new_test_ext().execute_with(|| { + let id_a: U256 = 1.into(); + let id_b: U256 = 2.into(); + let metadata_a: Vec = vec![1, 2, 3]; + let metadata_b: Vec = vec![4, 5, 6]; - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a.clone())); - assert_eq!( - Erc721::tokens(id_a).unwrap(), - Erc721Token { id: id_a, metadata: metadata_a.clone() } - ); - assert_eq!(Erc721::token_count(), 1.into()); - assert_noop!( - Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a.clone()), - Error::::TokenAlreadyExists - ); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_a, + metadata_a.clone() + )); + assert_eq!( + Erc721::tokens(id_a).unwrap(), + Erc721Token { + id: id_a, + metadata: metadata_a.clone() + } + ); + assert_eq!(Erc721::token_count(), 1.into()); + assert_noop!( + Erc721::mint(Origin::root(), USER_A, id_a, metadata_a.clone()), + Error::::TokenAlreadyExists + ); - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b.clone())); - assert_eq!( - Erc721::tokens(id_b).unwrap(), - Erc721Token { id: id_b, metadata: metadata_b.clone() } - ); - assert_eq!(Erc721::token_count(), 2.into()); - assert_noop!( - Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b.clone()), - Error::::TokenAlreadyExists - ); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_b, + metadata_b.clone() + )); + assert_eq!( + Erc721::tokens(id_b).unwrap(), + Erc721Token { + id: id_b, + metadata: metadata_b.clone() + } + ); + assert_eq!(Erc721::token_count(), 2.into()); + assert_noop!( + Erc721::mint(Origin::root(), USER_A, id_b, metadata_b.clone()), + Error::::TokenAlreadyExists + ); - assert_ok!(Erc721::burn(RuntimeOrigin::root(), id_a)); - assert_eq!(Erc721::token_count(), 1.into()); - assert!(!::contains_key(&id_a)); - assert!(!>::contains_key(&id_a)); + assert_ok!(Erc721::burn(Origin::root(), id_a)); + assert_eq!(Erc721::token_count(), 1.into()); + assert!(!::contains_key(&id_a)); + assert!(!>::contains_key(&id_a)); - assert_ok!(Erc721::burn(RuntimeOrigin::root(), id_b)); - assert_eq!(Erc721::token_count(), 0.into()); - assert!(!::contains_key(&id_b)); - assert!(!>::contains_key(&id_b)); - }) + assert_ok!(Erc721::burn(Origin::root(), id_b)); + assert_eq!(Erc721::token_count(), 0.into()); + assert!(!::contains_key(&id_b)); + assert!(!>::contains_key(&id_b)); + }) } #[test] fn transfer_tokens() { - new_test_ext().execute_with(|| { - let id_a: U256 = 1.into(); - let id_b: U256 = 2.into(); - let metadata_a: Vec = vec![1, 2, 3]; - let metadata_b: Vec = vec![4, 5, 6]; + new_test_ext().execute_with(|| { + let id_a: U256 = 1.into(); + let id_b: U256 = 2.into(); + let metadata_a: Vec = vec![1, 2, 3]; + let metadata_b: Vec = vec![4, 5, 6]; - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_a, metadata_a.clone())); - assert_ok!(Erc721::mint(RuntimeOrigin::root(), USER_A, id_b, metadata_b.clone())); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_a, + metadata_a.clone() + )); + assert_ok!(Erc721::mint( + Origin::root(), + USER_A, + id_b, + metadata_b.clone() + )); - assert_ok!(Erc721::transfer(RuntimeOrigin::signed(USER_A), USER_B, id_a)); - assert_eq!(Erc721::owner_of(id_a).unwrap(), USER_B); + assert_ok!(Erc721::transfer(Origin::signed(USER_A), USER_B, id_a)); + assert_eq!(Erc721::owner_of(id_a).unwrap(), USER_B); - assert_ok!(Erc721::transfer(RuntimeOrigin::signed(USER_A), USER_C, id_b)); - assert_eq!(Erc721::owner_of(id_b).unwrap(), USER_C); + assert_ok!(Erc721::transfer(Origin::signed(USER_A), USER_C, id_b)); + assert_eq!(Erc721::owner_of(id_b).unwrap(), USER_C); - assert_ok!(Erc721::transfer(RuntimeOrigin::signed(USER_B), USER_A, id_a)); - assert_eq!(Erc721::owner_of(id_a).unwrap(), USER_A); + assert_ok!(Erc721::transfer(Origin::signed(USER_B), USER_A, id_a)); + assert_eq!(Erc721::owner_of(id_a).unwrap(), USER_A); - assert_ok!(Erc721::transfer(RuntimeOrigin::signed(USER_C), USER_A, id_b)); - assert_eq!(Erc721::owner_of(id_b).unwrap(), USER_A); - }) + assert_ok!(Erc721::transfer(Origin::signed(USER_C), USER_A, id_b)); + assert_eq!(Erc721::owner_of(id_b).unwrap(), USER_A); + }) } diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 65de7e088..6fbcee84a 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -1,30 +1,30 @@ [package] name = "cere-rpc" -version = "4.8.0" +version = "4.7.0" edition = "2021" [dependencies] jsonrpsee = { version = "0.15.1", features = ["server"] } -sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-consensus-babe-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-consensus-epochs = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-finality-grandpa-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -substrate-state-trie-migration-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sc-client-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-blockchain = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-keystore = { version = "0.12.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-consensus = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-chain-spec = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-rpc-api = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-consensus-babe = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-consensus-babe-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-consensus-epochs = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-finality-grandpa = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-finality-grandpa-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sc-sync-state-rpc = { version = "0.10.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +substrate-frame-rpc-system = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +pallet-transaction-payment-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +sp-block-builder = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +substrate-state-trie-migration-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" } +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sc-transaction-pool-api = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts-rpc = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } diff --git a/rpc/src/lib.rs b/rpc/src/lib.rs index 9abf2af02..a47380803 100644 --- a/rpc/src/lib.rs +++ b/rpc/src/lib.rs @@ -93,13 +93,13 @@ where B: sc_client_api::Backend + Send + Sync + 'static, B::State: sc_client_api::backend::StateBackend>, { - use pallet_contracts_rpc::{Contracts, ContractsApiServer}; - use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; - use sc_consensus_babe_rpc::{Babe, BabeApiServer}; + use pallet_contracts_rpc::{ContractsApiServer, Contracts}; + use pallet_transaction_payment_rpc::{TransactionPaymentApiServer, TransactionPayment}; + use sc_consensus_babe_rpc::{BabeApiServer, Babe}; use sc_finality_grandpa_rpc::GrandpaApiServer; use sc_rpc::dev::{Dev, DevApiServer}; use sc_sync_state_rpc::{SyncState, SyncStateApiServer}; - use substrate_frame_rpc_system::{System, SystemApiServer}; + use substrate_frame_rpc_system::{SystemApiServer, System}; use substrate_state_trie_migration_rpc::StateMigrationApiServer; let mut io = RpcModule::new(()); @@ -148,12 +148,8 @@ where )?; io.merge( - substrate_state_trie_migration_rpc::StateMigration::new( - client.clone(), - backend, - deny_unsafe, - ) - .into_rpc(), + substrate_state_trie_migration_rpc::StateMigration::new(client.clone(), backend, deny_unsafe) + .into_rpc(), )?; io.merge(Dev::new(client, deny_unsafe).into_rpc())?; diff --git a/runtime/cere-dev/Cargo.toml b/runtime/cere-dev/Cargo.toml index 885bd1c58..a969e8de0 100644 --- a/runtime/cere-dev/Cargo.toml +++ b/runtime/cere-dev/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cere-dev-runtime" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" build = "build.rs" @@ -24,87 +24,86 @@ hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.16", default-features = false } # primitives -sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, version = "4.0.0-dev" } -sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false, version = "4.0.0-dev" } +sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } # frame dependencies -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-authorship = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } -pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } -pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } -pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } -pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-authorship = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.29" } +pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false, optional = true } +pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false } +pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false, optional = true } +pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } cere-runtime-common = { path = "../common", default-features = false } cere-dev-runtime-constants = { path = "./constants", default-features = false } -pallet-ddc-staking = { version = "4.8.0", default-features = false, path = "../../pallets/ddc-staking" } -pallet-chainbridge = { version = "4.8.0", default-features = false, path = "../../pallets/chainbridge" } -pallet-cere-ddc = { version = "4.8.0", default-features = false, path = "../../pallets/ddc" } -pallet-erc721 = { version = "4.8.0", default-features = false, path = "../../pallets/erc721" } -pallet-erc20 = { version = "4.8.0", default-features = false, path = "../../pallets/erc20" } -pallet-ddc-metrics-offchain-worker = { version = "4.8.0", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } +pallet-ddc-staking = { version = "4.7.0", default-features = false, path = "../../pallets/ddc-staking" } +pallet-chainbridge = { version = "4.7.0", default-features = false, path = "../../pallets/chainbridge" } +pallet-cere-ddc = { version = "4.7.0", default-features = false, path = "../../pallets/ddc" } +pallet-erc721 = { version = "4.7.0", default-features = false, path = "../../pallets/erc721" } +pallet-erc20 = { version = "4.7.0", default-features = false, path = "../../pallets/erc20" } +pallet-ddc-metrics-offchain-worker = { version = "4.7.0", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } [features] default = ["std"] @@ -126,7 +125,6 @@ std = [ "pallet-contracts-primitives/std", "pallet-contracts-rpc-runtime-api/std", "pallet-democracy/std", - "pallet-fast-unstake/std", "pallet-elections-phragmen/std", "frame-executive/std", "pallet-cere-ddc/std", @@ -199,7 +197,6 @@ runtime-benchmarks = [ "pallet-election-provider-multi-phase/runtime-benchmarks", "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-elections-phragmen/runtime-benchmarks", - "pallet-fast-unstake/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", @@ -207,11 +204,11 @@ runtime-benchmarks = [ "pallet-membership/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-nomination-pools/runtime-benchmarks", - "pallet-nomination-pools-benchmarking/runtime-benchmarks", - "pallet-offences-benchmarking/runtime-benchmarks", + "pallet-nomination-pools-benchmarking", + "pallet-offences-benchmarking", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", - "pallet-session-benchmarking/runtime-benchmarks", + "pallet-session-benchmarking", "pallet-society/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-ddc-staking/runtime-benchmarks", @@ -220,7 +217,7 @@ runtime-benchmarks = [ "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", + "frame-system-benchmarking", "hex-literal", ] try-runtime = [ @@ -239,7 +236,6 @@ try-runtime = [ "pallet-democracy/try-runtime", "pallet-election-provider-multi-phase/try-runtime", "pallet-elections-phragmen/try-runtime", - "pallet-fast-unstake/try-runtime", "pallet-grandpa/try-runtime", "pallet-identity/try-runtime", "pallet-im-online/try-runtime", diff --git a/runtime/cere-dev/constants/Cargo.toml b/runtime/cere-dev/constants/Cargo.toml index 68ca79a56..84ab98517 100644 --- a/runtime/cere-dev/constants/Cargo.toml +++ b/runtime/cere-dev/constants/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "cere-dev-runtime-constants" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" [dependencies] -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } [features] default = ["std"] diff --git a/runtime/cere-dev/src/impls.rs b/runtime/cere-dev/src/impls.rs index dd38a6a1d..d23489fb8 100644 --- a/runtime/cere-dev/src/impls.rs +++ b/runtime/cere-dev/src/impls.rs @@ -31,18 +31,18 @@ impl OnUnbalanced for Author { #[cfg(test)] mod multiplier_tests { - use crate::{ - AdjustmentVariable, MinimumMultiplier, Runtime, RuntimeBlockWeights as BlockWeights, - System, TargetBlockFullness, TransactionPayment, - }; - use cere_dev_runtime_constants::{currency::*, time::*}; - use frame_support::weights::{DispatchClass, Weight, WeightToFee as WeightToFeeT}; use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; use sp_runtime::{ assert_eq_error_rate, traits::{Convert, One, Zero}, FixedPointNumber, }; + use cere_dev_runtime_constants::{currency::*, time::*}; + use crate::{ + AdjustmentVariable, MinimumMultiplier, Runtime, RuntimeBlockWeights as BlockWeights, + System, TargetBlockFullness, TransactionPayment, + }; + use frame_support::weights::{DispatchClass, Weight, WeightToFee as WeightToFeeT}; fn max_normal() -> Weight { BlockWeights::get() @@ -197,8 +197,7 @@ mod multiplier_tests { // `cargo test congested_chain_simulation -- --nocapture` to get some insight. // almost full. The entire quota of normal transactions is taken. - let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() - - Weight::from_ref_time(100); + let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() - Weight::from_ref_time(100); // Default substrate weight. let tx_weight = frame_support::weights::constants::ExtrinsicBaseWeight::get(); diff --git a/runtime/cere-dev/src/lib.rs b/runtime/cere-dev/src/lib.rs index 439fcadb3..f3806856c 100644 --- a/runtime/cere-dev/src/lib.rs +++ b/runtime/cere-dev/src/lib.rs @@ -22,18 +22,17 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -use cere_runtime_common::{BalanceToU256, U256ToBalance}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_election_provider_support::{ - onchain, BalancingConfig, ExtendedBalance, SequentialPhragmen, VoteWeight, + onchain, ExtendedBalance, SequentialPhragmen, VoteWeight, BalancingConfig }; use frame_support::{ construct_runtime, pallet_prelude::Get, parameter_types, traits::{ - ConstU128, ConstU16, ConstU32, Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything, - Imbalance, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced, + ConstU16, ConstU32, Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything, Imbalance, + InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote, }, weights::{ @@ -75,7 +74,7 @@ use sp_runtime::{ SaturatedConversion, StaticLookup, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill, + ApplyExtrinsicResult, FixedU128, FixedPointNumber, Perbill, Percent, Permill, Perquintill, }; use sp_staking::EraIndex; use sp_std::prelude::*; @@ -83,6 +82,7 @@ use sp_std::prelude::*; use sp_version::NativeVersion; use sp_version::RuntimeVersion; use static_assertions::const_assert; +use cere_runtime_common::{BalanceToU256, U256ToBalance}; #[cfg(any(feature = "std", test))] pub use frame_system::Call as SystemCall; @@ -130,10 +130,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 48000, + spec_version: 47000, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 5, + transaction_version: 4, state_version: 0, }; @@ -209,8 +209,8 @@ impl frame_system::Config for Runtime { type BlockWeights = RuntimeBlockWeights; type BlockLength = RuntimeBlockLength; type DbWeight = RocksDbWeight; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; + type Origin = Origin; + type Call = Call; type Index = Index; type BlockNumber = BlockNumber; type Hash = Hash; @@ -218,7 +218,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = Indices; type Header = generic::Header; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type BlockHashCount = BlockHashCount; type Version = Version; type PalletInfo = PalletInfo; @@ -234,8 +234,8 @@ impl frame_system::Config for Runtime { impl pallet_randomness_collective_flip::Config for Runtime {} impl pallet_utility::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; type PalletsOrigin = OriginCaller; type WeightInfo = pallet_utility::weights::SubstrateWeight; } @@ -248,8 +248,8 @@ parameter_types! { } impl pallet_multisig::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; @@ -291,27 +291,25 @@ impl Default for ProxyType { Self::Any } } -impl InstanceFilter for ProxyType { - fn filter(&self, c: &RuntimeCall) -> bool { +impl InstanceFilter for ProxyType { + fn filter(&self, c: &Call) -> bool { match self { ProxyType::Any => true, ProxyType::NonTransfer => !matches!( c, - RuntimeCall::Balances(..) | - RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) | - RuntimeCall::Indices(pallet_indices::Call::transfer { .. }) | - RuntimeCall::NominationPools(..) + Call::Balances(..) | + Call::Vesting(pallet_vesting::Call::vested_transfer { .. }) | + Call::Indices(pallet_indices::Call::transfer { .. }) | + Call::NominationPools(..) ), ProxyType::Governance => matches!( c, - RuntimeCall::Democracy(..) | - RuntimeCall::Council(..) | - RuntimeCall::Society(..) | - RuntimeCall::TechnicalCommittee(..) | - RuntimeCall::Elections(..) | - RuntimeCall::Treasury(..) + Call::Democracy(..) | + Call::Council(..) | Call::Society(..) | + Call::TechnicalCommittee(..) | + Call::Elections(..) | Call::Treasury(..) ), - ProxyType::Staking => matches!(c, RuntimeCall::Staking(..)), + ProxyType::Staking => matches!(c, Call::Staking(..)), } } fn is_superset(&self, o: &Self) -> bool { @@ -326,8 +324,8 @@ impl InstanceFilter for ProxyType { } impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; type Currency = Balances; type ProxyType = ProxyType; type ProxyDepositBase = ProxyDepositBase; @@ -346,10 +344,10 @@ parameter_types! { } impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; + type Event = Event; + type Origin = Origin; type PalletsOrigin = OriginCaller; - type RuntimeCall = RuntimeCall; + type Call = Call; type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = ConstU32<50>; @@ -401,7 +399,7 @@ impl pallet_indices::Config for Runtime { type AccountIndex = AccountIndex; type Currency = Balances; type Deposit = IndexDeposit; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type WeightInfo = pallet_indices::weights::SubstrateWeight; } @@ -419,7 +417,7 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type Balance = Balance; type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; + type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = frame_system::Pallet; type WeightInfo = pallet_balances::weights::SubstrateWeight; @@ -434,7 +432,7 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type OnChargeTransaction = CurrencyAdapter; type OperationalFeeMultiplier = OperationalFeeMultiplier; type WeightToFee = IdentityFee; @@ -475,7 +473,7 @@ impl_opaque_keys! { } impl pallet_session::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_staking::StashOf; type ShouldEndSession = Babe; @@ -525,7 +523,7 @@ impl pallet_staking::Config for Runtime { type UnixTime = Timestamp; type CurrencyToVote = U128CurrencyToVote; type RewardRemainder = Treasury; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Slash = Treasury; // send the slashed funds to the treasury. type Reward = (); // rewards are minted from the void type SessionsPerEra = SessionsPerEra; @@ -544,22 +542,12 @@ impl pallet_staking::Config for Runtime { type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = onchain::UnboundedExecution; type VoterList = VoterList; - type TargetList = pallet_staking::UseValidatorsMap; type MaxUnlockingChunks = ConstU32<32>; - type HistoryDepth = frame_support::traits::ConstU32<84>; type OnStakerSlash = NominationPools; type WeightInfo = pallet_staking::weights::SubstrateWeight; type BenchmarkingConfig = StakingBenchmarkingConfig; } -impl pallet_fast_unstake::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ControlOrigin = frame_system::EnsureRoot; - type Deposit = ConstU128<{ DOLLARS }>; - type DepositCurrency = Balances; - type WeightInfo = (); -} - parameter_types! { // phase durations. 1/4 of the last session for each. pub const SignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; @@ -678,7 +666,7 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime { } impl pallet_election_provider_multi_phase::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type EstimateCallFee = TransactionPayment; type SignedPhase = SignedPhase; @@ -713,9 +701,8 @@ parameter_types! { pub const BagThresholds: &'static [u64] = &voter_bags::THRESHOLDS; } -type VoterBagsListInstance = pallet_bags_list::Instance1; -impl pallet_bags_list::Config for Runtime { - type RuntimeEvent = RuntimeEvent; +impl pallet_bags_list::Config for Runtime { + type Event = Event; type ScoreProvider = Staking; type WeightInfo = pallet_bags_list::weights::SubstrateWeight; type BagThresholds = BagThresholds; @@ -733,8 +720,8 @@ parameter_types! { } impl pallet_democracy::Config for Runtime { - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; + type Proposal = Call; + type Event = Event; type Currency = Balances; type EnactmentPeriod = EnactmentPeriod; type LaunchPeriod = LaunchPeriod; @@ -791,9 +778,9 @@ parameter_types! { type CouncilCollective = pallet_collective::Instance1; impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; + type Origin = Origin; + type Proposal = Call; + type Event = Event; type MotionDuration = CouncilMotionDuration; type MaxProposals = CouncilMaxProposals; type MaxMembers = CouncilMaxMembers; @@ -818,7 +805,7 @@ parameter_types! { const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); impl pallet_elections_phragmen::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type PalletId = ElectionsPhragmenPalletId; type Currency = Balances; type ChangeMembers = Council; @@ -847,9 +834,9 @@ parameter_types! { type TechnicalCollective = pallet_collective::Instance2; impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; + type Origin = Origin; + type Proposal = Call; + type Event = Event; type MotionDuration = TechnicalMotionDuration; type MaxProposals = TechnicalMaxProposals; type MaxMembers = TechnicalMaxMembers; @@ -862,7 +849,7 @@ type EnsureRootOrHalfCouncil = EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, >; impl pallet_membership::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type AddOrigin = EnsureRootOrHalfCouncil; type RemoveOrigin = EnsureRootOrHalfCouncil; type SwapOrigin = EnsureRootOrHalfCouncil; @@ -899,7 +886,7 @@ impl pallet_treasury::Config for Runtime { EnsureRoot, pallet_collective::EnsureProportionMoreThan, >; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type OnSlash = (); type ProposalBond = ProposalBond; type ProposalBondMinimum = ProposalBondMinimum; @@ -925,7 +912,7 @@ parameter_types! { } impl pallet_bounties::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type BountyDepositBase = BountyDepositBase; type BountyDepositPayoutDelay = BountyDepositPayoutDelay; type BountyUpdatePeriod = BountyUpdatePeriod; @@ -944,14 +931,14 @@ parameter_types! { } impl pallet_child_bounties::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type MaxActiveChildBountyCount = ConstU32<5>; type ChildBountyValueMinimum = ChildBountyValueMinimum; type WeightInfo = pallet_child_bounties::weights::SubstrateWeight; } impl pallet_tips::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type DataDepositPerByte = DataDepositPerByte; type MaximumReasonLength = MaximumReasonLength; type Tippers = Elections; @@ -979,8 +966,8 @@ impl pallet_contracts::Config for Runtime { type Time = Timestamp; type Randomness = RandomnessCollectiveFlip; type Currency = Balances; - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; /// The safest default is to allow no calls at all. /// /// Runtimes should whitelist dispatchables that are allowed to be called from contracts @@ -1000,12 +987,13 @@ impl pallet_contracts::Config for Runtime { type AddressGenerator = pallet_contracts::DefaultAddressGenerator; type ContractAccessWeight = pallet_contracts::DefaultContractAccessWeight; type MaxCodeLen = ConstU32<{ 128 * 1024 }>; + type RelaxedMaxCodeLen = ConstU32<{ 256 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; } impl pallet_sudo::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; } parameter_types! { @@ -1020,14 +1008,14 @@ parameter_types! { impl frame_system::offchain::CreateSignedTransaction for Runtime where - RuntimeCall: From, + Call: From, { fn create_transaction>( - call: RuntimeCall, + call: Call, public: ::Signer, account: AccountId, nonce: Index, - ) -> Option<(RuntimeCall, ::SignaturePayload)> { + ) -> Option<(Call, ::SignaturePayload)> { let tip = 0; // take the biggest period possible. let period = @@ -1067,15 +1055,15 @@ impl frame_system::offchain::SigningTypes for Runtime { impl frame_system::offchain::SendTransactionTypes for Runtime where - RuntimeCall: From, + Call: From, { type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = RuntimeCall; + type OverarchingCall = Call; } impl pallet_im_online::Config for Runtime { type AuthorityId = ImOnlineId; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type NextSessionRotation = Babe; type ValidatorSet = Historical; type ReportUnresponsiveness = Offences; @@ -1087,7 +1075,7 @@ impl pallet_im_online::Config for Runtime { } impl pallet_offences::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type IdentificationTuple = pallet_session::historical::IdentificationTuple; type OnOffenceHandler = Staking; } @@ -1097,7 +1085,8 @@ impl pallet_authority_discovery::Config for Runtime { } impl pallet_grandpa::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; + type Call = Call; type KeyOwnerProofSystem = Historical; @@ -1129,7 +1118,7 @@ parameter_types! { } impl pallet_identity::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type BasicDeposit = BasicDeposit; type FieldDeposit = FieldDeposit; @@ -1151,9 +1140,9 @@ parameter_types! { } impl pallet_recovery::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type WeightInfo = pallet_recovery::weights::SubstrateWeight; - type RuntimeCall = RuntimeCall; + type Call = Call; type Currency = Balances; type ConfigDepositBase = ConfigDepositBase; type FriendDepositFactor = FriendDepositFactor; @@ -1174,7 +1163,7 @@ parameter_types! { } impl pallet_society::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type PalletId = SocietyPalletId; type Currency = Balances; type Randomness = RandomnessCollectiveFlip; @@ -1197,7 +1186,7 @@ parameter_types! { } impl pallet_vesting::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; @@ -1219,7 +1208,7 @@ impl pallet_cere_ddc::Config for Runtime { type MinLength = MinDataLength; type MaxLength = MaxDataLength; // The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; + type Event = Event; } parameter_types! { @@ -1229,9 +1218,9 @@ parameter_types! { /// Configure the send data pallet impl pallet_chainbridge::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type AdminOrigin = frame_system::EnsureRoot; - type Proposal = RuntimeCall; + type Proposal = Call; type ChainId = ChainId; type ProposalLifetime = ProposalLifetime; } @@ -1245,12 +1234,12 @@ parameter_types! { } impl pallet_erc721::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Identifier = NFTTokenId; } impl pallet_erc20::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type BridgeOrigin = pallet_chainbridge::EnsureBridge; type Currency = pallet_balances::Pallet; type HashId = HashId; @@ -1269,7 +1258,7 @@ parameter_types! { } impl pallet_nomination_pools::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type CurrencyBalance = Balance; type RewardCounter = FixedU128; @@ -1312,8 +1301,8 @@ impl pallet_ddc_metrics_offchain_worker::Config for Runtime { type AuthorityId = pallet_ddc_metrics_offchain_worker::crypto::TestAuthId; - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; } parameter_types! { @@ -1330,7 +1319,7 @@ impl pallet_ddc_staking::Config for Runtime { type DefaultEdgeChillDelay = DefaultEdgeChillDelay; type DefaultStorageBondSize = DefaultStorageBondSize; type DefaultStorageChillDelay = DefaultStorageChillDelay; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type UnixTime = Timestamp; type WeightInfo = pallet_ddc_staking::weights::SubstrateWeight; } @@ -1377,10 +1366,9 @@ construct_runtime!( Multisig: pallet_multisig, Bounties: pallet_bounties, Tips: pallet_tips, - VoterList: pallet_bags_list::, + VoterList: pallet_bags_list, ChildBounties: pallet_child_bounties, NominationPools: pallet_nomination_pools, - FastUnstake: pallet_fast_unstake, CereDDCModule: pallet_cere_ddc::{Pallet, Call, Storage, Event}, ChainBridge: pallet_chainbridge::{Pallet, Call, Storage, Event}, Erc721: pallet_erc721::{Pallet, Call, Storage, Event}, @@ -1415,21 +1403,12 @@ pub type SignedExtra = ( frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, ); - -pub struct StakingMigrationV11OldPallet; -impl Get<&'static str> for StakingMigrationV11OldPallet { - fn get() -> &'static str { - "VoterList" - } -} - /// 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 = frame_executive::Executive< Runtime, @@ -1437,14 +1416,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - ( - pallet_staking::migrations::v11::MigrateToV11< - Runtime, - VoterList, - StakingMigrationV11OldPallet, - >, - pallet_staking::migrations::v12::MigrateToV12, - ), + (InitiateNominationPools, pallet_nomination_pools::migration::v3::MigrateToV3), >; #[cfg(feature = "runtime-benchmarks")] @@ -1466,7 +1438,6 @@ mod benches { [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] [pallet_election_provider_support_benchmarking, EPSBench::] [pallet_elections_phragmen, Elections] - [pallet_fast_unstake, FastUnstake] [pallet_grandpa, Grandpa] [pallet_identity, Identity] [pallet_im_online, ImOnline] @@ -1699,13 +1670,13 @@ impl_runtime_apis! { } } - impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi for Runtime { - fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo { + fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo { TransactionPayment::query_call_info(call, len) } - fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails { + fn query_call_fee_details(call: Call, len: u32) -> FeeDetails { TransactionPayment::query_call_fee_details(call, len) } } @@ -1846,7 +1817,7 @@ mod tests { fn validate_transaction_submitter_bounds() { fn is_submit_signed_transaction() where - T: CreateSignedTransaction, + T: CreateSignedTransaction, { } @@ -1866,11 +1837,11 @@ mod tests { #[test] fn call_size() { - let size = core::mem::size_of::(); + let size = core::mem::size_of::(); assert!( size <= 208, - "size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the - size of RuntimeCall. + "size of Call {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the + size of Call. If the limit is too strong, maybe consider increase the limit to 300.", size, ); diff --git a/runtime/cere/Cargo.toml b/runtime/cere/Cargo.toml index 30c080f8f..dc0e26fa4 100644 --- a/runtime/cere/Cargo.toml +++ b/runtime/cere/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cere-runtime" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" build = "build.rs" @@ -24,86 +24,85 @@ hex-literal = { version = "0.3.4", optional = true } log = { version = "0.4.16", default-features = false } # primitives -sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, version = "4.0.0-dev" } -sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +sp-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-consensus-babe = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-block-builder = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false, version = "4.0.0-dev" } +sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-std = { version = "4.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-io = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } # frame dependencies -frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-authorship = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", optional = true } -pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-fast-unstake = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.30" } -pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } -pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false } -pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30", default-features = false, optional = true } -pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +frame-election-provider-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +pallet-authority-discovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-authorship = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-babe = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-bags-list = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-child-bounties = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-collective = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-democracy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-election-provider-multi-phase = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-election-provider-support-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", optional = true } +pallet-elections-phragmen = { version = "5.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-im-online = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-indices = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-identity = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-membership = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-multisig = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.29" } +pallet-offences = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-offences-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false, optional = true } +pallet-proxy = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-recovery = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-session = { version = "4.0.0-dev", features = [ "historical" ], git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false } +pallet-session-benchmarking = { version = "4.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29", default-features = false, optional = true } +pallet-staking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-staking-reward-curve = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-scheduler = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-society = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-tips = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-treasury = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-utility = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-transaction-storage = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +pallet-vesting = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } cere-runtime-common = { path = "../common", default-features = false } cere-runtime-constants = { path = "./constants", default-features = false } -pallet-chainbridge = { version = "4.8.0", default-features = false, path = "../../pallets/chainbridge" } -pallet-cere-ddc = { version = "4.8.0", default-features = false, path = "../../pallets/ddc" } -pallet-erc721 = { version = "4.8.0", default-features = false, path = "../../pallets/erc721" } -pallet-erc20 = { version = "4.8.0", default-features = false, path = "../../pallets/erc20" } -pallet-ddc-metrics-offchain-worker = { version = "4.8.0", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } +pallet-chainbridge = { version = "4.7.0", default-features = false, path = "../../pallets/chainbridge" } +pallet-cere-ddc = { version = "4.7.0", default-features = false, path = "../../pallets/ddc" } +pallet-erc721 = { version = "4.7.0", default-features = false, path = "../../pallets/erc721" } +pallet-erc20 = { version = "4.7.0", default-features = false, path = "../../pallets/erc20" } +pallet-ddc-metrics-offchain-worker = { version = "4.7.0", default-features = false, path = "../../pallets/ddc-metrics-offchain-worker" } [build-dependencies] -substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } +substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } [features] default = ["std"] @@ -125,7 +124,6 @@ std = [ "pallet-contracts-primitives/std", "pallet-contracts-rpc-runtime-api/std", "pallet-democracy/std", - "pallet-fast-unstake/std", "pallet-elections-phragmen/std", "frame-executive/std", "pallet-cere-ddc/std", @@ -197,7 +195,6 @@ runtime-benchmarks = [ "pallet-election-provider-multi-phase/runtime-benchmarks", "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-elections-phragmen/runtime-benchmarks", - "pallet-fast-unstake/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", "pallet-identity/runtime-benchmarks", "pallet-im-online/runtime-benchmarks", @@ -205,11 +202,11 @@ runtime-benchmarks = [ "pallet-membership/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-nomination-pools/runtime-benchmarks", - "pallet-nomination-pools-benchmarking/runtime-benchmarks", - "pallet-offences-benchmarking/runtime-benchmarks", + "pallet-nomination-pools-benchmarking", + "pallet-offences-benchmarking", "pallet-proxy/runtime-benchmarks", "pallet-scheduler/runtime-benchmarks", - "pallet-session-benchmarking/runtime-benchmarks", + "pallet-session-benchmarking", "pallet-society/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", @@ -217,7 +214,7 @@ runtime-benchmarks = [ "pallet-treasury/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-vesting/runtime-benchmarks", - "frame-system-benchmarking/runtime-benchmarks", + "frame-system-benchmarking", "hex-literal", ] try-runtime = [ @@ -236,7 +233,6 @@ try-runtime = [ "pallet-democracy/try-runtime", "pallet-election-provider-multi-phase/try-runtime", "pallet-elections-phragmen/try-runtime", - "pallet-fast-unstake/try-runtime", "pallet-grandpa/try-runtime", "pallet-identity/try-runtime", "pallet-im-online/try-runtime", diff --git a/runtime/cere/constants/Cargo.toml b/runtime/cere/constants/Cargo.toml index cfbde8792..d43ceedc5 100644 --- a/runtime/cere/constants/Cargo.toml +++ b/runtime/cere/constants/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "cere-runtime-constants" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" [dependencies] -node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.30" } -sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } +node-primitives = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.29" } +sp-runtime = { version = "6.0.0", git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } [features] default = ["std"] diff --git a/runtime/cere/src/impls.rs b/runtime/cere/src/impls.rs index 9597162dc..9d2b654b0 100644 --- a/runtime/cere/src/impls.rs +++ b/runtime/cere/src/impls.rs @@ -31,18 +31,18 @@ impl OnUnbalanced for Author { #[cfg(test)] mod multiplier_tests { - use crate::{ - AdjustmentVariable, MinimumMultiplier, Runtime, RuntimeBlockWeights as BlockWeights, - System, TargetBlockFullness, TransactionPayment, - }; - use cere_runtime_constants::{currency::*, time::*}; - use frame_support::weights::{DispatchClass, Weight, WeightToFee as WeightToFeeT}; use pallet_transaction_payment::{Multiplier, TargetedFeeAdjustment}; use sp_runtime::{ assert_eq_error_rate, traits::{Convert, One, Zero}, FixedPointNumber, }; + use cere_runtime_constants::{currency::*, time::*}; + use crate::{ + AdjustmentVariable, MinimumMultiplier, Runtime, RuntimeBlockWeights as BlockWeights, + System, TargetBlockFullness, TransactionPayment, + }; + use frame_support::weights::{DispatchClass, Weight, WeightToFee as WeightToFeeT}; fn max_normal() -> Weight { BlockWeights::get() @@ -197,8 +197,7 @@ mod multiplier_tests { // `cargo test congested_chain_simulation -- --nocapture` to get some insight. // almost full. The entire quota of normal transactions is taken. - let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() - - Weight::from_ref_time(100); + let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() - Weight::from_ref_time(100); // Default substrate weight. let tx_weight = frame_support::weights::constants::ExtrinsicBaseWeight::get(); diff --git a/runtime/cere/src/lib.rs b/runtime/cere/src/lib.rs index 33150f46f..bdfe7eeff 100644 --- a/runtime/cere/src/lib.rs +++ b/runtime/cere/src/lib.rs @@ -22,18 +22,17 @@ // `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256. #![recursion_limit = "256"] -use cere_runtime_common::{BalanceToU256, U256ToBalance}; use codec::{Decode, Encode, MaxEncodedLen}; use frame_election_provider_support::{ - onchain, BalancingConfig, ExtendedBalance, SequentialPhragmen, VoteWeight, + onchain, ExtendedBalance, SequentialPhragmen, VoteWeight, BalancingConfig }; use frame_support::{ construct_runtime, pallet_prelude::Get, parameter_types, traits::{ - ConstU128, ConstU16, ConstU32, Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything, - Imbalance, InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced, + ConstU16, ConstU32, Currency, EitherOfDiverse, EqualPrivilegeOnly, Everything, Imbalance, + InstanceFilter, KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote, }, weights::{ @@ -74,13 +73,14 @@ use sp_runtime::{ SaturatedConversion, StaticLookup, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill, + ApplyExtrinsicResult, FixedU128, FixedPointNumber, Perbill, Percent, Permill, Perquintill, }; use sp_std::prelude::*; #[cfg(any(feature = "std", test))] use sp_version::NativeVersion; use sp_version::RuntimeVersion; use static_assertions::const_assert; +use cere_runtime_common::{BalanceToU256, U256ToBalance}; #[cfg(any(feature = "std", test))] pub use frame_system::Call as SystemCall; @@ -128,10 +128,10 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 48000, + spec_version: 47000, impl_version: 0, apis: RUNTIME_API_VERSIONS, - transaction_version: 5, + transaction_version: 4, state_version: 0, }; @@ -207,8 +207,8 @@ impl frame_system::Config for Runtime { type BlockWeights = RuntimeBlockWeights; type BlockLength = RuntimeBlockLength; type DbWeight = RocksDbWeight; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; + type Origin = Origin; + type Call = Call; type Index = Index; type BlockNumber = BlockNumber; type Hash = Hash; @@ -216,7 +216,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type Lookup = Indices; type Header = generic::Header; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type BlockHashCount = BlockHashCount; type Version = Version; type PalletInfo = PalletInfo; @@ -232,8 +232,8 @@ impl frame_system::Config for Runtime { impl pallet_randomness_collective_flip::Config for Runtime {} impl pallet_utility::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; type PalletsOrigin = OriginCaller; type WeightInfo = pallet_utility::weights::SubstrateWeight; } @@ -246,8 +246,8 @@ parameter_types! { } impl pallet_multisig::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; @@ -289,27 +289,25 @@ impl Default for ProxyType { Self::Any } } -impl InstanceFilter for ProxyType { - fn filter(&self, c: &RuntimeCall) -> bool { +impl InstanceFilter for ProxyType { + fn filter(&self, c: &Call) -> bool { match self { ProxyType::Any => true, ProxyType::NonTransfer => !matches!( c, - RuntimeCall::Balances(..) | - RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) | - RuntimeCall::Indices(pallet_indices::Call::transfer { .. }) | - RuntimeCall::NominationPools(..) + Call::Balances(..) | + Call::Vesting(pallet_vesting::Call::vested_transfer { .. }) | + Call::Indices(pallet_indices::Call::transfer { .. }) | + Call::NominationPools(..) ), ProxyType::Governance => matches!( c, - RuntimeCall::Democracy(..) | - RuntimeCall::Council(..) | - RuntimeCall::Society(..) | - RuntimeCall::TechnicalCommittee(..) | - RuntimeCall::Elections(..) | - RuntimeCall::Treasury(..) + Call::Democracy(..) | + Call::Council(..) | Call::Society(..) | + Call::TechnicalCommittee(..) | + Call::Elections(..) | Call::Treasury(..) ), - ProxyType::Staking => matches!(c, RuntimeCall::Staking(..)), + ProxyType::Staking => matches!(c, Call::Staking(..)), } } fn is_superset(&self, o: &Self) -> bool { @@ -324,8 +322,8 @@ impl InstanceFilter for ProxyType { } impl pallet_proxy::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; type Currency = Balances; type ProxyType = ProxyType; type ProxyDepositBase = ProxyDepositBase; @@ -344,10 +342,10 @@ parameter_types! { } impl pallet_scheduler::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; + type Event = Event; + type Origin = Origin; type PalletsOrigin = OriginCaller; - type RuntimeCall = RuntimeCall; + type Call = Call; type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = ConstU32<50>; @@ -399,7 +397,7 @@ impl pallet_indices::Config for Runtime { type AccountIndex = AccountIndex; type Currency = Balances; type Deposit = IndexDeposit; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type WeightInfo = pallet_indices::weights::SubstrateWeight; } @@ -417,7 +415,7 @@ impl pallet_balances::Config for Runtime { type ReserveIdentifier = [u8; 8]; type Balance = Balance; type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; + type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = frame_system::Pallet; type WeightInfo = pallet_balances::weights::SubstrateWeight; @@ -432,7 +430,7 @@ parameter_types! { } impl pallet_transaction_payment::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type OnChargeTransaction = CurrencyAdapter; type OperationalFeeMultiplier = OperationalFeeMultiplier; type WeightToFee = IdentityFee; @@ -473,7 +471,7 @@ impl_opaque_keys! { } impl pallet_session::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type ValidatorId = ::AccountId; type ValidatorIdOf = pallet_staking::StashOf; type ShouldEndSession = Babe; @@ -508,7 +506,6 @@ parameter_types! { pub const MaxNominatorRewardedPerValidator: u32 = 256; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); pub OffchainRepeat: BlockNumber = 5; - pub HistoryDepth: u32 = 84; } pub struct StakingBenchmarkingConfig; @@ -524,7 +521,7 @@ impl pallet_staking::Config for Runtime { type UnixTime = Timestamp; type CurrencyToVote = U128CurrencyToVote; type RewardRemainder = Treasury; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Slash = Treasury; // send the slashed funds to the treasury. type Reward = (); // rewards are minted from the void type SessionsPerEra = SessionsPerEra; @@ -543,22 +540,12 @@ impl pallet_staking::Config for Runtime { type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = onchain::UnboundedExecution; type VoterList = VoterList; - type TargetList = pallet_staking::UseValidatorsMap; type MaxUnlockingChunks = ConstU32<32>; - type HistoryDepth = HistoryDepth; type OnStakerSlash = NominationPools; type WeightInfo = pallet_staking::weights::SubstrateWeight; type BenchmarkingConfig = StakingBenchmarkingConfig; } -impl pallet_fast_unstake::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type ControlOrigin = frame_system::EnsureRoot; - type Deposit = ConstU128<{ DOLLARS }>; - type DepositCurrency = Balances; - type WeightInfo = (); -} - parameter_types! { // phase durations. 1/4 of the last session for each. pub const SignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; @@ -677,7 +664,7 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime { } impl pallet_election_provider_multi_phase::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type EstimateCallFee = TransactionPayment; type SignedPhase = SignedPhase; @@ -712,9 +699,8 @@ parameter_types! { pub const BagThresholds: &'static [u64] = &voter_bags::THRESHOLDS; } -type VoterBagsListInstance = pallet_bags_list::Instance1; -impl pallet_bags_list::Config for Runtime { - type RuntimeEvent = RuntimeEvent; +impl pallet_bags_list::Config for Runtime { + type Event = Event; type ScoreProvider = Staking; type WeightInfo = pallet_bags_list::weights::SubstrateWeight; type BagThresholds = BagThresholds; @@ -732,8 +718,8 @@ parameter_types! { } impl pallet_democracy::Config for Runtime { - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; + type Proposal = Call; + type Event = Event; type Currency = Balances; type EnactmentPeriod = EnactmentPeriod; type LaunchPeriod = LaunchPeriod; @@ -790,9 +776,9 @@ parameter_types! { type CouncilCollective = pallet_collective::Instance1; impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; + type Origin = Origin; + type Proposal = Call; + type Event = Event; type MotionDuration = CouncilMotionDuration; type MaxProposals = CouncilMaxProposals; type MaxMembers = CouncilMaxMembers; @@ -817,7 +803,7 @@ parameter_types! { const_assert!(DesiredMembers::get() <= CouncilMaxMembers::get()); impl pallet_elections_phragmen::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type PalletId = ElectionsPhragmenPalletId; type Currency = Balances; type ChangeMembers = Council; @@ -846,9 +832,9 @@ parameter_types! { type TechnicalCollective = pallet_collective::Instance2; impl pallet_collective::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; + type Origin = Origin; + type Proposal = Call; + type Event = Event; type MotionDuration = TechnicalMotionDuration; type MaxProposals = TechnicalMaxProposals; type MaxMembers = TechnicalMaxMembers; @@ -861,7 +847,7 @@ type EnsureRootOrHalfCouncil = EitherOfDiverse< pallet_collective::EnsureProportionMoreThan, >; impl pallet_membership::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type AddOrigin = EnsureRootOrHalfCouncil; type RemoveOrigin = EnsureRootOrHalfCouncil; type SwapOrigin = EnsureRootOrHalfCouncil; @@ -898,7 +884,7 @@ impl pallet_treasury::Config for Runtime { EnsureRoot, pallet_collective::EnsureProportionMoreThan, >; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type OnSlash = (); type ProposalBond = ProposalBond; type ProposalBondMinimum = ProposalBondMinimum; @@ -924,7 +910,7 @@ parameter_types! { } impl pallet_bounties::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type BountyDepositBase = BountyDepositBase; type BountyDepositPayoutDelay = BountyDepositPayoutDelay; type BountyUpdatePeriod = BountyUpdatePeriod; @@ -943,14 +929,14 @@ parameter_types! { } impl pallet_child_bounties::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type MaxActiveChildBountyCount = ConstU32<5>; type ChildBountyValueMinimum = ChildBountyValueMinimum; type WeightInfo = pallet_child_bounties::weights::SubstrateWeight; } impl pallet_tips::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type DataDepositPerByte = DataDepositPerByte; type MaximumReasonLength = MaximumReasonLength; type Tippers = Elections; @@ -978,8 +964,8 @@ impl pallet_contracts::Config for Runtime { type Time = Timestamp; type Randomness = RandomnessCollectiveFlip; type Currency = Balances; - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; /// The safest default is to allow no calls at all. /// /// Runtimes should whitelist dispatchables that are allowed to be called from contracts @@ -999,12 +985,13 @@ impl pallet_contracts::Config for Runtime { type AddressGenerator = pallet_contracts::DefaultAddressGenerator; type ContractAccessWeight = pallet_contracts::DefaultContractAccessWeight; type MaxCodeLen = ConstU32<{ 128 * 1024 }>; + type RelaxedMaxCodeLen = ConstU32<{ 256 * 1024 }>; type MaxStorageKeyLen = ConstU32<128>; } impl pallet_sudo::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; } parameter_types! { @@ -1019,14 +1006,14 @@ parameter_types! { impl frame_system::offchain::CreateSignedTransaction for Runtime where - RuntimeCall: From, + Call: From, { fn create_transaction>( - call: RuntimeCall, + call: Call, public: ::Signer, account: AccountId, nonce: Index, - ) -> Option<(RuntimeCall, ::SignaturePayload)> { + ) -> Option<(Call, ::SignaturePayload)> { let tip = 0; // take the biggest period possible. let period = @@ -1066,15 +1053,15 @@ impl frame_system::offchain::SigningTypes for Runtime { impl frame_system::offchain::SendTransactionTypes for Runtime where - RuntimeCall: From, + Call: From, { type Extrinsic = UncheckedExtrinsic; - type OverarchingCall = RuntimeCall; + type OverarchingCall = Call; } impl pallet_im_online::Config for Runtime { type AuthorityId = ImOnlineId; - type RuntimeEvent = RuntimeEvent; + type Event = Event; type NextSessionRotation = Babe; type ValidatorSet = Historical; type ReportUnresponsiveness = Offences; @@ -1086,7 +1073,7 @@ impl pallet_im_online::Config for Runtime { } impl pallet_offences::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type IdentificationTuple = pallet_session::historical::IdentificationTuple; type OnOffenceHandler = Staking; } @@ -1096,7 +1083,8 @@ impl pallet_authority_discovery::Config for Runtime { } impl pallet_grandpa::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; + type Call = Call; type KeyOwnerProofSystem = Historical; @@ -1128,7 +1116,7 @@ parameter_types! { } impl pallet_identity::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type BasicDeposit = BasicDeposit; type FieldDeposit = FieldDeposit; @@ -1150,9 +1138,9 @@ parameter_types! { } impl pallet_recovery::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type WeightInfo = pallet_recovery::weights::SubstrateWeight; - type RuntimeCall = RuntimeCall; + type Call = Call; type Currency = Balances; type ConfigDepositBase = ConfigDepositBase; type FriendDepositFactor = FriendDepositFactor; @@ -1173,7 +1161,7 @@ parameter_types! { } impl pallet_society::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type PalletId = SocietyPalletId; type Currency = Balances; type Randomness = RandomnessCollectiveFlip; @@ -1196,7 +1184,7 @@ parameter_types! { } impl pallet_vesting::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; @@ -1218,7 +1206,7 @@ impl pallet_cere_ddc::Config for Runtime { type MinLength = MinDataLength; type MaxLength = MaxDataLength; // The ubiquitous event type. - type RuntimeEvent = RuntimeEvent; + type Event = Event; } parameter_types! { @@ -1228,9 +1216,9 @@ parameter_types! { /// Configure the send data pallet impl pallet_chainbridge::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type AdminOrigin = frame_system::EnsureRoot; - type Proposal = RuntimeCall; + type Proposal = Call; type ChainId = ChainId; type ProposalLifetime = ProposalLifetime; } @@ -1244,12 +1232,12 @@ parameter_types! { } impl pallet_erc721::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Identifier = NFTTokenId; } impl pallet_erc20::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type BridgeOrigin = pallet_chainbridge::EnsureBridge; type Currency = pallet_balances::Pallet; type HashId = HashId; @@ -1268,7 +1256,7 @@ parameter_types! { } impl pallet_nomination_pools::Config for Runtime { - type RuntimeEvent = RuntimeEvent; + type Event = Event; type Currency = Balances; type CurrencyBalance = Balance; type RewardCounter = FixedU128; @@ -1311,8 +1299,8 @@ impl pallet_ddc_metrics_offchain_worker::Config for Runtime { type AuthorityId = pallet_ddc_metrics_offchain_worker::crypto::TestAuthId; - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; + type Event = Event; + type Call = Call; } construct_runtime!( @@ -1357,10 +1345,9 @@ construct_runtime!( Multisig: pallet_multisig, Bounties: pallet_bounties, Tips: pallet_tips, - VoterList: pallet_bags_list::, + VoterList: pallet_bags_list, ChildBounties: pallet_child_bounties, NominationPools: pallet_nomination_pools, - FastUnstake: pallet_fast_unstake, CereDDCModule: pallet_cere_ddc::{Pallet, Call, Storage, Event}, ChainBridge: pallet_chainbridge::{Pallet, Call, Storage, Event}, Erc721: pallet_erc721::{Pallet, Call, Storage, Event}, @@ -1394,21 +1381,12 @@ pub type SignedExtra = ( frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, ); - -pub struct StakingMigrationV11OldPallet; -impl Get<&'static str> for StakingMigrationV11OldPallet { - fn get() -> &'static str { - "VoterList" - } -} - /// 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 = frame_executive::Executive< Runtime, @@ -1416,14 +1394,7 @@ pub type Executive = frame_executive::Executive< frame_system::ChainContext, Runtime, AllPalletsWithSystem, - ( - pallet_staking::migrations::v11::MigrateToV11< - Runtime, - VoterList, - StakingMigrationV11OldPallet, - >, - pallet_staking::migrations::v12::MigrateToV12, - ), + (InitiateNominationPools, pallet_nomination_pools::migration::v3::MigrateToV3), >; #[cfg(feature = "runtime-benchmarks")] @@ -1445,7 +1416,6 @@ mod benches { [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] [pallet_election_provider_support_benchmarking, EPSBench::] [pallet_elections_phragmen, Elections] - [pallet_fast_unstake, FastUnstake] [pallet_grandpa, Grandpa] [pallet_identity, Identity] [pallet_im_online, ImOnline] @@ -1677,13 +1647,13 @@ impl_runtime_apis! { } } - impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi + impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi for Runtime { - fn query_call_info(call: RuntimeCall, len: u32) -> RuntimeDispatchInfo { + fn query_call_info(call: Call, len: u32) -> RuntimeDispatchInfo { TransactionPayment::query_call_info(call, len) } - fn query_call_fee_details(call: RuntimeCall, len: u32) -> FeeDetails { + fn query_call_fee_details(call: Call, len: u32) -> FeeDetails { TransactionPayment::query_call_fee_details(call, len) } } @@ -1824,7 +1794,7 @@ mod tests { fn validate_transaction_submitter_bounds() { fn is_submit_signed_transaction() where - T: CreateSignedTransaction, + T: CreateSignedTransaction, { } @@ -1844,11 +1814,11 @@ mod tests { #[test] fn call_size() { - let size = core::mem::size_of::(); + let size = core::mem::size_of::(); assert!( size <= 208, - "size of RuntimeCall {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the - size of RuntimeCall. + "size of Call {} is more than 208 bytes: some calls have too big arguments, use Box to reduce the + size of Call. If the limit is too strong, maybe consider increase the limit to 300.", size, ); diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 0871c1d68..4bb9ac00c 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cere-runtime-common" -version = "4.8.0" +version = "4.7.0" authors = ["Parity Technologies "] edition = "2021" @@ -10,7 +10,7 @@ no_std = [] std = [] [dependencies] -sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.30" } -frame-support = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } -sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } -node-primitives = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.30" } +sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.29" } +frame-support = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.29" } +sp-core = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.29" } +node-primitives = { git = "https://github.com/paritytech/substrate.git", default-features = false, branch = "polkadot-v0.9.29" } diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 03d133233..4a322d5e4 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -1,20 +1,20 @@ #![cfg_attr(not(feature = "std"), no_std)] -use node_primitives::Balance; +use node_primitives::{Balance}; /// Convert a balance to an unsigned 256-bit number, use in nomination pools. pub struct BalanceToU256; impl sp_runtime::traits::Convert for BalanceToU256 { - fn convert(n: Balance) -> sp_core::U256 { - n.into() - } + fn convert(n: Balance) -> sp_core::U256 { + n.into() + } } /// Convert an unsigned 256-bit number to balance, use in nomination pools. pub struct U256ToBalance; impl sp_runtime::traits::Convert for U256ToBalance { - fn convert(n: sp_core::U256) -> Balance { - use frame_support::traits::Defensive; - n.try_into().defensive_unwrap_or(Balance::MAX) - } + fn convert(n: sp_core::U256) -> Balance { + use frame_support::traits::Defensive; + n.try_into().defensive_unwrap_or(Balance::MAX) + } } diff --git a/scripts/init.sh b/scripts/init.sh index beca622b2..0d2354d27 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -7,5 +7,3 @@ echo "*** Initializing WASM build environment" rustup install nightly-2022-10-09 rustup target add wasm32-unknown-unknown --toolchain nightly-2022-10-09 - -ln -sf $PWD/scripts/pre-commit.sh $PWD/.git/hooks/pre-commit || true diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh deleted file mode 100755 index d84399d28..000000000 --- a/scripts/pre-commit.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Prevent committing badly formatted code -cargo +nightly fmt -- --check -if [ $? -ne 0 ]; then - echo "Run \`cargo +nightly fmt\` to fix formatting issues before committing." - exit 1 -fi