From 3a652827a127d0119b94a9a061172916bd7e4d79 Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Wed, 3 May 2023 21:51:03 +0200 Subject: [PATCH 1/6] merge from bridge-hub-rococo-wococo --- .github/workflows/docs.yml | 2 +- .github/workflows/fmt-check.yml | 24 +- ...e-20_extrinsic-ordering-check-from-bin.yml | 2 +- ...e-21_extrinsic-ordering-check-from-two.yml | 2 +- .github/workflows/release-30_create-draft.yml | 20 +- .github/workflows/srtool.yml | 6 +- .gitlab-ci.yml | 2 + Cargo.lock | 1224 ++++++++++------- README.md | 6 - bridges/bin/runtime-common/Cargo.toml | 2 +- bridges/bin/runtime-common/src/integrity.rs | 42 +- bridges/bin/runtime-common/src/lib.rs | 14 + bridges/bin/runtime-common/src/messages.rs | 22 +- .../runtime-common/src/messages_call_ext.rs | 10 + .../src/messages_xcm_extension.rs | 22 +- bridges/bin/runtime-common/src/mock.rs | 24 +- .../src/refund_relayer_extension.rs | 761 +++++++--- bridges/modules/grandpa/Cargo.toml | 2 +- bridges/modules/grandpa/src/lib.rs | 6 +- bridges/modules/grandpa/src/weights.rs | 2 +- bridges/modules/messages/Cargo.toml | 2 +- bridges/modules/messages/src/inbound_lane.rs | 90 +- bridges/modules/messages/src/lib.rs | 46 +- bridges/modules/messages/src/mock.rs | 13 +- bridges/modules/messages/src/outbound_lane.rs | 3 - bridges/modules/messages/src/weights.rs | 2 +- bridges/modules/messages/src/weights_ext.rs | 43 + bridges/modules/parachains/Cargo.toml | 2 +- bridges/modules/parachains/src/weights.rs | 2 +- bridges/modules/relayers/Cargo.toml | 2 +- bridges/modules/relayers/src/benchmarking.rs | 76 +- bridges/modules/relayers/src/lib.rs | 587 +++++++- bridges/modules/relayers/src/mock.rs | 54 +- bridges/modules/relayers/src/stake_adapter.rs | 186 +++ bridges/modules/relayers/src/weights.rs | 182 ++- bridges/modules/relayers/src/weights_ext.rs | 49 + bridges/primitives/header-chain/Cargo.toml | 2 +- bridges/primitives/messages/Cargo.toml | 2 +- bridges/primitives/messages/src/lib.rs | 15 + .../primitives/messages/src/target_chain.rs | 9 +- bridges/primitives/parachains/Cargo.toml | 2 +- bridges/primitives/polkadot-core/Cargo.toml | 2 +- bridges/primitives/relayers/Cargo.toml | 2 +- bridges/primitives/relayers/src/lib.rs | 4 + .../primitives/relayers/src/registration.rs | 121 ++ bridges/primitives/runtime/Cargo.toml | 2 +- bridges/scripts/verify-pallets-build.sh | 2 + client/cli/Cargo.toml | 2 +- client/consensus/common/src/level_monitor.rs | 81 +- client/consensus/common/src/tests.rs | 13 +- client/network/src/lib.rs | 6 +- client/pov-recovery/src/lib.rs | 37 +- .../src/collator_overseer.rs | 2 +- client/service/src/lib.rs | 10 +- pallets/aura-ext/Cargo.toml | 2 +- .../src/validate_block/implementation.rs | 2 +- parachain-template/node/src/service.rs | 4 +- parachain-template/runtime/src/xcm_config.rs | 18 +- parachains/chain-specs/bridge-hub-rococo.json | 12 +- parachains/chain-specs/bridge-hub-wococo.json | 12 +- parachains/common/src/xcm_config.rs | 13 +- parachains/pallets/parachain-info/Cargo.toml | 2 +- parachains/pallets/ping/Cargo.toml | 2 +- parachains/runtimes/assets/common/Cargo.toml | 2 +- .../runtimes/assets/common/src/runtime_api.rs | 5 + .../runtimes/assets/statemine/Cargo.toml | 2 +- .../runtimes/assets/statemine/src/lib.rs | 10 +- .../statemine/src/weights/pallet_xcm.rs | 9 + .../assets/statemine/src/xcm_config.rs | 2 +- .../runtimes/assets/statemine/tests/tests.rs | 20 +- .../runtimes/assets/statemint/Cargo.toml | 2 +- .../runtimes/assets/statemint/src/lib.rs | 4 +- .../statemint/src/weights/pallet_xcm.rs | 9 + .../assets/statemint/src/xcm_config.rs | 2 +- .../runtimes/assets/statemint/tests/tests.rs | 18 +- .../runtimes/assets/test-utils/Cargo.toml | 2 + .../runtimes/assets/test-utils/src/lib.rs | 27 +- .../assets/test-utils/src/test_cases.rs | 24 +- .../runtimes/assets/westmint/Cargo.toml | 2 +- .../runtimes/assets/westmint/src/lib.rs | 4 +- .../assets/westmint/src/weights/pallet_xcm.rs | 9 + .../assets/westmint/src/xcm_config.rs | 2 +- .../runtimes/assets/westmint/tests/tests.rs | 20 +- parachains/runtimes/bridge-hubs/README.md | 26 +- .../bridge-hubs/bridge-hub-kusama/Cargo.toml | 7 +- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 7 +- .../src/weights/pallet_xcm.rs | 9 + .../bridge-hub-kusama/src/xcm_config.rs | 13 +- .../bridge-hub-kusama/tests/tests.rs | 56 + .../bridge-hub-polkadot/Cargo.toml | 7 +- .../bridge-hub-polkadot/src/lib.rs | 11 +- .../src/weights/pallet_xcm.rs | 9 + .../bridge-hub-polkadot/src/xcm_config.rs | 24 +- .../bridge-hub-polkadot/tests/tests.rs | 56 + .../bridge-hubs/bridge-hub-rococo/Cargo.toml | 2 +- .../src/bridge_hub_rococo_config.rs | 10 +- .../src/bridge_hub_wococo_config.rs | 10 +- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 64 +- .../bridge-hub-rococo/src/weights/mod.rs | 22 + ...et_bridge_grandpa_bridge_rococo_grandpa.rs | 47 +- ...et_bridge_grandpa_bridge_wococo_grandpa.rs | 43 +- ...ith_bridge_hub_rococo_messages_instance.rs | 90 +- ...ith_bridge_hub_wococo_messages_instance.rs | 90 +- ...untime_bridge_parachain_rococo_instance.rs | 53 +- ...untime_bridge_parachain_wococo_instance.rs | 53 +- .../src/weights/pallet_bridge_relayers.rs | 72 + .../src/weights/pallet_xcm.rs | 9 + .../bridge-hub-rococo/src/xcm_config.rs | 20 +- .../bridge-hub-rococo/tests/tests.rs | 441 +++--- .../bridge-hubs/test-utils/Cargo.toml | 33 +- .../bridge-hubs/test-utils/src/lib.rs | 197 +-- .../bridge-hubs/test-utils/src/test_cases.rs | 491 +++++++ .../collectives-polkadot/Cargo.toml | 2 +- .../collectives-polkadot/src/lib.rs | 2 + .../src/weights/pallet_xcm.rs | 9 + .../collectives-polkadot/src/xcm_config.rs | 2 +- .../contracts/contracts-rococo/Cargo.toml | 2 +- .../contracts-rococo/src/contracts.rs | 2 + .../contracts-rococo/src/xcm_config.rs | 2 +- .../runtimes/starters/seedling/Cargo.toml | 2 +- parachains/runtimes/starters/shell/Cargo.toml | 2 +- parachains/runtimes/testing/penpal/Cargo.toml | 2 +- .../testing/rococo-parachain/Cargo.toml | 2 +- polkadot-parachain/Cargo.toml | 2 +- .../src/chain_spec/bridge_hubs.rs | 2 +- polkadot-parachain/src/service.rs | 12 +- primitives/core/Cargo.toml | 2 +- primitives/parachain-inherent/Cargo.toml | 2 +- scripts/bridges_rococo_wococo.sh | 11 +- scripts/ci/gitlab/pipeline/publish.yml | 8 +- .../Cargo.toml | 2 +- .../relay-validation-worker-provider/build.rs | 2 +- .../src/lib.rs | 2 +- test/runtime/Cargo.toml | 2 +- test/service/Cargo.toml | 2 +- test/service/src/lib.rs | 2 + 136 files changed, 4334 insertions(+), 1808 deletions(-) create mode 100644 bridges/modules/relayers/src/stake_adapter.rs create mode 100644 bridges/modules/relayers/src/weights_ext.rs create mode 100644 bridges/primitives/relayers/src/registration.rs create mode 100644 parachains/runtimes/bridge-hubs/bridge-hub-kusama/tests/tests.rs create mode 100644 parachains/runtimes/bridge-hubs/bridge-hub-polkadot/tests/tests.rs create mode 100644 parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 81b94b0722f..a5ad2bd555e 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -23,7 +23,7 @@ jobs: run: rustup show - name: Rust cache - uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0 + uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1 - name: Build rustdocs run: SKIP_WASM_BUILD=1 cargo doc --all --no-deps diff --git a/.github/workflows/fmt-check.yml b/.github/workflows/fmt-check.yml index cdde5c820cc..498e42527e3 100644 --- a/.github/workflows/fmt-check.yml +++ b/.github/workflows/fmt-check.yml @@ -13,28 +13,10 @@ jobs: matrix: os: ["ubuntu-latest"] runs-on: ${{ matrix.os }} + container: + image: paritytech/ci-linux:production steps: - - name: Install Rust nightly toolchain - uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f # v1.0.7 - with: - profile: minimal - toolchain: nightly - override: true - components: clippy, rustfmt - - - name: Cache Dependencies & Build Outputs - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-${{ matrix.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Cargo fmt - uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b # v1.0.3 - with: - command: fmt - args: --all -- --check + run: cargo +nightly fmt --all -- --check diff --git a/.github/workflows/release-20_extrinsic-ordering-check-from-bin.yml b/.github/workflows/release-20_extrinsic-ordering-check-from-bin.yml index 340f72420be..5a7d695ec98 100644 --- a/.github/workflows/release-20_extrinsic-ordering-check-from-bin.yml +++ b/.github/workflows/release-20_extrinsic-ordering-check-from-bin.yml @@ -79,7 +79,7 @@ jobs: continue-on-error: true - name: Save output as artifact - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: ${{ env.CHAIN }} path: | diff --git a/.github/workflows/release-21_extrinsic-ordering-check-from-two.yml b/.github/workflows/release-21_extrinsic-ordering-check-from-two.yml index 98b88de2ad4..7fde56ef1b2 100644 --- a/.github/workflows/release-21_extrinsic-ordering-check-from-two.yml +++ b/.github/workflows/release-21_extrinsic-ordering-check-from-two.yml @@ -108,7 +108,7 @@ jobs: cat output.txt - name: Save output as artifact - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: ${{ matrix.runtime }} path: | diff --git a/.github/workflows/release-30_create-draft.yml b/.github/workflows/release-30_create-draft.yml index e8ce688b71b..a3b39806eec 100644 --- a/.github/workflows/release-30_create-draft.yml +++ b/.github/workflows/release-30_create-draft.yml @@ -74,7 +74,7 @@ jobs: - name: Cache target dir if: ${{ github.event.inputs.release_type != 'client' }} - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11 + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: "${{ github.workspace }}/runtime/${{ matrix.runtime }}/target" key: srtool-target-${{ matrix.runtime }}-${{ github.sha }} @@ -85,7 +85,7 @@ jobs: - name: Build ${{ matrix.runtime }} runtime if: ${{ github.event.inputs.release_type != 'client' }} id: srtool_build - uses: chevdor/srtool-actions@v0.6.0 + uses: chevdor/srtool-actions@v0.7.0 with: image: paritytech/srtool chain: ${{ matrix.runtime }} @@ -99,14 +99,14 @@ jobs: - name: Upload ${{ matrix.runtime }} srtool json if: ${{ github.event.inputs.release_type != 'client' }} - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: ${{ matrix.runtime }}-srtool-json path: ${{ matrix.runtime }}-srtool-digest.json - name: Upload ${{ matrix.runtime }} runtime if: ${{ github.event.inputs.release_type != 'client' }} - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: ${{ matrix.runtime }}-runtime path: | @@ -126,12 +126,12 @@ jobs: path: cumulus ref: ${{ github.event.inputs.ref2 }} - - uses: ruby/setup-ruby@93287a1fa82c6ddbb6d8db978df4b0119cd8879f # v1.133.2 + - uses: ruby/setup-ruby@d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c # v1.148.0 with: ruby-version: 3.0.0 - name: Download srtool json output - uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0 + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - name: Prepare tooling run: | @@ -189,14 +189,14 @@ jobs: - name: Archive srtool json if: ${{ github.event.inputs.release_type != 'client' }} - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: srtool-json path: | **/*-srtool-digest.json - name: Archive context artifact - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: release-notes-context path: | @@ -251,9 +251,9 @@ jobs: ref: ${{ github.event.inputs.ref2 }} - name: Download artifacts - uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # v3.0.0 + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - - uses: ruby/setup-ruby@93287a1fa82c6ddbb6d8db978df4b0119cd8879f # v1.133.2 + - uses: ruby/setup-ruby@d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c # v1.148.0 with: ruby-version: 3.0.0 diff --git a/.github/workflows/srtool.yml b/.github/workflows/srtool.yml index 9b20be76611..3ac4ff8be55 100644 --- a/.github/workflows/srtool.yml +++ b/.github/workflows/srtool.yml @@ -60,7 +60,7 @@ jobs: - name: Srtool build id: srtool_build - uses: chevdor/srtool-actions@v0.6.0 + uses: chevdor/srtool-actions@v0.7.0 with: chain: ${{ matrix.runtime }} runtime_dir: parachains/runtimes/${{ matrix.category }}/${{ matrix.runtime }} @@ -74,7 +74,7 @@ jobs: # it takes a while to build the runtime, so let's save the artifact as soon as we have it - name: Archive Artifacts for ${{ matrix.runtime }} - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: ${{ matrix.runtime }}-runtime path: | @@ -112,7 +112,7 @@ jobs: tee ${{ matrix.runtime }}-diff.txt - name: Archive Subwasm results - uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 with: name: ${{ matrix.runtime }}-runtime path: | diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2e0f6330d70..7166ace649f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -30,6 +30,8 @@ variables: DOCKER_OS: "debian:stretch" ARCH: "x86_64" ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.43" + BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29" + BUILDAH_COMMAND: "buildah --storage-driver overlay2" .common-before-script: before_script: diff --git a/Cargo.lock b/Cargo.lock index 412ce26fa0d..26590b81925 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -184,6 +184,21 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e579a7752471abc2a8268df8b20005e3eadd975f585398f17efcfd8d4927371" +dependencies = [ + "anstyle 1.0.0", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + [[package]] name = "anstyle" version = "0.3.4" @@ -196,6 +211,34 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +[[package]] +name = "anstyle-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcd8291a340dd8ac70e18878bc4501dd7b4ff970cfa21c207d36ece51ea88fd" +dependencies = [ + "anstyle 1.0.0", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.69" @@ -346,6 +389,7 @@ name = "asset-test-utils" version = "1.0.0" dependencies = [ "assets-common", + "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", "cumulus-primitives-core", @@ -431,6 +475,17 @@ dependencies = [ "event-listener", ] +[[package]] +name = "async-recursion" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "async-trait" version = "0.1.68" @@ -535,7 +590,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "hash-db", "log", @@ -552,9 +607,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.60.1" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "062dddbc1ba4aca46de6338e2bf87771414c335f7b2f2036e8f3e9befebf88e6" +checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ "bitflags", "cexpr", @@ -567,6 +622,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", + "syn 1.0.109", ] [[package]] @@ -892,6 +948,7 @@ dependencies = [ name = "bridge-hub-kusama-runtime" version = "0.1.0" dependencies = [ + "bridge-hub-test-utils", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -917,7 +974,6 @@ dependencies = [ "pallet-collator-selection", "pallet-multisig", "pallet-session", - "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -955,6 +1011,7 @@ dependencies = [ name = "bridge-hub-polkadot-runtime" version = "0.1.0" dependencies = [ + "bridge-hub-test-utils", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -979,7 +1036,6 @@ dependencies = [ "pallet-collator-selection", "pallet-multisig", "pallet-session", - "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", @@ -1102,22 +1158,29 @@ dependencies = [ name = "bridge-hub-test-utils" version = "0.1.0" dependencies = [ + "asset-test-utils", "bp-header-chain", "bp-messages", "bp-polkadot-core", "bp-runtime", "bp-test-utils", + "bridge-runtime-common", + "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", - "cumulus-primitives-core", - "cumulus-primitives-parachain-inherent", - "cumulus-test-relay-sproof-builder", + "cumulus-pallet-xcmp-queue", "frame-support", "frame-system", + "log", + "pallet-balances", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-collator-selection", + "pallet-session", "pallet-xcm", "pallet-xcm-benchmarks", "parachain-info", - "parachains-common", - "polkadot-parachain", + "parity-scale-codec", + "sp-io", "sp-runtime", "xcm", "xcm-builder", @@ -1270,9 +1333,9 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", @@ -1468,9 +1531,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.14" +version = "4.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "906f7fe1da4185b7a282b2bc90172a496f9def1aca4545fe7526810741591e14" +checksum = "8a1f23fa97e1d1641371b51f35535cb26959b8e27ab50d167a8b996b5bada819" dependencies = [ "clap_builder", "clap_derive", @@ -1479,22 +1542,22 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.1.14" +version = "4.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351f9ad9688141ed83dfd8f5fb998a06225ef444b48ff4dc43de6d409b7fd10b" +checksum = "0fdc5d93c358224b4d6867ef1356d740de2303e9892edc06c5340daeccd96bab" dependencies = [ + "anstream", + "anstyle 1.0.0", "bitflags", "clap_lex 0.4.1", - "is-terminal", "strsim", - "termcolor", ] [[package]] name = "clap_derive" -version = "4.1.14" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81d7dc0031c3a59a04fc2ba395c8e2dd463cba1859275f065d225f6122221b45" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" dependencies = [ "heck", "proc-macro2", @@ -1628,6 +1691,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "comfy-table" version = "6.0.0" @@ -1805,18 +1874,18 @@ checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" [[package]] name = "cranelift-bforest" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7379abaacee0f14abf3204a7606118f0465785252169d186337bcb75030815a" +checksum = "2bc42ba2e232e5b20ff7dc299a812d53337dadce9a7e39a238e6a5cb82d2e57b" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9489fa336927df749631f1008007ced2871068544f40a202ce6d93fbf2366a7b" +checksum = "253531aca9b6f56103c9420369db3263e784df39aa1c90685a1f69cfbba0623e" dependencies = [ "arrayvec 0.7.2", "bumpalo", @@ -1835,33 +1904,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05bbb67da91ec721ed57cef2f7c5ef7728e1cd9bde9ffd3ef8601022e73e3239" +checksum = "72f2154365e2bff1b1b8537a7181591fdff50d8e27fa6e40d5c69c3bad0ca7c8" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418ecb2f36032f6665dc1a5e2060a143dbab41d83b784882e97710e890a7a16d" +checksum = "687e14e3f5775248930e0d5a84195abef8b829958e9794bf8d525104993612b4" [[package]] name = "cranelift-entity" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cf583f7b093f291005f9fb1323e2c37f6ee4c7909e39ce016b2e8360d461705" +checksum = "f42ea692c7b450ad18b8c9889661505d51c09ec4380cf1c2d278dbb2da22cae1" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b66bf9e916f57fbbd0f7703ec6286f4624866bf45000111627c70d272c8dda1" +checksum = "8483c2db6f45fe9ace984e5adc5d058102227e4c62e5aa2054e16b0275fd3a6e" dependencies = [ "cranelift-codegen", "log", @@ -1871,15 +1940,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "649782a39ce99798dd6b4029e2bb318a2fbeaade1b4fa25330763c10c65bc358" +checksum = "e9793158837678902446c411741d87b43f57dadfb944f2440db4287cda8cbd59" [[package]] name = "cranelift-native" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937e021e089c51f9749d09e7ad1c4f255c2f8686cb8c3df63a34b3ec9921bc41" +checksum = "72668c7755f2b880665cb422c8ad2d56db58a88b9bebfef0b73edc2277c13c49" dependencies = [ "cranelift-codegen", "libc", @@ -1888,9 +1957,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.93.1" +version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d850cf6775477747c9dfda9ae23355dd70512ffebc70cf82b85a5b111ae668b5" +checksum = "3852ce4b088b44ac4e29459573943009a70d1b192c8d77ef949b4e814f656fc1" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -2109,7 +2178,7 @@ dependencies = [ name = "cumulus-client-cli" version = "0.1.0" dependencies = [ - "clap 4.1.14", + "clap 4.2.5", "parity-scale-codec", "sc-chain-spec", "sc-cli", @@ -2712,7 +2781,7 @@ dependencies = [ name = "cumulus-test-relay-validation-worker-provider" version = "0.1.0" dependencies = [ - "polkadot-node-core-pvf", + "polkadot-node-core-pvf-worker", "toml 0.7.3", ] @@ -2752,7 +2821,7 @@ name = "cumulus-test-service" version = "0.1.0" dependencies = [ "async-trait", - "clap 4.1.14", + "clap 4.2.5", "criterion", "cumulus-client-cli", "cumulus-client-consensus-common", @@ -3331,22 +3400,22 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" +checksum = "c041f5090df68b32bcd905365fd51769c8b9d553fe87fde0b683534f10c01bd2" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.4" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" +checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -3427,7 +3496,7 @@ dependencies = [ [[package]] name = "ethabi-decode" version = "1.3.3" -source = "git+https://github.com/Snowfork/ethabi-decode.git?branch=master#6f63405bb33ef4365a1c62b72d499fa0f448118e" +source = "git+https://github.com/snowfork/ethabi-decode.git?rev=6f63405bb33ef4365a1c62b72d499fa0f448118e#6f63405bb33ef4365a1c62b72d499fa0f448118e" dependencies = [ "ethereum-types", "tiny-keccak 1.5.0", @@ -3435,11 +3504,11 @@ dependencies = [ [[package]] name = "ethabi-decode" -version = "1.3.3" -source = "git+https://github.com/snowfork/ethabi-decode.git?rev=6f63405bb33ef4365a1c62b72d499fa0f448118e#6f63405bb33ef4365a1c62b72d499fa0f448118e" +version = "1.4.0" +source = "git+https://github.com/Snowfork/ethabi-decode.git?branch=master#7d215837b626650bd9a076821e57ad488101301f" dependencies = [ "ethereum-types", - "tiny-keccak 1.5.0", + "tiny-keccak 2.0.2", ] [[package]] @@ -3510,7 +3579,6 @@ dependencies = [ "fs-err", "proc-macro2", "quote", - "syn 1.0.109", ] [[package]] @@ -3526,6 +3594,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "expander" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f86a749cf851891866c10515ef6c299b5c69661465e9c3bbe7e07a2b77fb0f7" +dependencies = [ + "blake2", + "fs-err", + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -3694,7 +3775,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", ] @@ -3717,7 +3798,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-support-procedural", @@ -3742,12 +3823,12 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "Inflector", "array-bytes 4.2.0", "chrono", - "clap 4.1.14", + "clap 4.2.5", "comfy-table", "frame-benchmarking", "frame-support", @@ -3789,18 +3870,18 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3817,7 +3898,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -3846,9 +3927,11 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ + "async-recursion", "futures", + "jsonrpsee", "log", "parity-scale-codec", "serde", @@ -3862,7 +3945,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "bitflags", "environmental", @@ -3895,7 +3978,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "Inflector", "cfg-expr", @@ -3905,35 +3988,35 @@ dependencies = [ "proc-macro-warning", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "log", @@ -3951,7 +4034,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -3966,7 +4049,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "sp-api", @@ -3975,7 +4058,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "parity-scale-codec", @@ -4286,9 +4369,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.9" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f072413d126e57991455e0a922b31e4c8ba7c2ffbebf6b78b4f8521397d65cd" +checksum = "66b91535aa35fea1523ad1b86cb6b53c28e0ae566ba4a460f4457e936cad7c6f" dependencies = [ "bytes", "fnv", @@ -4299,7 +4382,7 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.6.9", + "tokio-util", "tracing", ] @@ -4380,6 +4463,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.4.3" @@ -4560,6 +4649,7 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls", + "webpki-roots", ] [[package]] @@ -4758,14 +4848,14 @@ checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" [[package]] name = "is-terminal" -version = "0.4.1" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.1", "io-lifetimes 1.0.2", - "rustix 0.36.7", - "windows-sys 0.42.0", + "rustix 0.37.3", + "windows-sys 0.48.0", ] [[package]] @@ -4814,6 +4904,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" dependencies = [ "jsonrpsee-core", + "jsonrpsee-http-client", "jsonrpsee-proc-macros", "jsonrpsee-server", "jsonrpsee-types", @@ -4837,7 +4928,7 @@ dependencies = [ "thiserror", "tokio", "tokio-rustls", - "tokio-util 0.7.1", + "tokio-util", "tracing", "webpki-roots", ] @@ -4870,6 +4961,25 @@ dependencies = [ "tracing", ] +[[package]] +name = "jsonrpsee-http-client" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +dependencies = [ + "async-trait", + "hyper", + "hyper-rustls", + "jsonrpsee-core", + "jsonrpsee-types", + "rustc-hash", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + [[package]] name = "jsonrpsee-proc-macros" version = "0.16.2" @@ -4900,7 +5010,7 @@ dependencies = [ "soketto", "tokio", "tokio-stream", - "tokio-util 0.7.1", + "tokio-util", "tower", "tracing", ] @@ -4952,8 +5062,8 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kusama-runtime" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "frame-benchmarking", @@ -4964,7 +5074,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.3.4", + "hex-literal 0.4.1", "kusama-runtime-constants", "log", "pallet-authority-discovery", @@ -5050,8 +5160,8 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-support", "polkadot-primitives", @@ -5083,9 +5193,9 @@ dependencies = [ [[package]] name = "kvdb-rocksdb" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2182b8219fee6bd83aacaab7344e840179ae079d5216aa4e249b4d704646a844" +checksum = "fe7a749456510c45f795e8b04a6a3e0976d0139213ecbf465843830ad55e2217" dependencies = [ "kvdb", "num_cpus", @@ -5504,7 +5614,7 @@ dependencies = [ "thiserror", "tinytemplate", "tokio", - "tokio-util 0.7.1", + "tokio-util", "webrtc", ] @@ -5543,9 +5653,9 @@ dependencies = [ [[package]] name = "librocksdb-sys" -version = "0.8.0+7.4.4" +version = "0.10.0+7.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611804e4666a25136fcc5f8cf425ab4d26c7f74ea245ffe92ea23b85b6420b5d" +checksum = "0fe4d5874f5ff2bc616e55e8c6086d478fcda13faf9495768a4aa1c22042d30b" dependencies = [ "bindgen", "bzip2-sys", @@ -5917,7 +6027,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "log", @@ -5936,7 +6046,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "anyhow", "jsonrpsee", @@ -6435,7 +6545,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -6456,7 +6566,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "frame-benchmarking", "frame-support", @@ -6474,7 +6584,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "frame-benchmarking", "frame-support", @@ -6489,7 +6599,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "frame-support", "frame-system", @@ -6505,7 +6615,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -6521,7 +6631,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -6535,7 +6645,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6548,7 +6658,7 @@ dependencies = [ "scale-info", "sp-application-crypto", "sp-consensus-babe", - "sp-consensus-vrf", + "sp-core", "sp-io", "sp-runtime", "sp-session", @@ -6559,7 +6669,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6579,7 +6689,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6594,7 +6704,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -6613,7 +6723,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -6637,7 +6747,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6743,7 +6853,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6787,7 +6897,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6804,7 +6914,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "bitflags", "environmental", @@ -6834,7 +6944,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "bitflags", "parity-scale-codec", @@ -6847,17 +6957,17 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6874,7 +6984,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6892,7 +7002,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6915,7 +7025,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6928,7 +7038,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6946,7 +7056,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6964,7 +7074,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6987,7 +7097,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7003,7 +7113,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7023,7 +7133,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7040,7 +7150,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "frame-support", "frame-system", @@ -7054,7 +7164,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7071,7 +7181,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7088,7 +7198,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7104,7 +7214,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7122,7 +7232,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "frame-support", "pallet-nfts", @@ -7133,7 +7243,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7149,7 +7259,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -7166,7 +7276,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7186,7 +7296,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -7197,7 +7307,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -7214,7 +7324,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7238,7 +7348,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7255,7 +7365,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7270,7 +7380,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7288,7 +7398,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7303,7 +7413,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7322,7 +7432,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7339,7 +7449,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -7360,7 +7470,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7376,7 +7486,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -7390,7 +7500,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7413,18 +7523,18 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "log", "sp-arithmetic", @@ -7433,7 +7543,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "sp-api", @@ -7442,7 +7552,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7459,7 +7569,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -7488,7 +7598,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7506,7 +7616,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7525,7 +7635,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -7541,7 +7651,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7557,7 +7667,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7569,7 +7679,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7586,7 +7696,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "frame-benchmarking", "frame-support", @@ -7601,7 +7711,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7617,7 +7727,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7632,7 +7742,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -7646,8 +7756,8 @@ dependencies = [ [[package]] name = "pallet-xcm" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -7667,8 +7777,8 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7699,7 +7809,7 @@ dependencies = [ name = "parachain-template-node" version = "0.1.0" dependencies = [ - "clap 4.1.14", + "clap 4.2.5", "color-print", "cumulus-client-cli", "cumulus-client-consensus-aura", @@ -7981,9 +8091,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.6" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0744126afe1a6dd7f394cb50a716dbe086cb06e255e53d8d0185d82828358fb5" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "pbkdf2" @@ -8251,8 +8361,8 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "polkadot-node-jaeger", @@ -8267,8 +8377,8 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -8281,8 +8391,8 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "derive_more", "fatality", @@ -8304,8 +8414,8 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "fatality", "futures", @@ -8325,15 +8435,15 @@ dependencies = [ [[package]] name = "polkadot-cli" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ - "clap 4.1.14", + "clap 4.2.5", "frame-benchmarking-cli", "futures", "log", "polkadot-client", - "polkadot-node-core-pvf", + "polkadot-node-core-pvf-worker", "polkadot-node-metrics", "polkadot-performance-test", "polkadot-service", @@ -8346,6 +8456,7 @@ dependencies = [ "sp-core", "sp-io", "sp-keyring", + "sp-maybe-compressed-blob", "substrate-build-script-utils", "thiserror", "try-runtime-cli", @@ -8353,8 +8464,8 @@ dependencies = [ [[package]] name = "polkadot-client" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "frame-benchmarking", @@ -8396,8 +8507,8 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "always-assert", "bitvec", @@ -8418,8 +8529,8 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "parity-scale-codec", "scale-info", @@ -8430,8 +8541,8 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "derive_more", "fatality", @@ -8455,8 +8566,8 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8469,8 +8580,8 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "futures-timer", @@ -8489,8 +8600,8 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "always-assert", "async-trait", @@ -8512,8 +8623,8 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "parity-scale-codec", @@ -8530,8 +8641,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "derive_more", @@ -8559,8 +8670,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "futures", @@ -8580,8 +8691,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "fatality", @@ -8599,8 +8710,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8614,8 +8725,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "futures", @@ -8634,8 +8745,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "polkadot-node-metrics", @@ -8649,8 +8760,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "futures-timer", @@ -8666,8 +8777,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "fatality", "futures", @@ -8685,8 +8796,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "futures", @@ -8702,8 +8813,8 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "fatality", @@ -8720,12 +8831,10 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "always-assert", - "assert_matches", - "cpu-time", "futures", "futures-timer", "libc", @@ -8737,28 +8846,20 @@ dependencies = [ "polkadot-parachain", "polkadot-primitives", "rand 0.8.5", - "rayon", - "sc-executor", - "sc-executor-common", - "sc-executor-wasmtime", "slotmap", "sp-core", - "sp-externalities", - "sp-io", "sp-maybe-compressed-blob", "sp-tracing", "sp-wasm-interface", "substrate-build-script-utils", - "tempfile", - "tikv-jemalloc-ctl", "tokio", "tracing-gum", ] [[package]] name = "polkadot-node-core-pvf-checker" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "polkadot-node-primitives", @@ -8771,10 +8872,39 @@ dependencies = [ "tracing-gum", ] +[[package]] +name = "polkadot-node-core-pvf-worker" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" +dependencies = [ + "assert_matches", + "cpu-time", + "futures", + "libc", + "parity-scale-codec", + "polkadot-node-core-pvf", + "polkadot-parachain", + "polkadot-primitives", + "rayon", + "sc-executor", + "sc-executor-common", + "sc-executor-wasmtime", + "sp-core", + "sp-externalities", + "sp-io", + "sp-maybe-compressed-blob", + "sp-tracing", + "substrate-build-script-utils", + "tempfile", + "tikv-jemalloc-ctl", + "tokio", + "tracing-gum", +] + [[package]] name = "polkadot-node-core-runtime-api" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "futures", "lru 0.9.0", @@ -8788,8 +8918,8 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "lazy_static", "log", @@ -8806,8 +8936,8 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bs58", "futures", @@ -8825,8 +8955,8 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "derive_more", @@ -8847,8 +8977,8 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bounded-vec", "futures", @@ -8859,19 +8989,18 @@ dependencies = [ "serde", "sp-application-crypto", "sp-consensus-babe", - "sp-consensus-vrf", "sp-core", "sp-keystore", "sp-maybe-compressed-blob", "sp-runtime", "thiserror", - "zstd", + "zstd 0.11.2+zstd.1.5.2", ] [[package]] name = "polkadot-node-subsystem" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8880,8 +9009,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "futures", @@ -8898,8 +9027,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "derive_more", @@ -8921,8 +9050,8 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "derive_more", @@ -8954,8 +9083,8 @@ dependencies = [ [[package]] name = "polkadot-overseer" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "futures", @@ -8977,8 +9106,8 @@ dependencies = [ [[package]] name = "polkadot-parachain" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bounded-collections", "derive_more", @@ -9001,7 +9130,7 @@ dependencies = [ "bridge-hub-kusama-runtime", "bridge-hub-polkadot-runtime", "bridge-hub-rococo-runtime", - "clap 4.1.14", + "clap 4.2.5", "collectives-polkadot-runtime", "color-print", "contracts-rococo-runtime", @@ -9076,27 +9205,29 @@ dependencies = [ [[package]] name = "polkadot-performance-test" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "env_logger 0.9.0", "kusama-runtime", "log", "polkadot-erasure-coding", - "polkadot-node-core-pvf", + "polkadot-node-core-pvf-worker", "polkadot-node-primitives", "polkadot-primitives", "quote", + "sc-executor-common", + "sp-maybe-compressed-blob", "thiserror", ] [[package]] name = "polkadot-primitives" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", - "hex-literal 0.3.4", + "hex-literal 0.4.1", "parity-scale-codec", "polkadot-core-primitives", "polkadot-parachain", @@ -9118,8 +9249,8 @@ dependencies = [ [[package]] name = "polkadot-rpc" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -9150,8 +9281,8 @@ dependencies = [ [[package]] name = "polkadot-runtime" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "frame-benchmarking", @@ -9162,7 +9293,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.3.4", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -9244,8 +9375,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "frame-benchmarking", @@ -9290,8 +9421,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-support", "polkadot-primitives", @@ -9304,8 +9435,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bs58", "parity-scale-codec", @@ -9316,8 +9447,8 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitflags", "bitvec", @@ -9360,15 +9491,15 @@ dependencies = [ [[package]] name = "polkadot-service" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "async-trait", "frame-benchmarking-cli", "frame-support", "frame-system-rpc-runtime-api", "futures", - "hex-literal 0.3.4", + "hex-literal 0.4.1", "kusama-runtime", "kvdb", "kvdb-rocksdb", @@ -9470,8 +9601,8 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -9491,8 +9622,8 @@ dependencies = [ [[package]] name = "polkadot-statement-table" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9501,8 +9632,8 @@ dependencies = [ [[package]] name = "polkadot-test-client" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -9526,8 +9657,8 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "frame-election-provider-support", @@ -9587,8 +9718,8 @@ dependencies = [ [[package]] name = "polkadot-test-service" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-benchmarking", "frame-system", @@ -9808,13 +9939,13 @@ dependencies = [ [[package]] name = "proc-macro-warning" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4f284d87b9cedc2ff57223cbc4e3937cd6063c01e92c8e2a8c080df0013933" +checksum = "0e99670bafb56b9a106419397343bdbc8b8742c3cc449fec6345f86173f47cd4" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -10296,9 +10427,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.19.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9562ea1d70c0cc63a34a22d977753b50cca91cc6b6527750463bd5dd8697bc" +checksum = "015439787fce1e75d55f279078d33ff14b4af5d93d995e8838ee4631301c8a99" dependencies = [ "libc", "librocksdb-sys", @@ -10354,8 +10485,8 @@ dependencies = [ [[package]] name = "rococo-runtime" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -10365,7 +10496,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.3.4", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -10440,8 +10571,8 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-support", "polkadot-primitives", @@ -10688,7 +10819,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "log", "sp-core", @@ -10699,7 +10830,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures", @@ -10727,7 +10858,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "futures-timer", @@ -10750,7 +10881,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10765,7 +10896,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10784,22 +10915,22 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "chrono", - "clap 4.1.14", + "clap 4.2.5", "fdlimit", "futures", "libp2p", @@ -10835,7 +10966,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "fnv", "futures", @@ -10861,7 +10992,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "hash-db", "kvdb", @@ -10887,7 +11018,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures", @@ -10912,7 +11043,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "async-trait", "futures", @@ -10941,13 +11072,12 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "fork-tree", "futures", "log", - "merlin", "num-bigint", "num-rational", "num-traits", @@ -10960,7 +11090,6 @@ dependencies = [ "sc-keystore", "sc-telemetry", "scale-info", - "schnorrkel", "sp-api", "sp-application-crypto", "sp-block-builder", @@ -10968,7 +11097,6 @@ dependencies = [ "sp-consensus", "sp-consensus-babe", "sp-consensus-slots", - "sp-consensus-vrf", "sp-core", "sp-inherents", "sp-keystore", @@ -10980,7 +11108,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "jsonrpsee", @@ -11002,7 +11130,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11037,7 +11165,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "jsonrpsee", @@ -11056,7 +11184,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "fork-tree", "parity-scale-codec", @@ -11069,7 +11197,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "ahash 0.8.2", "array-bytes 4.2.0", @@ -11109,7 +11237,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "finality-grandpa", "futures", @@ -11129,7 +11257,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures", @@ -11152,7 +11280,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -11176,7 +11304,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -11189,7 +11317,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "log", "sc-allocator", @@ -11202,7 +11330,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "anyhow", "cfg-if", @@ -11220,7 +11348,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "ansi_term", "futures", @@ -11236,7 +11364,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11251,7 +11379,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -11296,7 +11424,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "cid", "futures", @@ -11316,7 +11444,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11344,7 +11472,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "ahash 0.8.2", "futures", @@ -11363,7 +11491,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11385,7 +11513,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11419,7 +11547,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11439,7 +11567,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11470,7 +11598,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "libp2p", @@ -11483,7 +11611,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11492,7 +11620,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "jsonrpsee", @@ -11522,7 +11650,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11541,7 +11669,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "http", "jsonrpsee", @@ -11556,7 +11684,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11582,7 +11710,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "directories", @@ -11648,7 +11776,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "log", "parity-scale-codec", @@ -11659,9 +11787,9 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ - "clap 4.1.14", + "clap 4.2.5", "fs4", "futures", "log", @@ -11675,7 +11803,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11694,7 +11822,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "libc", @@ -11713,7 +11841,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "chrono", "futures", @@ -11732,7 +11860,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "ansi_term", "atty", @@ -11763,18 +11891,18 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures", @@ -11801,7 +11929,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures", @@ -11815,7 +11943,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-channel", "futures", @@ -11829,9 +11957,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cfdffd972d76b22f3d7f81c8be34b2296afd3a25e0a547bd9abe340a4dbbe97" +checksum = "dfdef77228a4c05dc94211441595746732131ad7f6530c6c18f045da7b7ab937" dependencies = [ "bitvec", "cfg-if", @@ -11843,9 +11971,9 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fa974aea2d63dd18a4ec3a49d59af9f34178c73a4f56d2f18205628d00681e" +checksum = "53012eae69e5aa5c14671942a5dd47de59d4cdcff8532a6dd0e081faf1119482" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -12304,8 +12432,8 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "enumn", "parity-scale-codec", @@ -12356,6 +12484,7 @@ dependencies = [ name = "snowbridge-beacon-primitives" version = "0.0.1" dependencies = [ + "byte-slice-cast", "frame-support", "frame-system", "hex", @@ -12368,6 +12497,9 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "ssz-rs", + "ssz-rs-derive", + "static_assertions", ] [[package]] @@ -12389,7 +12521,7 @@ dependencies = [ name = "snowbridge-ethereum" version = "0.1.0" dependencies = [ - "ethabi-decode 1.3.3 (git+https://github.com/snowfork/ethabi-decode.git?rev=6f63405bb33ef4365a1c62b72d499fa0f448118e)", + "ethabi-decode 1.3.3", "ethbloom", "ethereum-types", "hex-literal 0.4.1", @@ -12424,18 +12556,18 @@ dependencies = [ "snowbridge-core", "snowbridge-ethereum", "sp-core", - "sp-io", "sp-runtime", "sp-std", "ssz-rs", "ssz-rs-derive", + "static_assertions", ] [[package]] name = "snowbridge-inbound-queue" version = "0.1.1" dependencies = [ - "ethabi-decode 1.3.3 (git+https://github.com/Snowfork/ethabi-decode.git?branch=master)", + "ethabi-decode 1.4.0", "frame-benchmarking", "frame-support", "frame-system", @@ -12460,7 +12592,7 @@ dependencies = [ name = "snowbridge-outbound-queue" version = "0.1.1" dependencies = [ - "ethabi-decode 1.3.3 (git+https://github.com/Snowfork/ethabi-decode.git?branch=master)", + "ethabi-decode 1.4.0", "frame-benchmarking", "frame-support", "frame-system", @@ -12545,7 +12677,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "hash-db", "log", @@ -12565,7 +12697,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "Inflector", "blake2", @@ -12573,13 +12705,13 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "scale-info", @@ -12592,7 +12724,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "integer-sqrt", "num-traits", @@ -12606,7 +12738,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "scale-info", @@ -12619,7 +12751,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "sp-api", @@ -12631,7 +12763,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "log", @@ -12649,7 +12781,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures", @@ -12664,7 +12796,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "parity-scale-codec", @@ -12682,10 +12814,9 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", - "merlin", "parity-scale-codec", "scale-info", "serde", @@ -12693,7 +12824,6 @@ dependencies = [ "sp-application-crypto", "sp-consensus", "sp-consensus-slots", - "sp-consensus-vrf", "sp-core", "sp-inherents", "sp-keystore", @@ -12705,7 +12835,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "lazy_static", "parity-scale-codec", @@ -12724,7 +12854,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "finality-grandpa", "log", @@ -12742,7 +12872,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "scale-info", @@ -12751,23 +12881,10 @@ dependencies = [ "sp-timestamp", ] -[[package]] -name = "sp-consensus-vrf" -version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" -dependencies = [ - "parity-scale-codec", - "scale-info", - "schnorrkel", - "sp-core", - "sp-runtime", - "sp-std", -] - [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -12786,6 +12903,7 @@ dependencies = [ "merlin", "parity-scale-codec", "parking_lot 0.12.1", + "paste", "primitive-types", "rand 0.8.5", "regex", @@ -12810,7 +12928,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "blake2b_simd", "byteorder", @@ -12824,18 +12942,18 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro2", "quote", "sp-core-hashing", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12844,17 +12962,17 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "environmental", "parity-scale-codec", @@ -12865,7 +12983,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12880,7 +12998,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "bytes", "ed25519", @@ -12906,7 +13024,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "lazy_static", "sp-core", @@ -12917,13 +13035,11 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", - "merlin", "parity-scale-codec", "parking_lot 0.12.1", - "schnorrkel", "serde", "sp-core", "sp-externalities", @@ -12933,16 +13049,16 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "thiserror", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -12953,7 +13069,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -12971,7 +13087,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "scale-info", @@ -12985,7 +13101,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "sp-api", "sp-core", @@ -12995,7 +13111,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "backtrace", "lazy_static", @@ -13005,7 +13121,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "rustc-hash", "serde", @@ -13015,7 +13131,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "either", "hash256-std-hasher", @@ -13037,7 +13153,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -13055,19 +13171,19 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "serde", "serde_json", @@ -13076,7 +13192,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "scale-info", @@ -13090,10 +13206,11 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "scale-info", + "serde", "sp-core", "sp-runtime", "sp-std", @@ -13102,7 +13219,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "hash-db", "log", @@ -13122,12 +13239,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13140,7 +13257,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures-timer", @@ -13155,7 +13272,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "sp-std", @@ -13167,7 +13284,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "sp-api", "sp-runtime", @@ -13176,7 +13293,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "log", @@ -13192,7 +13309,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "ahash 0.8.2", "hash-db", @@ -13215,7 +13332,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13232,18 +13349,18 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13257,7 +13374,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "parity-scale-codec", "scale-info", @@ -13603,7 +13720,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "platforms 2.0.0", ] @@ -13611,7 +13728,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -13630,7 +13747,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "hyper", "log", @@ -13642,7 +13759,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "jsonrpsee", @@ -13655,7 +13772,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "jsonrpsee", "log", @@ -13674,7 +13791,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -13700,7 +13817,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "futures", "substrate-test-utils-derive", @@ -13710,18 +13827,18 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "ansi_term", "build-helper", @@ -13730,7 +13847,7 @@ dependencies = [ "sp-maybe-compressed-blob", "strum", "tempfile", - "toml 0.5.10", + "toml 0.7.3", "walkdir", "wasm-opt", ] @@ -13847,8 +13964,8 @@ checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" [[package]] name = "test-runtime-constants" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-support", "polkadot-primitives", @@ -14094,21 +14211,7 @@ dependencies = [ "futures-core", "pin-project-lite 0.2.9", "tokio", - "tokio-util 0.7.1", -] - -[[package]] -name = "tokio-util" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e99e1983e5d376cd8eb4b66604d2e99e79f5bd988c3055891dcd8c9e2604cc0" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite 0.2.9", - "tokio", + "tokio-util", ] [[package]] @@ -14123,6 +14226,7 @@ dependencies = [ "futures-sink", "pin-project-lite 0.2.9", "tokio", + "tracing", ] [[package]] @@ -14255,8 +14359,8 @@ dependencies = [ [[package]] name = "tracing-gum" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -14266,14 +14370,14 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ - "expander 0.0.6", + "expander 2.0.0", "proc-macro-crate", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -14397,10 +14501,10 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#416b0f50bba519146ec7ea45a67980b45cd658e7" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", - "clap 4.1.14", + "clap 4.2.5", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -14428,7 +14532,7 @@ dependencies = [ "sp-version", "sp-weights", "substrate-rpc-client", - "zstd", + "zstd 0.12.3+zstd.1.5.2", ] [[package]] @@ -14564,6 +14668,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "uuid" version = "1.2.2" @@ -14885,9 +14995,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e89f9819523447330ffd70367ef4a18d8c832e24e8150fe054d1d912841632" +checksum = "76a222f5fa1e14b2cefc286f1b68494d7a965f4bf57ec04c59bb62673d639af6" dependencies = [ "anyhow", "bincode", @@ -14913,18 +15023,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd3a5e46c198032da934469f3a6e48649d1f9142438e4fd4617b68a35644b8a" +checksum = "4407a7246e7d2f3d8fb1cf0c72fda8dbafdb6dd34d555ae8bea0e5ae031089cc" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b389ae9b678b9c3851091a4804f4182d688d27aff7abc9aa37fa7be37d8ecffa" +checksum = "5ceb3adf61d654be0be67fffdce42447b0880481348785be5fe40b5dd7663a4c" dependencies = [ "anyhow", "base64", @@ -14937,14 +15047,14 @@ dependencies = [ "sha2 0.10.2", "toml 0.5.10", "windows-sys 0.42.0", - "zstd", + "zstd 0.11.2+zstd.1.5.2", ] [[package]] name = "wasmtime-cranelift" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b2c92a08c0db6efffd88fdc97d7aa9c7c63b03edb0971dbca745469f820e8c" +checksum = "3c366bb8647e01fd08cb5589976284b00abfded5529b33d7e7f3f086c68304a4" dependencies = [ "anyhow", "cranelift-codegen", @@ -14963,9 +15073,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a6db9fc52985ba06ca601f2ff0ff1f526c5d724c7ac267b47326304b0c97883" +checksum = "47b8b50962eae38ee319f7b24900b7cf371f03eebdc17400c1dc8575fc10c9a7" dependencies = [ "anyhow", "cranelift-entity", @@ -14982,9 +15092,9 @@ dependencies = [ [[package]] name = "wasmtime-jit" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b77e3a52cd84d0f7f18554afa8060cfe564ccac61e3b0802d3fd4084772fa5f6" +checksum = "ffaed4f9a234ba5225d8e64eac7b4a5d13b994aeb37353cde2cbeb3febda9eaa" dependencies = [ "addr2line 0.17.0", "anyhow", @@ -15006,9 +15116,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-debug" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0245e8a9347017c7185a72e215218a802ff561545c242953c11ba00fccc930f" +checksum = "eed41cbcbf74ce3ff6f1d07d1b707888166dc408d1a880f651268f4f7c9194b2" dependencies = [ "object 0.29.0", "once_cell", @@ -15017,9 +15127,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67d412e9340ab1c83867051d8d1d7c90aa8c9afc91da086088068e2734e25064" +checksum = "43a28ae1e648461bfdbb79db3efdaee1bca5b940872e4175390f465593a2e54c" dependencies = [ "cfg-if", "libc", @@ -15028,9 +15138,9 @@ dependencies = [ [[package]] name = "wasmtime-runtime" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d594e791b5fdd4dbaf8cf7ae62f2e4ff85018ce90f483ca6f42947688e48827d" +checksum = "e704b126e4252788ccfc3526d4d4511d4b23c521bf123e447ac726c14545217b" dependencies = [ "anyhow", "cc", @@ -15052,9 +15162,9 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "6.0.1" +version = "6.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6688d6f96d4dbc1f89fab626c56c1778936d122b5f4ae7a57c2eb42b8d982e2" +checksum = "83e5572c5727c1ee7e8f28717aaa8400e4d22dcbd714ea5457d85b5005206568" dependencies = [ "cranelift-entity", "serde", @@ -15324,8 +15434,8 @@ dependencies = [ [[package]] name = "westend-runtime" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bitvec", "frame-benchmarking", @@ -15336,7 +15446,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", - "hex-literal 0.3.4", + "hex-literal 0.4.1", "log", "pallet-authority-discovery", "pallet-authorship", @@ -15416,8 +15526,8 @@ dependencies = [ [[package]] name = "westend-runtime-constants" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-support", "polkadot-primitives", @@ -15599,12 +15709,12 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] @@ -15614,7 +15724,16 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] @@ -15623,21 +15742,42 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.32.0" @@ -15662,6 +15802,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.32.0" @@ -15686,6 +15832,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.32.0" @@ -15710,6 +15862,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.32.0" @@ -15734,12 +15892,24 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.32.0" @@ -15764,6 +15934,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "winnow" version = "0.3.6" @@ -15852,8 +16028,8 @@ dependencies = [ [[package]] name = "xcm" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "bounded-collections", "derivative", @@ -15868,8 +16044,8 @@ dependencies = [ [[package]] name = "xcm-builder" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "frame-support", "frame-system", @@ -15889,8 +16065,8 @@ dependencies = [ [[package]] name = "xcm-executor" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "environmental", "frame-benchmarking", @@ -15909,13 +16085,13 @@ dependencies = [ [[package]] name = "xcm-procedural" -version = "0.9.39" -source = "git+https://github.com/paritytech/polkadot?branch=master#dbae30efe080a1d41fe54ef4da8af47614c9ca93" +version = "0.9.41" +source = "git+https://github.com/paritytech/polkadot?branch=master#1d8ccbffd1235d4d1d3a0bf02132d8ea9105078f" dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -15968,7 +16144,16 @@ version = "0.11.2+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" dependencies = [ - "zstd-safe", + "zstd-safe 5.0.2+zstd.1.5.2", +] + +[[package]] +name = "zstd" +version = "0.12.3+zstd.1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" +dependencies = [ + "zstd-safe 6.0.5+zstd.1.5.4", ] [[package]] @@ -15981,12 +16166,23 @@ dependencies = [ "zstd-sys", ] +[[package]] +name = "zstd-safe" +version = "6.0.5+zstd.1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" +dependencies = [ + "libc", + "zstd-sys", +] + [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.8+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/README.md b/README.md index a1c2b210b11..d1828eafce1 100644 --- a/README.md +++ b/README.md @@ -199,12 +199,6 @@ See [the `contracts-rococo` readme](parachains/runtimes/contracts/contracts-roco See [the `bridge-hubs` readme](parachains/runtimes/bridge-hubs/README.md) for details. -**_Important:_** - -BridgeHub stuff uses external dependencies from repo `https://github.com/paritytech/parity-bridges-common.git`, which are mirrored to `./bridges` directory with `git subtree` feature. - -See [readme](parachains/runtimes/bridge-hubs/README.md#git-subtree-bridges) for details - ## Rococo 👑 [Rococo](https://polkadot.js.org/apps/?rpc=wss://rococo-rpc.polkadot.io) is becoming a diff --git a/bridges/bin/runtime-common/Cargo.toml b/bridges/bin/runtime-common/Cargo.toml index 3db4ae9abca..039e323b9b7 100644 --- a/bridges/bin/runtime-common/Cargo.toml +++ b/bridges/bin/runtime-common/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } hash-db = { version = "0.16.0", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } static_assertions = { version = "1.1", optional = true } # Bridge dependencies diff --git a/bridges/bin/runtime-common/src/integrity.rs b/bridges/bin/runtime-common/src/integrity.rs index 5820dd99b91..aa698b0b95e 100644 --- a/bridges/bin/runtime-common/src/integrity.rs +++ b/bridges/bin/runtime-common/src/integrity.rs @@ -24,8 +24,9 @@ use crate::{messages, messages::MessageBridge}; use bp_messages::{InboundLaneData, MessageNonce}; use bp_runtime::{Chain, ChainId}; use codec::Encode; -use frame_support::{storage::generator::StorageValue, traits::Get}; +use frame_support::{storage::generator::StorageValue, traits::Get, weights::Weight}; use frame_system::limits; +use pallet_bridge_messages::WeightInfoExt as _; use sp_runtime::traits::SignedExtension; /// Macro that ensures that the runtime configuration and chain primitives crate are sharing @@ -289,33 +290,62 @@ where } /// Check that the message lane weights are correct. -pub fn check_message_lane_weights( +pub fn check_message_lane_weights< + C: Chain, + T: frame_system::Config + pallet_bridge_messages::Config, + MessagesPalletInstance: 'static, +>( bridged_chain_extra_storage_proof_size: u32, this_chain_max_unrewarded_relayers: MessageNonce, this_chain_max_unconfirmed_messages: MessageNonce, + // whether `RefundBridgedParachainMessages` extension is deployed at runtime and is used for + // refunding this bridge transactions? + // + // in other words: pass true for all known production chains + runtime_includes_refund_extension: bool, ) { - type Weights = pallet_bridge_messages::weights::BridgeWeight; + type Weights = >::WeightInfo; - pallet_bridge_messages::ensure_weights_are_correct::>(); + // check basic weight assumptions + pallet_bridge_messages::ensure_weights_are_correct::>(); + // check that weights allow us to receive messages let max_incoming_message_proof_size = bridged_chain_extra_storage_proof_size .saturating_add(messages::target::maximal_incoming_message_size(C::max_extrinsic_size())); - pallet_bridge_messages::ensure_able_to_receive_message::>( + pallet_bridge_messages::ensure_able_to_receive_message::>( C::max_extrinsic_size(), C::max_extrinsic_weight(), max_incoming_message_proof_size, messages::target::maximal_incoming_message_dispatch_weight(C::max_extrinsic_weight()), ); + // check that weights allow us to receive delivery confirmations let max_incoming_inbound_lane_data_proof_size = InboundLaneData::<()>::encoded_size_hint_u32(this_chain_max_unrewarded_relayers as _); - pallet_bridge_messages::ensure_able_to_receive_confirmation::>( + pallet_bridge_messages::ensure_able_to_receive_confirmation::>( C::max_extrinsic_size(), C::max_extrinsic_weight(), max_incoming_inbound_lane_data_proof_size, this_chain_max_unrewarded_relayers, this_chain_max_unconfirmed_messages, ); + + // check that extra weights of delivery/confirmation transactions include the weight + // of `RefundBridgedParachainMessages` operations. This signed extension assumes the worst case + // (i.e. slashing if delivery transaction was invalid) and refunds some weight if + // assumption was wrong (i.e. if we did refund instead of slashing). This check + // ensures the extension will not refund weight when it doesn't need to (i.e. if pallet + // weights do not account weights of refund extension). + if runtime_includes_refund_extension { + assert_ne!( + Weights::::receive_messages_proof_overhead_from_runtime(), + Weight::zero() + ); + assert_ne!( + Weights::::receive_messages_delivery_proof_overhead_from_runtime(), + Weight::zero() + ); + } } /// Check that the `AdditionalSigned` type of a wrapped runtime is the same as the one of the diff --git a/bridges/bin/runtime-common/src/lib.rs b/bridges/bin/runtime-common/src/lib.rs index e8a2d2470fa..12b096492cd 100644 --- a/bridges/bin/runtime-common/src/lib.rs +++ b/bridges/bin/runtime-common/src/lib.rs @@ -159,7 +159,21 @@ pub enum CustomNetworkId { RialtoParachain, } +impl TryFrom for CustomNetworkId { + type Error = (); + + fn try_from(chain: bp_runtime::ChainId) -> Result { + Ok(match chain { + bp_runtime::MILLAU_CHAIN_ID => Self::Millau, + bp_runtime::RIALTO_CHAIN_ID => Self::Rialto, + bp_runtime::RIALTO_PARACHAIN_CHAIN_ID => Self::RialtoParachain, + _ => return Err(()), + }) + } +} + impl CustomNetworkId { + /// Converts self to XCM' network id. pub const fn as_network_id(&self) -> NetworkId { match *self { CustomNetworkId::Millau => NetworkId::Kusama, diff --git a/bridges/bin/runtime-common/src/messages.rs b/bridges/bin/runtime-common/src/messages.rs index 9d2e5811380..6f6b1959577 100644 --- a/bridges/bin/runtime-common/src/messages.rs +++ b/bridges/bin/runtime-common/src/messages.rs @@ -20,7 +20,7 @@ //! pallet is used to dispatch incoming messages. Message identified by a tuple //! of to elements - message lane id and message nonce. -pub use bp_runtime::{UnderlyingChainOf, UnderlyingChainProvider}; +pub use bp_runtime::{RangeInclusiveExt, UnderlyingChainOf, UnderlyingChainProvider}; use bp_header_chain::{HeaderChain, HeaderChainError}; use bp_messages::{ @@ -365,6 +365,7 @@ pub mod target { nonces_start, nonces_end, } = proof; + let nonces_range = nonces_start..=nonces_end; B::BridgedHeaderChain::parse_finalized_storage_proof( bridged_header_hash, @@ -374,26 +375,17 @@ pub mod target { StorageProofCheckerAdapter::<_, B> { storage, _dummy: Default::default() }; // receiving proofs where end < begin is ok (if proof includes outbound lane state) - let messages_in_the_proof = - if let Some(nonces_difference) = nonces_end.checked_sub(nonces_start) { - // let's check that the user (relayer) has passed correct `messages_count` - // (this bounds maximal capacity of messages vec below) - let messages_in_the_proof = nonces_difference.saturating_add(1); - if messages_in_the_proof != MessageNonce::from(messages_count) { - return Err(Error::MessagesCountMismatch) - } - - messages_in_the_proof - } else { - 0 - }; + let messages_in_the_proof = nonces_range.checked_len().unwrap_or(0); + if messages_in_the_proof != MessageNonce::from(messages_count) { + return Err(Error::MessagesCountMismatch) + } // Read messages first. All messages that are claimed to be in the proof must // be in the proof. So any error in `read_value`, or even missing value is fatal. // // Mind that we allow proofs with no messages if outbound lane state is proved. let mut messages = Vec::with_capacity(messages_in_the_proof as _); - for nonce in nonces_start..=nonces_end { + for nonce in nonces_range { let message_key = MessageKey { lane_id: lane, nonce }; let message_payload = parser.read_and_decode_message_payload(&message_key)?; messages.push(Message { key: message_key, payload: message_payload }); diff --git a/bridges/bin/runtime-common/src/messages_call_ext.rs b/bridges/bin/runtime-common/src/messages_call_ext.rs index f3665a8d93b..3f48ce583f9 100644 --- a/bridges/bin/runtime-common/src/messages_call_ext.rs +++ b/bridges/bin/runtime-common/src/messages_call_ext.rs @@ -115,6 +115,16 @@ pub enum CallInfo { ReceiveMessagesDeliveryProof(ReceiveMessagesDeliveryProofInfo), } +impl CallInfo { + /// Returns range of messages, bundled with the call. + pub fn bundled_messages(&self) -> RangeInclusive { + match *self { + Self::ReceiveMessagesProof(ref info) => info.base.bundled_range.clone(), + Self::ReceiveMessagesDeliveryProof(ref info) => info.0.bundled_range.clone(), + } + } +} + /// Helper struct that provides methods for working with a call supported by `CallInfo`. pub struct CallHelper, I: 'static> { pub _phantom_data: sp_std::marker::PhantomData<(T, I)>, diff --git a/bridges/bin/runtime-common/src/messages_xcm_extension.rs b/bridges/bin/runtime-common/src/messages_xcm_extension.rs index 4ccdd7a4b4d..96fdf1d5018 100644 --- a/bridges/bin/runtime-common/src/messages_xcm_extension.rs +++ b/bridges/bin/runtime-common/src/messages_xcm_extension.rs @@ -26,7 +26,7 @@ use bp_messages::{ target_chain::{DispatchMessage, MessageDispatch}, LaneId, }; -use bp_runtime::{messages::MessageDispatchResult, AccountIdOf, Chain}; +use bp_runtime::messages::MessageDispatchResult; use codec::{Decode, Encode}; use frame_support::{dispatch::Weight, CloneNoBound, EqNoBound, PartialEqNoBound}; use pallet_bridge_messages::WeightInfoExt as MessagesPalletWeights; @@ -46,23 +46,12 @@ pub enum XcmBlobMessageDispatchResult { } /// [`XcmBlobMessageDispatch`] is responsible for dispatching received messages -pub struct XcmBlobMessageDispatch -{ - _marker: sp_std::marker::PhantomData<( - SourceBridgeHubChain, - TargetBridgeHubChain, - DispatchBlob, - Weights, - )>, +pub struct XcmBlobMessageDispatch { + _marker: sp_std::marker::PhantomData<(DispatchBlob, Weights)>, } -impl< - SourceBridgeHubChain: Chain, - TargetBridgeHubChain: Chain, - BlobDispatcher: DispatchBlob, - Weights: MessagesPalletWeights, - > MessageDispatch> - for XcmBlobMessageDispatch +impl MessageDispatch + for XcmBlobMessageDispatch { type DispatchPayload = XcmAsPlainPayload; type DispatchLevelResult = XcmBlobMessageDispatchResult; @@ -78,7 +67,6 @@ impl< } fn dispatch( - _relayer_account: &AccountIdOf, message: DispatchMessage, ) -> MessageDispatchResult { let payload = match message.data.payload { diff --git a/bridges/bin/runtime-common/src/mock.rs b/bridges/bin/runtime-common/src/mock.rs index 036813f6fd5..c1767199676 100644 --- a/bridges/bin/runtime-common/src/mock.rs +++ b/bridges/bin/runtime-common/src/mock.rs @@ -35,6 +35,7 @@ use crate::messages::{ use bp_header_chain::{ChainWithGrandpa, HeaderChain}; use bp_messages::{target_chain::ForbidInboundMessages, LaneId, MessageNonce}; use bp_parachains::SingleParaStoredHeaderDataBuilder; +use bp_relayers::PayRewardFromAccount; use bp_runtime::{Chain, ChainId, Parachain, UnderlyingChainProvider}; use codec::{Decode, Encode}; use frame_support::{ @@ -83,6 +84,20 @@ pub type BridgedChainHasher = BlakeTwo256; pub type BridgedChainHeader = sp_runtime::generic::Header; +/// Rewards payment procedure. +pub type TestPaymentProcedure = PayRewardFromAccount; +/// Stake that we are using in tests. +pub type TestStake = ConstU64<5_000>; +/// Stake and slash mechanism to use in tests. +pub type TestStakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed< + ThisChainAccountId, + ThisChainBlockNumber, + Balances, + ReserveId, + TestStake, + ConstU32<8>, +>; + /// Message lane used in tests. pub const TEST_LANE_ID: LaneId = LaneId([0, 0, 0, 0]); /// Bridged chain id used in tests. @@ -128,6 +143,7 @@ parameter_types! { pub MaximumMultiplier: Multiplier = sp_runtime::traits::Bounded::max_value(); pub const MaxUnrewardedRelayerEntriesAtInboundLane: MessageNonce = 16; pub const MaxUnconfirmedMessagesAtInboundLane: MessageNonce = 1_000; + pub const ReserveId: [u8; 8] = *b"brdgrlrs"; } impl frame_system::Config for TestRuntime { @@ -244,7 +260,8 @@ impl pallet_bridge_messages::Config for TestRuntime { impl pallet_bridge_relayers::Config for TestRuntime { type RuntimeEvent = RuntimeEvent; type Reward = ThisChainBalance; - type PaymentProcedure = (); + type PaymentProcedure = TestPaymentProcedure; + type StakeAndSlash = TestStakeAndSlash; type WeightInfo = (); } @@ -400,3 +417,8 @@ impl ThisChainWithMessages for BridgedChain { } impl BridgedChainWithMessages for BridgedChain {} + +/// Run test within test externalities. +pub fn run_test(test: impl FnOnce()) { + sp_io::TestExternalities::new(Default::default()).execute_with(test) +} diff --git a/bridges/bin/runtime-common/src/refund_relayer_extension.rs b/bridges/bin/runtime-common/src/refund_relayer_extension.rs index 925fea2a743..c0e6d9bbc6c 100644 --- a/bridges/bin/runtime-common/src/refund_relayer_extension.rs +++ b/bridges/bin/runtime-common/src/refund_relayer_extension.rs @@ -22,7 +22,7 @@ use crate::messages_call_ext::{ CallHelper as MessagesCallHelper, CallInfo as MessagesCallInfo, MessagesCallSubType, }; -use bp_messages::LaneId; +use bp_messages::{LaneId, MessageNonce}; use bp_relayers::{RewardsAccountOwner, RewardsAccountParams}; use bp_runtime::{RangeInclusiveExt, StaticStrProvider}; use codec::{Decode, Encode}; @@ -30,7 +30,7 @@ use frame_support::{ dispatch::{CallableCallFor, DispatchInfo, Dispatchable, PostDispatchInfo}, traits::IsSubType, weights::Weight, - CloneNoBound, DefaultNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound, + CloneNoBound, DefaultNoBound, EqNoBound, PartialEqNoBound, RuntimeDebug, RuntimeDebugNoBound, }; use pallet_bridge_grandpa::{ CallSubType as GrandpaCallSubType, SubmitFinalityProofHelper, SubmitFinalityProofInfo, @@ -40,7 +40,9 @@ use pallet_bridge_parachains::{ BoundedBridgeGrandpaConfig, CallSubType as ParachainsCallSubType, Config as ParachainsConfig, RelayBlockNumber, SubmitParachainHeadsHelper, SubmitParachainHeadsInfo, }; -use pallet_bridge_relayers::{Config as RelayersConfig, Pallet as RelayersPallet}; +use pallet_bridge_relayers::{ + Config as RelayersConfig, Pallet as RelayersPallet, WeightInfoExt as _, +}; use pallet_transaction_payment::{Config as TransactionPaymentConfig, OnChargeTransaction}; use pallet_utility::{Call as UtilityCall, Config as UtilityConfig, Pallet as UtilityPallet}; use scale_info::TypeInfo; @@ -53,6 +55,7 @@ use sp_runtime::{ }; use sp_std::{marker::PhantomData, vec, vec::Vec}; +type AccountIdOf = ::AccountId; // without this typedef rustfmt fails with internal err type BalanceOf = <::OnChargeTransaction as OnChargeTransaction>::Balance; @@ -158,6 +161,14 @@ pub enum CallInfo { } impl CallInfo { + /// Returns true if call is a message delivery call (with optional finality calls). + fn is_receive_messages_proof_call(&self) -> bool { + match self.messages_call_info() { + MessagesCallInfo::ReceiveMessagesProof(_) => true, + MessagesCallInfo::ReceiveMessagesDeliveryProof(_) => false, + } + } + /// Returns the pre-dispatch `finality_target` sent to the `SubmitFinalityProof` call. fn submit_finality_proof_info(&self) -> Option> { match *self { @@ -185,6 +196,17 @@ impl CallInfo { } } +/// The actions on relayer account that need to be performed because of his actions. +#[derive(RuntimeDebug, PartialEq)] +enum RelayerAccountAction { + /// Do nothing with relayer account. + None, + /// Reward the relayer. + Reward(AccountId, RewardsAccountParams, Reward), + /// Slash the relayer. + Slash(AccountId, RewardsAccountParams), +} + /// Signed extension that refunds a relayer for new messages coming from a parachain. /// /// Also refunds relayer for successful finality delivery if it comes in batch (`utility.batchAll`) @@ -205,7 +227,25 @@ impl CallInfo { )] #[scale_info(skip_type_params(Runtime, Para, Msgs, Refund, Priority, Id))] pub struct RefundBridgedParachainMessages( - PhantomData<(Runtime, Para, Msgs, Refund, Priority, Id)>, + PhantomData<( + // runtime with `frame-utility`, `pallet-bridge-grandpa`, `pallet-bridge-parachains`, + // `pallet-bridge-messages` and `pallet-bridge-relayers` pallets deployed + Runtime, + // implementation of `RefundableParachainId` trait, which specifies the instance of + // the used `pallet-bridge-parachains` pallet and the bridged parachain id + Para, + // implementation of `RefundableMessagesLaneId` trait, which specifies the instance of + // the used `pallet-bridge-messages` pallet and the lane within this pallet + Msgs, + // implementation of the `RefundCalculator` trait, that is used to compute refund that + // we give to relayer for his transaction + Refund, + // getter for per-message `TransactionPriority` boost that we give to message + // delivery transactions + Priority, + // the runtime-unique identifier of this signed extension + Id, + )>, ); impl @@ -215,9 +255,13 @@ where Runtime: UtilityConfig> + BoundedBridgeGrandpaConfig + ParachainsConfig - + MessagesConfig, + + MessagesConfig + + RelayersConfig, Para: RefundableParachainId, Msgs: RefundableMessagesLaneId, + Refund: RefundCalculator, + Priority: Get, + Id: StaticStrProvider, CallOf: Dispatchable + IsSubType, Runtime>> + GrandpaCallSubType @@ -268,118 +312,69 @@ where call.check_obsolete_call()?; Ok(call) } -} -impl SignedExtension - for RefundBridgedParachainMessages -where - Self: 'static + Send + Sync, - Runtime: UtilityConfig> - + BoundedBridgeGrandpaConfig - + ParachainsConfig - + MessagesConfig - + RelayersConfig, - Para: RefundableParachainId, - Msgs: RefundableMessagesLaneId, - Refund: RefundCalculator, - Priority: Get, - Id: StaticStrProvider, - CallOf: Dispatchable - + IsSubType, Runtime>> - + GrandpaCallSubType - + ParachainsCallSubType - + MessagesCallSubType, -{ - const IDENTIFIER: &'static str = Id::STR; - type AccountId = Runtime::AccountId; - type Call = CallOf; - type AdditionalSigned = (); - type Pre = Option>; - - fn additional_signed(&self) -> Result<(), TransactionValidityError> { - Ok(()) - } - - fn validate( - &self, - _who: &Self::AccountId, - call: &Self::Call, - _info: &DispatchInfoOf, - _len: usize, - ) -> TransactionValidity { - // this is the only relevant line of code for the `pre_dispatch` - // - // we're not calling `validato` from `pre_dispatch` directly because of performance - // reasons, so if you're adding some code that may fail here, please check if it needs - // to be added to the `pre_dispatch` as well - let parsed_call = self.parse_and_check_for_obsolete_call(call)?; + /// Given post-dispatch information, analyze the outcome of relayer call and return + /// actions that need to be performed on relayer account. + fn analyze_call_result( + pre: Option>>, + info: &DispatchInfo, + post_info: &PostDispatchInfo, + len: usize, + result: &DispatchResult, + ) -> RelayerAccountAction, Runtime::Reward> { + let mut extra_weight = Weight::zero(); + let mut extra_size = 0; - // the following code just plays with transaction priority and never returns an error - let mut valid_transaction = ValidTransactionBuilder::default(); - if let Some(parsed_call) = parsed_call { - // we give delivery transactions some boost, that depends on number of messages inside - let messages_call_info = parsed_call.messages_call_info(); - if let MessagesCallInfo::ReceiveMessagesProof(info) = messages_call_info { - // compute total number of messages in transaction - let bundled_messages = info.base.bundled_range.checked_len().unwrap_or(0); - - // a quick check to avoid invalid high-priority transactions - if bundled_messages <= Runtime::MaxUnconfirmedMessagesAtInboundLane::get() { - let priority_boost = crate::priority_calculator::compute_priority_boost::< - Priority, - >(bundled_messages); - valid_transaction = valid_transaction.priority(priority_boost); - } - } - } + // We don't refund anything for transactions that we don't support. + let (relayer, call_info) = match pre { + Some(Some(pre)) => (pre.relayer, pre.call_info), + _ => return RelayerAccountAction::None, + }; - valid_transaction.build() - } + // now we know that the relayer either needs to be rewarded, or slashed + // => let's prepare the correspondent account that pays reward/receives slashed amount + let reward_account_params = RewardsAccountParams::new( + Msgs::Id::get(), + Runtime::BridgedChainId::get(), + if call_info.is_receive_messages_proof_call() { + RewardsAccountOwner::ThisChain + } else { + RewardsAccountOwner::BridgedChain + }, + ); - fn pre_dispatch( - self, - who: &Self::AccountId, - call: &Self::Call, - _info: &DispatchInfoOf, - _len: usize, - ) -> Result { - // this is a relevant piece of `validate` that we need here (in `pre_dispatch`) - let parsed_call = self.parse_and_check_for_obsolete_call(call)?; + // prepare return value for the case if the call has failed or it has not caused + // expected side effects (e.g. not all messages have been accepted) + // + // we are not checking if relayer is registered here - it happens during the slash attempt + // + // there are couple of edge cases here: + // + // - when the relayer becomes registered during message dispatch: this is unlikely + relayer + // should be ready for slashing after registration; + // + // - when relayer is registered after `validate` is called and priority is not boosted: + // relayer should be ready for slashing after registration. + let may_slash_relayer = + Self::bundled_messages_for_priority_boost(Some(&call_info)).is_some(); + let slash_relayer_if_delivery_result = may_slash_relayer + .then(|| RelayerAccountAction::Slash(relayer.clone(), reward_account_params)) + .unwrap_or(RelayerAccountAction::None); - Ok(parsed_call.map(|call_info| { + // We don't refund anything if the transaction has failed. + if let Err(e) = result { log::trace!( target: "runtime::bridge", - "{} from parachain {} via {:?} parsed bridge transaction in pre-dispatch: {:?}", + "{} from parachain {} via {:?}: relayer {:?} has submitted invalid messages transaction: {:?}", Self::IDENTIFIER, Para::Id::get(), Msgs::Id::get(), - call_info, + relayer, + e, ); - PreDispatchData { relayer: who.clone(), call_info } - })) - } - - fn post_dispatch( - pre: Option, - info: &DispatchInfoOf, - post_info: &PostDispatchInfoOf, - len: usize, - result: &DispatchResult, - ) -> Result<(), TransactionValidityError> { - let mut extra_weight = Weight::zero(); - let mut extra_size = 0; - - // We don't refund anything if the transaction has failed. - if result.is_err() { - return Ok(()) + return slash_relayer_if_delivery_result } - // We don't refund anything for transactions that we don't support. - let (relayer, call_info) = match pre { - Some(Some(pre)) => (pre.relayer, pre.call_info), - _ => return Ok(()), - }; - // check if relay chain state has been updated if let Some(finality_proof_info) = call_info.submit_finality_proof_info() { if !SubmitFinalityProofHelper::::was_successful( @@ -388,15 +383,13 @@ where // we only refund relayer if all calls have updated chain state log::trace!( target: "runtime::bridge", - "{} from parachain {} via {:?}: failed to refund relayer {:?}, because \ - relay chain finality proof has not been accepted", + "{} from parachain {} via {:?}: relayer {:?} has submitted invalid relay chain finality proof", Self::IDENTIFIER, Para::Id::get(), Msgs::Id::get(), relayer, ); - - return Ok(()) + return slash_relayer_if_delivery_result; } // there's a conflict between how bridge GRANDPA pallet works and a `utility.batchAll` @@ -420,15 +413,13 @@ where // we only refund relayer if all calls have updated chain state log::trace!( target: "runtime::bridge", - "{} from parachain {} via {:?}: failed to refund relayer {:?}, because \ - parachain finality proof has not been accepted", + "{} from parachain {} via {:?}: relayer {:?} has submitted invalid parachain finality proof", Self::IDENTIFIER, Para::Id::get(), Msgs::Id::get(), relayer, ); - - return Ok(()) + return slash_relayer_if_delivery_result } } @@ -438,15 +429,13 @@ where if !MessagesCallHelper::::was_successful(msgs_call_info) { log::trace!( target: "runtime::bridge", - "{} from parachain {} via {:?}: failed to refund relayer {:?}, because \ - some of messages have not been accepted", + "{} from parachain {} via {:?}: relayer {:?} has submitted invalid messages call", Self::IDENTIFIER, Para::Id::get(), Msgs::Id::get(), relayer, ); - - return Ok(()) + return slash_relayer_if_delivery_result } // regarding the tip - refund that happens here (at this side of the bridge) isn't the whole @@ -458,38 +447,187 @@ where // decrease post-dispatch weight/size using extra weight/size that we know now let post_info_len = len.saturating_sub(extra_size as usize); - let mut post_info = *post_info; - post_info.actual_weight = - Some(post_info.actual_weight.unwrap_or(info.weight).saturating_sub(extra_weight)); + let mut post_info_weight = + post_info.actual_weight.unwrap_or(info.weight).saturating_sub(extra_weight); + + // let's also replace the weight of slashing relayer with the weight of rewarding relayer + if call_info.is_receive_messages_proof_call() { + post_info_weight = post_info_weight.saturating_sub( + ::WeightInfo::extra_weight_of_successful_receive_messages_proof_call(), + ); + } // compute the relayer refund + let mut post_info = *post_info; + post_info.actual_weight = Some(post_info_weight); let refund = Refund::compute_refund(info, &post_info, post_info_len, tip); - // finally - register refund in relayers pallet - let rewards_account_owner = match msgs_call_info { - MessagesCallInfo::ReceiveMessagesProof(_) => RewardsAccountOwner::ThisChain, - MessagesCallInfo::ReceiveMessagesDeliveryProof(_) => RewardsAccountOwner::BridgedChain, + // we can finally reward relayer + RelayerAccountAction::Reward(relayer, reward_account_params, refund) + } + + /// Returns number of bundled messages `Some(_)`, if the given call info is a: + /// + /// - message delivery transaction; + /// + /// - with reasonable bundled messages that may be accepted by the messages pallet. + /// + /// This function is used to check whether the transaction priority should be + /// virtually boosted. The relayer registration (we only boost priority for registered + /// relayer transactions) must be checked outside. + fn bundled_messages_for_priority_boost(call_info: Option<&CallInfo>) -> Option { + // we only boost priority of message delivery transactions + let parsed_call = match call_info { + Some(parsed_call) if parsed_call.is_receive_messages_proof_call() => parsed_call, + _ => return None, }; - RelayersPallet::::register_relayer_reward( - RewardsAccountParams::new( - Msgs::Id::get(), - Runtime::BridgedChainId::get(), - rewards_account_owner, - ), - &relayer, - refund, - ); + + // compute total number of messages in transaction + let bundled_messages = + parsed_call.messages_call_info().bundled_messages().checked_len().unwrap_or(0); + + // a quick check to avoid invalid high-priority transactions + if bundled_messages > Runtime::MaxUnconfirmedMessagesAtInboundLane::get() { + return None + } + + Some(bundled_messages) + } +} + +impl SignedExtension + for RefundBridgedParachainMessages +where + Self: 'static + Send + Sync, + Runtime: UtilityConfig> + + BoundedBridgeGrandpaConfig + + ParachainsConfig + + MessagesConfig + + RelayersConfig, + Para: RefundableParachainId, + Msgs: RefundableMessagesLaneId, + Refund: RefundCalculator, + Priority: Get, + Id: StaticStrProvider, + CallOf: Dispatchable + + IsSubType, Runtime>> + + GrandpaCallSubType + + ParachainsCallSubType + + MessagesCallSubType, +{ + const IDENTIFIER: &'static str = Id::STR; + type AccountId = Runtime::AccountId; + type Call = CallOf; + type AdditionalSigned = (); + type Pre = Option>; + + fn additional_signed(&self) -> Result<(), TransactionValidityError> { + Ok(()) + } + + fn validate( + &self, + who: &Self::AccountId, + call: &Self::Call, + _info: &DispatchInfoOf, + _len: usize, + ) -> TransactionValidity { + // this is the only relevant line of code for the `pre_dispatch` + // + // we're not calling `validate` from `pre_dispatch` directly because of performance + // reasons, so if you're adding some code that may fail here, please check if it needs + // to be added to the `pre_dispatch` as well + let parsed_call = self.parse_and_check_for_obsolete_call(call)?; + + // the following code just plays with transaction priority and never returns an error + + // we only boost priority of presumably correct message delivery transactions + let bundled_messages = match Self::bundled_messages_for_priority_boost(parsed_call.as_ref()) + { + Some(bundled_messages) => bundled_messages, + None => return Ok(Default::default()), + }; + + // we only boost priority if relayer has staked required balance + if !RelayersPallet::::is_registration_active(who) { + return Ok(Default::default()) + } + + // compute priority boost + let priority_boost = + crate::priority_calculator::compute_priority_boost::(bundled_messages); + let valid_transaction = ValidTransactionBuilder::default().priority(priority_boost); log::trace!( target: "runtime::bridge", - "{} from parachain {} via {:?} has registered reward: {:?} for {:?}", + "{} from parachain {} via {:?} has boosted priority of message delivery transaction \ + of relayer {:?}: {} messages -> {} priority", Self::IDENTIFIER, Para::Id::get(), Msgs::Id::get(), - refund, - relayer, + who, + bundled_messages, + priority_boost, ); + valid_transaction.build() + } + + fn pre_dispatch( + self, + who: &Self::AccountId, + call: &Self::Call, + _info: &DispatchInfoOf, + _len: usize, + ) -> Result { + // this is a relevant piece of `validate` that we need here (in `pre_dispatch`) + let parsed_call = self.parse_and_check_for_obsolete_call(call)?; + + Ok(parsed_call.map(|call_info| { + log::trace!( + target: "runtime::bridge", + "{} from parachain {} via {:?} parsed bridge transaction in pre-dispatch: {:?}", + Self::IDENTIFIER, + Para::Id::get(), + Msgs::Id::get(), + call_info, + ); + PreDispatchData { relayer: who.clone(), call_info } + })) + } + + fn post_dispatch( + pre: Option, + info: &DispatchInfoOf, + post_info: &PostDispatchInfoOf, + len: usize, + result: &DispatchResult, + ) -> Result<(), TransactionValidityError> { + let call_result = Self::analyze_call_result(pre, info, post_info, len, result); + + match call_result { + RelayerAccountAction::None => (), + RelayerAccountAction::Reward(relayer, reward_account, reward) => { + RelayersPallet::::register_relayer_reward( + reward_account, + &relayer, + reward, + ); + + log::trace!( + target: "runtime::bridge", + "{} from parachain {} via {:?} has registered reward: {:?} for {:?}", + Self::IDENTIFIER, + Para::Id::get(), + Msgs::Id::get(), + reward, + relayer, + ); + }, + RelayerAccountAction::Slash(relayer, slash_account) => + RelayersPallet::::slash_and_deregister(&relayer, slash_account), + } + Ok(()) } } @@ -509,10 +647,14 @@ mod tests { }; use bp_messages::{InboundLaneData, MessageNonce, OutboundLaneData, UnrewardedRelayersState}; use bp_parachains::{BestParaHeadHash, ParaInfo}; - use bp_polkadot_core::parachains::{ParaHash, ParaHeadsProof, ParaId}; + use bp_polkadot_core::parachains::{ParaHeadsProof, ParaId}; use bp_runtime::HeaderId; use bp_test_utils::{make_default_justification, test_keyring}; - use frame_support::{assert_storage_noop, parameter_types, weights::Weight}; + use frame_support::{ + assert_storage_noop, parameter_types, + traits::{fungible::Mutate, ReservableCurrency}, + weights::Weight, + }; use pallet_bridge_grandpa::{Call as GrandpaCall, StoredAuthoritySet}; use pallet_bridge_messages::Call as MessagesCall; use pallet_bridge_parachains::{Call as ParachainsCall, RelayBlockHash}; @@ -547,6 +689,22 @@ mod tests { StrTestExtension, >; + fn initial_balance_of_relayer_account_at_this_chain() -> ThisChainBalance { + let test_stake: ThisChainBalance = TestStake::get(); + ExistentialDeposit::get().saturating_add(test_stake * 100) + } + + // in tests, the following accounts are equal (because of how `into_sub_account_truncating` + // works) + + fn delivery_rewards_account() -> ThisChainAccountId { + TestPaymentProcedure::rewards_account(MsgProofsRewardsAccount::get()) + } + + fn confirmation_rewards_account() -> ThisChainAccountId { + TestPaymentProcedure::rewards_account(MsgDeliveryProofsRewardsAccount::get()) + } + fn relayer_account_at_this_chain() -> ThisChainAccountId { 0 } @@ -558,7 +716,6 @@ mod tests { fn initialize_environment( best_relay_header_number: RelayBlockNumber, parachain_head_at_relay_header_number: RelayBlockNumber, - parachain_head_hash: ParaHash, best_message: MessageNonce, ) { let authorities = test_keyring().into_iter().map(|(a, w)| (a.into(), w)).collect(); @@ -572,7 +729,7 @@ mod tests { let para_info = ParaInfo { best_head_hash: BestParaHeadHash { at_relay_block_number: parachain_head_at_relay_header_number, - head_hash: parachain_head_hash, + head_hash: [parachain_head_at_relay_header_number as u8; 32].into(), }, next_imported_hash_position: 0, }; @@ -586,6 +743,14 @@ mod tests { let out_lane_data = OutboundLaneData { latest_received_nonce: best_message, ..Default::default() }; pallet_bridge_messages::OutboundLanes::::insert(lane_id, out_lane_data); + + Balances::mint_into(&delivery_rewards_account(), ExistentialDeposit::get()).unwrap(); + Balances::mint_into(&confirmation_rewards_account(), ExistentialDeposit::get()).unwrap(); + Balances::mint_into( + &relayer_account_at_this_chain(), + initial_balance_of_relayer_account_at_this_chain(), + ) + .unwrap(); } fn submit_relay_header_call(relay_header_number: RelayBlockNumber) -> RuntimeCall { @@ -609,7 +774,10 @@ mod tests { ) -> RuntimeCall { RuntimeCall::BridgeParachains(ParachainsCall::submit_parachain_heads { at_relay_block: (parachain_head_at_relay_header_number, RelayBlockHash::default()), - parachains: vec![(ParaId(TestParachain::get()), [1u8; 32].into())], + parachains: vec![( + ParaId(TestParachain::get()), + [parachain_head_at_relay_header_number as u8; 32].into(), + )], parachain_heads_proof: ParaHeadsProof(vec![]), }) } @@ -711,7 +879,7 @@ mod tests { SubmitParachainHeadsInfo { at_relay_block_number: 200, para_id: ParaId(TestParachain::get()), - para_head_hash: [1u8; 32].into(), + para_head_hash: [200u8; 32].into(), }, MessagesCallInfo::ReceiveMessagesProof(ReceiveMessagesProofInfo { base: BaseMessagesProofInfo { @@ -740,7 +908,7 @@ mod tests { SubmitParachainHeadsInfo { at_relay_block_number: 200, para_id: ParaId(TestParachain::get()), - para_head_hash: [1u8; 32].into(), + para_head_hash: [200u8; 32].into(), }, MessagesCallInfo::ReceiveMessagesDeliveryProof(ReceiveMessagesDeliveryProofInfo( BaseMessagesProofInfo { @@ -760,7 +928,7 @@ mod tests { SubmitParachainHeadsInfo { at_relay_block_number: 200, para_id: ParaId(TestParachain::get()), - para_head_hash: [1u8; 32].into(), + para_head_hash: [200u8; 32].into(), }, MessagesCallInfo::ReceiveMessagesProof(ReceiveMessagesProofInfo { base: BaseMessagesProofInfo { @@ -784,7 +952,7 @@ mod tests { SubmitParachainHeadsInfo { at_relay_block_number: 200, para_id: ParaId(TestParachain::get()), - para_head_hash: [1u8; 32].into(), + para_head_hash: [200u8; 32].into(), }, MessagesCallInfo::ReceiveMessagesDeliveryProof(ReceiveMessagesDeliveryProofInfo( BaseMessagesProofInfo { @@ -829,8 +997,21 @@ mod tests { } } - fn run_test(test: impl FnOnce()) { - sp_io::TestExternalities::new(Default::default()).execute_with(test) + fn set_bundled_range_end( + mut pre_dispatch_data: PreDispatchData, + end: MessageNonce, + ) -> PreDispatchData { + let msg_info = match pre_dispatch_data.call_info { + CallInfo::AllFinalityAndMsgs(_, _, ref mut info) => info, + CallInfo::ParachainFinalityAndMsgs(_, ref mut info) => info, + CallInfo::Msgs(ref mut info) => info, + }; + + if let MessagesCallInfo::ReceiveMessagesProof(ref mut msg_info) = msg_info { + msg_info.base.bundled_range = *msg_info.base.bundled_range.start()..=end + } + + pre_dispatch_data } fn run_validate(call: RuntimeCall) -> TransactionValidity { @@ -838,6 +1019,13 @@ mod tests { extension.validate(&relayer_account_at_this_chain(), &call, &DispatchInfo::default(), 0) } + fn run_validate_ignore_priority(call: RuntimeCall) -> TransactionValidity { + run_validate(call).map(|mut tx| { + tx.priority = 0; + tx + }) + } + fn run_pre_dispatch( call: RuntimeCall, ) -> Result>, TransactionValidityError> { @@ -874,7 +1062,20 @@ mod tests { assert_eq!(post_dispatch_result, Ok(())); } - fn expected_reward() -> ThisChainBalance { + fn expected_delivery_reward() -> ThisChainBalance { + let mut post_dispatch_info = post_dispatch_info(); + let extra_weight = ::WeightInfo::extra_weight_of_successful_receive_messages_proof_call(); + post_dispatch_info.actual_weight = + Some(dispatch_info().weight.saturating_sub(extra_weight)); + pallet_transaction_payment::Pallet::::compute_actual_fee( + 1024, + &dispatch_info(), + &post_dispatch_info, + Zero::zero(), + ) + } + + fn expected_confirmation_reward() -> ThisChainBalance { pallet_transaction_payment::Pallet::::compute_actual_fee( 1024, &dispatch_info(), @@ -883,10 +1084,49 @@ mod tests { ) } + #[test] + fn validate_doesnt_boost_transaction_priority_if_relayer_is_not_registered() { + run_test(|| { + initialize_environment(100, 100, 100); + Balances::set_balance(&relayer_account_at_this_chain(), ExistentialDeposit::get()); + + // message delivery is failing + assert_eq!(run_validate(message_delivery_call(200)), Ok(Default::default()),); + assert_eq!( + run_validate(parachain_finality_and_delivery_batch_call(200, 200)), + Ok(Default::default()), + ); + assert_eq!( + run_validate(all_finality_and_delivery_batch_call(200, 200, 200)), + Ok(Default::default()), + ); + // message confirmation validation is passing + assert_eq!( + run_validate_ignore_priority(message_confirmation_call(200)), + Ok(Default::default()), + ); + assert_eq!( + run_validate_ignore_priority(parachain_finality_and_confirmation_batch_call( + 200, 200 + )), + Ok(Default::default()), + ); + assert_eq!( + run_validate_ignore_priority(all_finality_and_confirmation_batch_call( + 200, 200, 200 + )), + Ok(Default::default()), + ); + }); + } + #[test] fn validate_boosts_priority_of_message_delivery_transactons() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); + + BridgeRelayers::register(RuntimeOrigin::signed(relayer_account_at_this_chain()), 1000) + .unwrap(); let priority_of_100_messages_delivery = run_validate(message_delivery_call(200)).unwrap().priority; @@ -913,7 +1153,10 @@ mod tests { #[test] fn validate_does_not_boost_priority_of_message_delivery_transactons_with_too_many_messages() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); + + BridgeRelayers::register(RuntimeOrigin::signed(relayer_account_at_this_chain()), 1000) + .unwrap(); let priority_of_max_messages_delivery = run_validate(message_delivery_call( 100 + MaxUnconfirmedMessagesAtInboundLane::get(), @@ -938,14 +1181,7 @@ mod tests { #[test] fn validate_allows_non_obsolete_transactions() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); - - fn run_validate_ignore_priority(call: RuntimeCall) -> TransactionValidity { - run_validate(call).map(|mut tx| { - tx.priority = 0; - tx - }) - } + initialize_environment(100, 100, 100); assert_eq!( run_validate_ignore_priority(message_delivery_call(200)), @@ -983,7 +1219,7 @@ mod tests { #[test] fn ext_rejects_batch_with_obsolete_relay_chain_header() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); assert_eq!( run_pre_dispatch(all_finality_and_delivery_batch_call(100, 200, 200)), @@ -1000,7 +1236,7 @@ mod tests { #[test] fn ext_rejects_batch_with_obsolete_parachain_head() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); assert_eq!( run_pre_dispatch(all_finality_and_delivery_batch_call(101, 100, 200)), @@ -1025,7 +1261,7 @@ mod tests { #[test] fn ext_rejects_batch_with_obsolete_messages() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); assert_eq!( run_pre_dispatch(all_finality_and_delivery_batch_call(200, 200, 100)), @@ -1068,7 +1304,7 @@ mod tests { #[test] fn pre_dispatch_parses_batch_with_relay_chain_and_parachain_headers() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); assert_eq!( run_pre_dispatch(all_finality_and_delivery_batch_call(200, 200, 200)), @@ -1084,7 +1320,7 @@ mod tests { #[test] fn pre_dispatch_parses_batch_with_parachain_header() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); assert_eq!( run_pre_dispatch(parachain_finality_and_delivery_batch_call(200, 200)), @@ -1100,7 +1336,7 @@ mod tests { #[test] fn pre_dispatch_fails_to_parse_batch_with_multiple_parachain_headers() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); let call = RuntimeCall::Utility(UtilityCall::batch_all { calls: vec![ @@ -1123,7 +1359,7 @@ mod tests { #[test] fn pre_dispatch_parses_message_transaction() { run_test(|| { - initialize_environment(100, 100, Default::default(), 100); + initialize_environment(100, 100, 100); assert_eq!( run_pre_dispatch(message_delivery_call(200)), @@ -1156,7 +1392,7 @@ mod tests { #[test] fn post_dispatch_ignores_transaction_that_has_not_updated_relay_chain_state() { run_test(|| { - initialize_environment(100, 200, Default::default(), 200); + initialize_environment(100, 200, 200); assert_storage_noop!(run_post_dispatch(Some(all_finality_pre_dispatch_data()), Ok(()))); }); @@ -1165,7 +1401,7 @@ mod tests { #[test] fn post_dispatch_ignores_transaction_that_has_not_updated_parachain_state() { run_test(|| { - initialize_environment(200, 100, Default::default(), 200); + initialize_environment(200, 100, 200); assert_storage_noop!(run_post_dispatch(Some(all_finality_pre_dispatch_data()), Ok(()))); assert_storage_noop!(run_post_dispatch( @@ -1178,7 +1414,31 @@ mod tests { #[test] fn post_dispatch_ignores_transaction_that_has_not_delivered_any_messages() { run_test(|| { - initialize_environment(200, 200, Default::default(), 100); + initialize_environment(200, 200, 100); + + assert_storage_noop!(run_post_dispatch(Some(all_finality_pre_dispatch_data()), Ok(()))); + assert_storage_noop!(run_post_dispatch( + Some(parachain_finality_pre_dispatch_data()), + Ok(()) + )); + assert_storage_noop!(run_post_dispatch(Some(delivery_pre_dispatch_data()), Ok(()))); + + assert_storage_noop!(run_post_dispatch( + Some(all_finality_confirmation_pre_dispatch_data()), + Ok(()) + )); + assert_storage_noop!(run_post_dispatch( + Some(parachain_finality_confirmation_pre_dispatch_data()), + Ok(()) + )); + assert_storage_noop!(run_post_dispatch(Some(confirmation_pre_dispatch_data()), Ok(()))); + }); + } + + #[test] + fn post_dispatch_ignores_transaction_that_has_not_delivered_all_messages() { + run_test(|| { + initialize_environment(200, 200, 150); assert_storage_noop!(run_post_dispatch(Some(all_finality_pre_dispatch_data()), Ok(()))); assert_storage_noop!(run_post_dispatch( @@ -1226,7 +1486,7 @@ mod tests { #[test] fn post_dispatch_refunds_relayer_in_all_finality_batch_with_extra_weight() { run_test(|| { - initialize_environment(200, 200, [1u8; 32].into(), 200); + initialize_environment(200, 200, 200); let mut dispatch_info = dispatch_info(); dispatch_info.weight = Weight::from_parts( @@ -1236,7 +1496,7 @@ mod tests { // without any size/weight refund: we expect regular reward let pre_dispatch_data = all_finality_pre_dispatch_data(); - let regular_reward = expected_reward(); + let regular_reward = expected_delivery_reward(); run_post_dispatch(Some(pre_dispatch_data), Ok(())); assert_eq!( RelayersPallet::::relayer_reward( @@ -1275,7 +1535,7 @@ mod tests { #[test] fn post_dispatch_refunds_relayer_in_all_finality_batch() { run_test(|| { - initialize_environment(200, 200, [1u8; 32].into(), 200); + initialize_environment(200, 200, 200); run_post_dispatch(Some(all_finality_pre_dispatch_data()), Ok(())); assert_eq!( @@ -1283,7 +1543,7 @@ mod tests { relayer_account_at_this_chain(), MsgProofsRewardsAccount::get() ), - Some(expected_reward()), + Some(expected_delivery_reward()), ); run_post_dispatch(Some(all_finality_confirmation_pre_dispatch_data()), Ok(())); @@ -1292,7 +1552,7 @@ mod tests { relayer_account_at_this_chain(), MsgDeliveryProofsRewardsAccount::get() ), - Some(expected_reward()), + Some(expected_confirmation_reward()), ); }); } @@ -1300,7 +1560,7 @@ mod tests { #[test] fn post_dispatch_refunds_relayer_in_parachain_finality_batch() { run_test(|| { - initialize_environment(200, 200, [1u8; 32].into(), 200); + initialize_environment(200, 200, 200); run_post_dispatch(Some(parachain_finality_pre_dispatch_data()), Ok(())); assert_eq!( @@ -1308,7 +1568,7 @@ mod tests { relayer_account_at_this_chain(), MsgProofsRewardsAccount::get() ), - Some(expected_reward()), + Some(expected_delivery_reward()), ); run_post_dispatch(Some(parachain_finality_confirmation_pre_dispatch_data()), Ok(())); @@ -1317,7 +1577,7 @@ mod tests { relayer_account_at_this_chain(), MsgDeliveryProofsRewardsAccount::get() ), - Some(expected_reward()), + Some(expected_confirmation_reward()), ); }); } @@ -1325,7 +1585,7 @@ mod tests { #[test] fn post_dispatch_refunds_relayer_in_message_transaction() { run_test(|| { - initialize_environment(200, 200, Default::default(), 200); + initialize_environment(200, 200, 200); run_post_dispatch(Some(delivery_pre_dispatch_data()), Ok(())); assert_eq!( @@ -1333,7 +1593,7 @@ mod tests { relayer_account_at_this_chain(), MsgProofsRewardsAccount::get() ), - Some(expected_reward()), + Some(expected_delivery_reward()), ); run_post_dispatch(Some(confirmation_pre_dispatch_data()), Ok(())); @@ -1342,7 +1602,152 @@ mod tests { relayer_account_at_this_chain(), MsgDeliveryProofsRewardsAccount::get() ), - Some(expected_reward()), + Some(expected_confirmation_reward()), + ); + }); + } + + #[test] + fn post_dispatch_slashing_relayer_stake() { + run_test(|| { + initialize_environment(200, 200, 100); + + let delivery_rewards_account_balance = + Balances::free_balance(delivery_rewards_account()); + + let test_stake: ThisChainBalance = TestStake::get(); + Balances::set_balance( + &relayer_account_at_this_chain(), + ExistentialDeposit::get() + test_stake * 10, + ); + + // slashing works for message delivery calls + BridgeRelayers::register(RuntimeOrigin::signed(relayer_account_at_this_chain()), 1000) + .unwrap(); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), test_stake); + run_post_dispatch(Some(delivery_pre_dispatch_data()), Ok(())); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), 0); + assert_eq!( + delivery_rewards_account_balance + test_stake, + Balances::free_balance(delivery_rewards_account()) + ); + + BridgeRelayers::register(RuntimeOrigin::signed(relayer_account_at_this_chain()), 1000) + .unwrap(); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), test_stake); + run_post_dispatch(Some(parachain_finality_pre_dispatch_data()), Ok(())); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), 0); + assert_eq!( + delivery_rewards_account_balance + test_stake * 2, + Balances::free_balance(delivery_rewards_account()) + ); + + BridgeRelayers::register(RuntimeOrigin::signed(relayer_account_at_this_chain()), 1000) + .unwrap(); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), test_stake); + run_post_dispatch(Some(all_finality_pre_dispatch_data()), Ok(())); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), 0); + assert_eq!( + delivery_rewards_account_balance + test_stake * 3, + Balances::free_balance(delivery_rewards_account()) + ); + + // reserve doesn't work for message confirmation calls + let confirmation_rewards_account_balance = + Balances::free_balance(confirmation_rewards_account()); + + Balances::reserve(&relayer_account_at_this_chain(), test_stake).unwrap(); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), test_stake); + + assert_eq!( + confirmation_rewards_account_balance, + Balances::free_balance(confirmation_rewards_account()) + ); + run_post_dispatch(Some(confirmation_pre_dispatch_data()), Ok(())); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), test_stake); + + run_post_dispatch(Some(parachain_finality_confirmation_pre_dispatch_data()), Ok(())); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), test_stake); + + run_post_dispatch(Some(all_finality_confirmation_pre_dispatch_data()), Ok(())); + assert_eq!(Balances::reserved_balance(relayer_account_at_this_chain()), test_stake); + + // check that unreserve has happened, not slashing + assert_eq!( + delivery_rewards_account_balance + test_stake * 3, + Balances::free_balance(delivery_rewards_account()) + ); + assert_eq!( + confirmation_rewards_account_balance, + Balances::free_balance(confirmation_rewards_account()) + ); + }); + } + + fn run_analyze_call_result( + pre_dispatch_data: PreDispatchData, + dispatch_result: DispatchResult, + ) -> RelayerAccountAction { + TestExtension::analyze_call_result( + Some(Some(pre_dispatch_data)), + &dispatch_info(), + &post_dispatch_info(), + 1024, + &dispatch_result, + ) + } + + #[test] + fn analyze_call_result_shall_not_slash_for_transactions_with_too_many_messages() { + run_test(|| { + initialize_environment(100, 100, 100); + + // the `analyze_call_result` should return slash if number of bundled messages is + // within reasonable limits + assert_eq!( + run_analyze_call_result(all_finality_pre_dispatch_data(), Ok(())), + RelayerAccountAction::Slash( + relayer_account_at_this_chain(), + MsgProofsRewardsAccount::get() + ), + ); + assert_eq!( + run_analyze_call_result(parachain_finality_pre_dispatch_data(), Ok(())), + RelayerAccountAction::Slash( + relayer_account_at_this_chain(), + MsgProofsRewardsAccount::get() + ), + ); + assert_eq!( + run_analyze_call_result(delivery_pre_dispatch_data(), Ok(())), + RelayerAccountAction::Slash( + relayer_account_at_this_chain(), + MsgProofsRewardsAccount::get() + ), + ); + + // the `analyze_call_result` should not return slash if number of bundled messages is + // larger than the + assert_eq!( + run_analyze_call_result( + set_bundled_range_end(all_finality_pre_dispatch_data(), 1_000_000), + Ok(()) + ), + RelayerAccountAction::None, + ); + assert_eq!( + run_analyze_call_result( + set_bundled_range_end(parachain_finality_pre_dispatch_data(), 1_000_000), + Ok(()) + ), + RelayerAccountAction::None, + ); + assert_eq!( + run_analyze_call_result( + set_bundled_range_end(delivery_pre_dispatch_data(), 1_000_000), + Ok(()) + ), + RelayerAccountAction::None, ); }); } diff --git a/bridges/modules/grandpa/Cargo.toml b/bridges/modules/grandpa/Cargo.toml index 07d2593b914..9b97b518fc5 100644 --- a/bridges/modules/grandpa/Cargo.toml +++ b/bridges/modules/grandpa/Cargo.toml @@ -11,7 +11,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } finality-grandpa = { version = "0.16.2", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/modules/grandpa/src/lib.rs b/bridges/modules/grandpa/src/lib.rs index 9d38c9723d7..329e4c21136 100644 --- a/bridges/modules/grandpa/src/lib.rs +++ b/bridges/modules/grandpa/src/lib.rs @@ -834,6 +834,7 @@ mod tests { run_test(|| { assert_eq!(BestFinalized::::get(), None,); assert_eq!(Pallet::::best_finalized(), None); + assert_eq!(PalletOperatingMode::::try_get(), Err(())); let init_data = init_with_origin(RuntimeOrigin::root()).unwrap(); @@ -843,7 +844,10 @@ mod tests { CurrentAuthoritySet::::get().authorities, init_data.authority_list ); - assert_eq!(PalletOperatingMode::::get(), BasicOperatingMode::Normal); + assert_eq!( + PalletOperatingMode::::try_get(), + Ok(BasicOperatingMode::Normal) + ); }) } diff --git a/bridges/modules/grandpa/src/weights.rs b/bridges/modules/grandpa/src/weights.rs index 089aee8b569..4b94f7adfe7 100644 --- a/bridges/modules/grandpa/src/weights.rs +++ b/bridges/modules/grandpa/src/weights.rs @@ -35,7 +35,7 @@ // --wasm-execution=Compiled // --heap-pages=4096 // --output=./modules/grandpa/src/weights.rs -// --template=./.maintain/millau-weight-template.hbs +// --template=./.maintain/bridge-weight-template.hbs #![allow(clippy::all)] #![allow(unused_parens)] diff --git a/bridges/modules/messages/Cargo.toml b/bridges/modules/messages/Cargo.toml index f733d62bf64..639ac9dc23c 100644 --- a/bridges/modules/messages/Cargo.toml +++ b/bridges/modules/messages/Cargo.toml @@ -10,7 +10,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.17", default-features = false } num-traits = { version = "0.2", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/modules/messages/src/inbound_lane.rs b/bridges/modules/messages/src/inbound_lane.rs index 59ff5667195..5ec4444dbdf 100644 --- a/bridges/modules/messages/src/inbound_lane.rs +++ b/bridges/modules/messages/src/inbound_lane.rs @@ -153,7 +153,7 @@ impl InboundLane { // Note: There will be max. 1 record to update as we don't allow messages from relayers to // overlap. match data.relayers.front_mut() { - Some(entry) if entry.messages.begin < new_confirmed_nonce => { + Some(entry) if entry.messages.begin <= new_confirmed_nonce => { entry.messages.begin = new_confirmed_nonce + 1; }, _ => {}, @@ -164,10 +164,9 @@ impl InboundLane { } /// Receive new message. - pub fn receive_message, AccountId>( + pub fn receive_message( &mut self, relayer_at_bridged_chain: &S::Relayer, - relayer_at_this_chain: &AccountId, nonce: MessageNonce, message_data: DispatchMessageData, ) -> ReceivalResult { @@ -189,13 +188,10 @@ impl InboundLane { } // then, dispatch message - let dispatch_result = Dispatch::dispatch( - relayer_at_this_chain, - DispatchMessage { - key: MessageKey { lane_id: self.storage.id(), nonce }, - data: message_data, - }, - ); + let dispatch_result = Dispatch::dispatch(DispatchMessage { + key: MessageKey { lane_id: self.storage.id(), nonce }, + data: message_data, + }); // now let's update inbound lane storage match data.relayers.back_mut() { @@ -221,20 +217,20 @@ mod tests { use crate::{ inbound_lane, mock::{ - dispatch_result, inbound_message_data, run_test, unrewarded_relayer, - TestMessageDispatch, TestRuntime, REGULAR_PAYLOAD, TEST_LANE_ID, TEST_RELAYER_A, - TEST_RELAYER_B, TEST_RELAYER_C, + dispatch_result, inbound_message_data, inbound_unrewarded_relayers_state, run_test, + unrewarded_relayer, TestMessageDispatch, TestRuntime, REGULAR_PAYLOAD, TEST_LANE_ID, + TEST_RELAYER_A, TEST_RELAYER_B, TEST_RELAYER_C, }, RuntimeInboundLaneStorage, }; + use bp_messages::UnrewardedRelayersState; fn receive_regular_message( lane: &mut InboundLane>, nonce: MessageNonce, ) { assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, nonce, inbound_message_data(REGULAR_PAYLOAD) @@ -361,8 +357,7 @@ mod tests { run_test(|| { let mut lane = inbound_lane::(TEST_LANE_ID); assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, 10, inbound_message_data(REGULAR_PAYLOAD) @@ -381,8 +376,7 @@ mod tests { ::MaxUnrewardedRelayerEntriesAtInboundLane::get(); for current_nonce in 1..max_nonce + 1 { assert_eq!( - lane.receive_message::( - &(TEST_RELAYER_A + current_nonce), + lane.receive_message::( &(TEST_RELAYER_A + current_nonce), current_nonce, inbound_message_data(REGULAR_PAYLOAD) @@ -392,8 +386,7 @@ mod tests { } // Fails to dispatch new message from different than latest relayer. assert_eq!( - lane.receive_message::( - &(TEST_RELAYER_A + max_nonce + 1), + lane.receive_message::( &(TEST_RELAYER_A + max_nonce + 1), max_nonce + 1, inbound_message_data(REGULAR_PAYLOAD) @@ -402,8 +395,7 @@ mod tests { ); // Fails to dispatch new messages from latest relayer. Prevents griefing attacks. assert_eq!( - lane.receive_message::( - &(TEST_RELAYER_A + max_nonce), + lane.receive_message::( &(TEST_RELAYER_A + max_nonce), max_nonce + 1, inbound_message_data(REGULAR_PAYLOAD) @@ -420,8 +412,7 @@ mod tests { let max_nonce = ::MaxUnconfirmedMessagesAtInboundLane::get(); for current_nonce in 1..=max_nonce { assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, current_nonce, inbound_message_data(REGULAR_PAYLOAD) @@ -431,8 +422,7 @@ mod tests { } // Fails to dispatch new message from different than latest relayer. assert_eq!( - lane.receive_message::( - &TEST_RELAYER_B, + lane.receive_message::( &TEST_RELAYER_B, max_nonce + 1, inbound_message_data(REGULAR_PAYLOAD) @@ -441,8 +431,7 @@ mod tests { ); // Fails to dispatch new messages from latest relayer. assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, max_nonce + 1, inbound_message_data(REGULAR_PAYLOAD) @@ -457,8 +446,7 @@ mod tests { run_test(|| { let mut lane = inbound_lane::(TEST_LANE_ID); assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, 1, inbound_message_data(REGULAR_PAYLOAD) @@ -466,8 +454,7 @@ mod tests { ReceivalResult::Dispatched(dispatch_result(0)) ); assert_eq!( - lane.receive_message::( - &TEST_RELAYER_B, + lane.receive_message::( &TEST_RELAYER_B, 2, inbound_message_data(REGULAR_PAYLOAD) @@ -475,8 +462,7 @@ mod tests { ReceivalResult::Dispatched(dispatch_result(0)) ); assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, 3, inbound_message_data(REGULAR_PAYLOAD) @@ -499,8 +485,7 @@ mod tests { run_test(|| { let mut lane = inbound_lane::(TEST_LANE_ID); assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, 1, inbound_message_data(REGULAR_PAYLOAD) @@ -508,8 +493,7 @@ mod tests { ReceivalResult::Dispatched(dispatch_result(0)) ); assert_eq!( - lane.receive_message::( - &TEST_RELAYER_B, + lane.receive_message::( &TEST_RELAYER_B, 1, inbound_message_data(REGULAR_PAYLOAD) @@ -535,8 +519,7 @@ mod tests { let mut payload = REGULAR_PAYLOAD; *payload.dispatch_result.unspent_weight.ref_time_mut() = 1; assert_eq!( - lane.receive_message::( - &TEST_RELAYER_A, + lane.receive_message::( &TEST_RELAYER_A, 1, inbound_message_data(payload) @@ -545,4 +528,29 @@ mod tests { ); }); } + + #[test] + fn first_message_is_confirmed_correctly() { + run_test(|| { + let mut lane = inbound_lane::(TEST_LANE_ID); + receive_regular_message(&mut lane, 1); + receive_regular_message(&mut lane, 2); + assert_eq!( + lane.receive_state_update(OutboundLaneData { + latest_received_nonce: 1, + ..Default::default() + }), + Some(1), + ); + assert_eq!( + inbound_unrewarded_relayers_state(TEST_LANE_ID), + UnrewardedRelayersState { + unrewarded_relayer_entries: 1, + messages_in_oldest_entry: 1, + total_messages: 1, + last_delivered_nonce: 2, + }, + ); + }); + } } diff --git a/bridges/modules/messages/src/lib.rs b/bridges/modules/messages/src/lib.rs index c94f5ffa752..045015b7751 100644 --- a/bridges/modules/messages/src/lib.rs +++ b/bridges/modules/messages/src/lib.rs @@ -162,10 +162,7 @@ pub mod pallet { /// Source header chain, as it is represented on target chain. type SourceHeaderChain: SourceHeaderChain; /// Message dispatch. - type MessageDispatch: MessageDispatch< - Self::AccountId, - DispatchPayload = Self::InboundPayload, - >; + type MessageDispatch: MessageDispatch; } /// Shortcut to messages proof type for Config. @@ -332,9 +329,10 @@ pub mod pallet { if let Some(updated_latest_confirmed_nonce) = updated_latest_confirmed_nonce { log::trace!( target: LOG_TARGET, - "Received lane {:?} state update: latest_confirmed_nonce={}", + "Received lane {:?} state update: latest_confirmed_nonce={}. Unrewarded relayers: {:?}", lane_id, updated_latest_confirmed_nonce, + UnrewardedRelayersState::from(&lane.storage().data()), ); } } @@ -361,9 +359,8 @@ pub mod pallet { fail!(Error::::InsufficientDispatchWeight); } - let receival_result = lane.receive_message::( + let receival_result = lane.receive_message::( &relayer_id_at_bridged_chain, - &relayer_id_at_this_chain, message.key.nonce, message.data, ); @@ -545,11 +542,7 @@ pub mod pallet { MessageAccepted { lane_id: LaneId, nonce: MessageNonce }, /// Messages have been received from the bridged chain. MessagesReceived( - Vec< - ReceivedMessages< - >::DispatchLevelResult, - >, - >, + Vec::DispatchLevelResult>>, ), /// Messages in the inclusive range have been delivered to the bridged chain. MessagesDelivered { lane_id: LaneId, messages: DeliveredMessages }, @@ -949,12 +942,12 @@ fn verify_and_decode_messages_proof::reset_events(); } - fn inbound_unrewarded_relayers_state( - lane: bp_messages::LaneId, - ) -> bp_messages::UnrewardedRelayersState { - let inbound_lane_data = InboundLanes::::get(lane).0; - let last_delivered_nonce = inbound_lane_data.last_delivered_nonce(); - let relayers = inbound_lane_data.relayers; - bp_messages::UnrewardedRelayersState { - unrewarded_relayer_entries: relayers.len() as _, - messages_in_oldest_entry: relayers - .front() - .map(|entry| 1 + entry.messages.end - entry.messages.begin) - .unwrap_or(0), - total_messages: total_unrewarded_messages(&relayers).unwrap_or(MessageNonce::MAX), - last_delivered_nonce, - } - } - fn send_regular_message() { get_ready_for_events(); diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index 75f05b4820a..2e45d5b601f 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/modules/messages/src/mock.rs @@ -27,7 +27,7 @@ use bp_messages::{ ProvedLaneMessages, ProvedMessages, SourceHeaderChain, }, DeliveredMessages, InboundLaneData, LaneId, Message, MessageKey, MessageNonce, MessagePayload, - OutboundLaneData, UnrewardedRelayer, + OutboundLaneData, UnrewardedRelayer, UnrewardedRelayersState, }; use bp_runtime::{messages::MessageDispatchResult, Size}; use codec::{Decode, Encode}; @@ -142,7 +142,7 @@ impl pallet_balances::Config for TestRuntime { parameter_types! { pub const MaxMessagesToPruneAtOnce: u64 = 10; pub const MaxUnrewardedRelayerEntriesAtInboundLane: u64 = 16; - pub const MaxUnconfirmedMessagesAtInboundLane: u64 = 32; + pub const MaxUnconfirmedMessagesAtInboundLane: u64 = 128; pub const TestBridgedChainId: bp_runtime::ChainId = *b"test"; pub const ActiveOutboundLanes: &'static [LaneId] = &[TEST_LANE_ID, TEST_LANE_ID_2]; } @@ -416,7 +416,7 @@ impl SourceHeaderChain for TestSourceHeaderChain { #[derive(Debug)] pub struct TestMessageDispatch; -impl MessageDispatch for TestMessageDispatch { +impl MessageDispatch for TestMessageDispatch { type DispatchPayload = TestPayload; type DispatchLevelResult = TestDispatchLevelResult; @@ -428,7 +428,6 @@ impl MessageDispatch for TestMessageDispatch { } fn dispatch( - _relayer_account: &AccountId, message: DispatchMessage, ) -> MessageDispatchResult { match message.data.payload.as_ref() { @@ -483,6 +482,12 @@ pub fn unrewarded_relayer( UnrewardedRelayer { relayer, messages: DeliveredMessages { begin, end } } } +/// Returns unrewarded relayers state at given lane. +pub fn inbound_unrewarded_relayers_state(lane: bp_messages::LaneId) -> UnrewardedRelayersState { + let inbound_lane_data = crate::InboundLanes::::get(lane).0; + UnrewardedRelayersState::from(&inbound_lane_data) +} + /// Return test externalities to use in tests. pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); diff --git a/bridges/modules/messages/src/outbound_lane.rs b/bridges/modules/messages/src/outbound_lane.rs index 33a58a40400..3d0d4de966a 100644 --- a/bridges/modules/messages/src/outbound_lane.rs +++ b/bridges/modules/messages/src/outbound_lane.rs @@ -196,9 +196,6 @@ fn ensure_unrewarded_relayers_are_correct( // entry can't confirm messages larger than `inbound_lane_data.latest_received_nonce()` // (guaranteed by the `InboundLane::receive_message()`) if entry.messages.end > latest_received_nonce { - // technically this will be detected in the next loop iteration as - // `InvalidNumberOfDispatchResults` but to guarantee safety of loop operations below - // this is detected now return Err(ReceivalConfirmationResult::FailedToConfirmFutureMessages) } } diff --git a/bridges/modules/messages/src/weights.rs b/bridges/modules/messages/src/weights.rs index baaef317241..9880f1dd1ea 100644 --- a/bridges/modules/messages/src/weights.rs +++ b/bridges/modules/messages/src/weights.rs @@ -35,7 +35,7 @@ // --wasm-execution=Compiled // --heap-pages=4096 // --output=./modules/messages/src/weights.rs -// --template=./.maintain/millau-weight-template.hbs +// --template=./.maintain/bridge-weight-template.hbs #![allow(clippy::all)] #![allow(unused_parens)] diff --git a/bridges/modules/messages/src/weights_ext.rs b/bridges/modules/messages/src/weights_ext.rs index 090c03390ba..3aefd6be7ca 100644 --- a/bridges/modules/messages/src/weights_ext.rs +++ b/bridges/modules/messages/src/weights_ext.rs @@ -266,6 +266,27 @@ pub trait WeightInfoExt: WeightInfo { /// this value, we're going to charge relayer for that. fn expected_extra_storage_proof_size() -> u32; + // Our configuration assumes that the runtime has special signed extensions used to: + // + // 1) reject obsolete delivery and confirmation transactions; + // + // 2) refund transaction cost to relayer and register his rewards. + // + // The checks in (1) are trivial, so its computation weight may be ignored. And we only touch + // storage values that are read during the call. So we may ignore the weight of this check. + // + // However, during (2) we read and update storage values of other pallets + // (`pallet-bridge-relayers` and balances/assets pallet). So we need to add this weight to the + // weight of our call. Hence two following methods. + + /// Extra weight that is added to the `receive_messages_proof` call weight by signed extensions + /// that are declared at runtime level. + fn receive_messages_proof_overhead_from_runtime() -> Weight; + + /// Extra weight that is added to the `receive_messages_delivery_proof` call weight by signed + /// extensions that are declared at runtime level. + fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight; + // Functions that are directly mapped to extrinsics weights. /// Weight of message delivery extrinsic. @@ -276,6 +297,8 @@ pub trait WeightInfoExt: WeightInfo { ) -> Weight { // basic components of extrinsic weight let transaction_overhead = Self::receive_messages_proof_overhead(); + let transaction_overhead_from_runtime = + Self::receive_messages_proof_overhead_from_runtime(); let outbound_state_delivery_weight = Self::receive_messages_proof_outbound_lane_state_overhead(); let messages_delivery_weight = @@ -292,6 +315,7 @@ pub trait WeightInfoExt: WeightInfo { ); transaction_overhead + .saturating_add(transaction_overhead_from_runtime) .saturating_add(outbound_state_delivery_weight) .saturating_add(messages_delivery_weight) .saturating_add(messages_dispatch_weight) @@ -305,6 +329,8 @@ pub trait WeightInfoExt: WeightInfo { ) -> Weight { // basic components of extrinsic weight let transaction_overhead = Self::receive_messages_delivery_proof_overhead(); + let transaction_overhead_from_runtime = + Self::receive_messages_delivery_proof_overhead_from_runtime(); let messages_overhead = Self::receive_messages_delivery_proof_messages_overhead(relayers_state.total_messages); let relayers_overhead = Self::receive_messages_delivery_proof_relayers_overhead( @@ -319,6 +345,7 @@ pub trait WeightInfoExt: WeightInfo { ); transaction_overhead + .saturating_add(transaction_overhead_from_runtime) .saturating_add(messages_overhead) .saturating_add(relayers_overhead) .saturating_add(proof_size_overhead) @@ -424,12 +451,28 @@ impl WeightInfoExt for () { fn expected_extra_storage_proof_size() -> u32 { EXTRA_STORAGE_PROOF_SIZE } + + fn receive_messages_proof_overhead_from_runtime() -> Weight { + Weight::zero() + } + + fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight { + Weight::zero() + } } impl WeightInfoExt for crate::weights::BridgeWeight { fn expected_extra_storage_proof_size() -> u32 { EXTRA_STORAGE_PROOF_SIZE } + + fn receive_messages_proof_overhead_from_runtime() -> Weight { + Weight::zero() + } + + fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight { + Weight::zero() + } } #[cfg(test)] diff --git a/bridges/modules/parachains/Cargo.toml b/bridges/modules/parachains/Cargo.toml index 39c3ba626aa..d8c89b79991 100644 --- a/bridges/modules/parachains/Cargo.toml +++ b/bridges/modules/parachains/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/modules/parachains/src/weights.rs b/bridges/modules/parachains/src/weights.rs index 54a835cbc87..1e81dba72fe 100644 --- a/bridges/modules/parachains/src/weights.rs +++ b/bridges/modules/parachains/src/weights.rs @@ -35,7 +35,7 @@ // --wasm-execution=Compiled // --heap-pages=4096 // --output=./modules/parachains/src/weights.rs -// --template=./.maintain/millau-weight-template.hbs +// --template=./.maintain/bridge-weight-template.hbs #![allow(clippy::all)] #![allow(unused_parens)] diff --git a/bridges/modules/relayers/Cargo.toml b/bridges/modules/relayers/Cargo.toml index c654c60d02b..857d47cc65a 100644 --- a/bridges/modules/relayers/Cargo.toml +++ b/bridges/modules/relayers/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/modules/relayers/src/benchmarking.rs b/bridges/modules/relayers/src/benchmarking.rs index a762a5693c2..d66a11ff06d 100644 --- a/bridges/modules/relayers/src/benchmarking.rs +++ b/bridges/modules/relayers/src/benchmarking.rs @@ -24,6 +24,7 @@ use bp_messages::LaneId; use bp_relayers::RewardsAccountOwner; use frame_benchmarking::{benchmarks, whitelisted_caller}; use frame_system::RawOrigin; +use sp_runtime::traits::One; /// Reward amount that is (hopefully) is larger than existential deposit across all chains. const REWARD_AMOUNT: u32 = u32::MAX; @@ -34,7 +35,9 @@ pub struct Pallet(crate::Pallet); /// Trait that must be implemented by runtime. pub trait Config: crate::Config { /// Prepare environment for paying given reward for serving given lane. - fn prepare_environment(account_params: RewardsAccountParams, reward: Self::Reward); + fn prepare_rewards_account(account_params: RewardsAccountParams, reward: Self::Reward); + /// Give enough balance to given account. + fn deposit_account(account: Self::AccountId, balance: Self::Reward); } benchmarks! { @@ -46,7 +49,7 @@ benchmarks! { let relayer: T::AccountId = whitelisted_caller(); let reward = T::Reward::from(REWARD_AMOUNT); - T::prepare_environment(account_params, reward); + T::prepare_rewards_account(account_params, reward); RelayerRewards::::insert(&relayer, account_params, reward); }: _(RawOrigin::Signed(relayer), account_params) verify { @@ -55,5 +58,74 @@ benchmarks! { // also completed successfully } + // Benchmark `register` call. + register { + let relayer: T::AccountId = whitelisted_caller(); + let valid_till = frame_system::Pallet::::block_number() + .saturating_add(crate::Pallet::::required_registration_lease()) + .saturating_add(One::one()) + .saturating_add(One::one()); + + T::deposit_account(relayer.clone(), crate::Pallet::::required_stake()); + }: _(RawOrigin::Signed(relayer.clone()), valid_till) + verify { + assert!(crate::Pallet::::is_registration_active(&relayer)); + } + + // Benchmark `deregister` call. + deregister { + let relayer: T::AccountId = whitelisted_caller(); + let valid_till = frame_system::Pallet::::block_number() + .saturating_add(crate::Pallet::::required_registration_lease()) + .saturating_add(One::one()) + .saturating_add(One::one()); + T::deposit_account(relayer.clone(), crate::Pallet::::required_stake()); + crate::Pallet::::register(RawOrigin::Signed(relayer.clone()).into(), valid_till).unwrap(); + + frame_system::Pallet::::set_block_number(valid_till.saturating_add(One::one())); + }: _(RawOrigin::Signed(relayer.clone())) + verify { + assert!(!crate::Pallet::::is_registration_active(&relayer)); + } + + // Benchmark `slash_and_deregister` method of the pallet. We are adding this weight to + // the weight of message delivery call if `RefundBridgedParachainMessages` signed extension + // is deployed at runtime level. + slash_and_deregister { + // prepare and register relayer account + let relayer: T::AccountId = whitelisted_caller(); + let valid_till = frame_system::Pallet::::block_number() + .saturating_add(crate::Pallet::::required_registration_lease()) + .saturating_add(One::one()) + .saturating_add(One::one()); + T::deposit_account(relayer.clone(), crate::Pallet::::required_stake()); + crate::Pallet::::register(RawOrigin::Signed(relayer.clone()).into(), valid_till).unwrap(); + + // create slash destination account + let lane = LaneId([0, 0, 0, 0]); + let slash_destination = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain); + T::prepare_rewards_account(slash_destination.clone(), Zero::zero()); + }: { + crate::Pallet::::slash_and_deregister(&relayer, slash_destination) + } + verify { + assert!(!crate::Pallet::::is_registration_active(&relayer)); + } + + // Benchmark `register_relayer_reward` method of the pallet. We are adding this weight to + // the weight of message delivery call if `RefundBridgedParachainMessages` signed extension + // is deployed at runtime level. + register_relayer_reward { + let lane = LaneId([0, 0, 0, 0]); + let relayer: T::AccountId = whitelisted_caller(); + let account_params = + RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain); + }: { + crate::Pallet::::register_relayer_reward(account_params.clone(), &relayer, One::one()); + } + verify { + assert_eq!(RelayerRewards::::get(relayer, &account_params), Some(One::one())); + } + impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::TestRuntime) } diff --git a/bridges/modules/relayers/src/lib.rs b/bridges/modules/relayers/src/lib.rs index bd33b811b30..54b888cf29d 100644 --- a/bridges/modules/relayers/src/lib.rs +++ b/bridges/modules/relayers/src/lib.rs @@ -20,20 +20,27 @@ #![cfg_attr(not(feature = "std"), no_std)] #![warn(missing_docs)] -use bp_relayers::{PaymentProcedure, RelayerRewardsKeyProvider, RewardsAccountParams}; +use bp_relayers::{ + PaymentProcedure, Registration, RelayerRewardsKeyProvider, RewardsAccountParams, StakeAndSlash, +}; use bp_runtime::StorageDoubleMapKeyProvider; -use frame_support::sp_runtime::Saturating; +use frame_support::fail; use sp_arithmetic::traits::{AtLeast32BitUnsigned, Zero}; +use sp_runtime::{traits::CheckedSub, Saturating}; use sp_std::marker::PhantomData; pub use pallet::*; pub use payment_adapter::DeliveryConfirmationPaymentsAdapter; +pub use stake_adapter::StakeAndSlashNamed; pub use weights::WeightInfo; +pub use weights_ext::WeightInfoExt; pub mod benchmarking; mod mock; mod payment_adapter; +mod stake_adapter; +mod weights_ext; pub mod weights; @@ -56,10 +63,12 @@ pub mod pallet { type RuntimeEvent: From> + IsType<::RuntimeEvent>; /// Type of relayer reward. type Reward: AtLeast32BitUnsigned + Copy + Parameter + MaxEncodedLen; - /// Pay rewards adapter. + /// Pay rewards scheme. type PaymentProcedure: PaymentProcedure; + /// Stake and slash scheme. + type StakeAndSlash: StakeAndSlash; /// Pallet call weights. - type WeightInfo: WeightInfo; + type WeightInfo: WeightInfoExt; } #[pallet::pallet] @@ -102,9 +111,196 @@ pub mod pallet { }, ) } + + /// Register relayer or update its registration. + /// + /// Registration allows relayer to get priority boost for its message delivery transactions. + #[pallet::call_index(1)] + #[pallet::weight(T::WeightInfo::register())] + pub fn register(origin: OriginFor, valid_till: T::BlockNumber) -> DispatchResult { + let relayer = ensure_signed(origin)?; + + // valid till must be larger than the current block number and the lease must be larger + // than the `RequiredRegistrationLease` + let lease = valid_till.saturating_sub(frame_system::Pallet::::block_number()); + ensure!( + lease > Pallet::::required_registration_lease(), + Error::::InvalidRegistrationLease + ); + + RegisteredRelayers::::try_mutate(&relayer, |maybe_registration| -> DispatchResult { + let mut registration = maybe_registration + .unwrap_or_else(|| Registration { valid_till, stake: Zero::zero() }); + + // new `valid_till` must be larger (or equal) than the old one + ensure!( + valid_till >= registration.valid_till, + Error::::CannotReduceRegistrationLease, + ); + registration.valid_till = valid_till; + + // regarding stake, there are three options: + // - if relayer stake is larger than required stake, we may do unreserve + // - if relayer stake equals to required stake, we do nothing + // - if relayer stake is smaller than required stake, we do additional reserve + let required_stake = Pallet::::required_stake(); + if let Some(to_unreserve) = registration.stake.checked_sub(&required_stake) { + Self::do_unreserve(&relayer, to_unreserve)?; + } else if let Some(to_reserve) = required_stake.checked_sub(®istration.stake) { + T::StakeAndSlash::reserve(&relayer, to_reserve).map_err(|e| { + log::trace!( + target: LOG_TARGET, + "Failed to reserve {:?} on relayer {:?} account: {:?}", + to_reserve, + relayer, + e, + ); + + Error::::FailedToReserve + })?; + } + registration.stake = required_stake; + + log::trace!(target: LOG_TARGET, "Successfully registered relayer: {:?}", relayer); + Self::deposit_event(Event::::RegistrationUpdated { + relayer: relayer.clone(), + registration, + }); + + *maybe_registration = Some(registration); + + Ok(()) + }) + } + + /// `Deregister` relayer. + /// + /// After this call, message delivery transactions of the relayer won't get any priority + /// boost. + #[pallet::call_index(2)] + #[pallet::weight(T::WeightInfo::deregister())] + pub fn deregister(origin: OriginFor) -> DispatchResult { + let relayer = ensure_signed(origin)?; + + RegisteredRelayers::::try_mutate(&relayer, |maybe_registration| -> DispatchResult { + let registration = match maybe_registration.take() { + Some(registration) => registration, + None => fail!(Error::::NotRegistered), + }; + + // we can't deregister until `valid_till + 1` + ensure!( + registration.valid_till < frame_system::Pallet::::block_number(), + Error::::RegistrationIsStillActive, + ); + + // if stake is non-zero, we should do unreserve + if !registration.stake.is_zero() { + Self::do_unreserve(&relayer, registration.stake)?; + } + + log::trace!(target: LOG_TARGET, "Successfully deregistered relayer: {:?}", relayer); + Self::deposit_event(Event::::Deregistered { relayer: relayer.clone() }); + + *maybe_registration = None; + + Ok(()) + }) + } } impl Pallet { + /// Returns true if given relayer registration is active at current block. + /// + /// This call respects both `RequiredStake` and `RequiredRegistrationLease`, meaning that + /// it'll return false if registered stake is lower than required or if remaining lease + /// is less than `RequiredRegistrationLease`. + pub fn is_registration_active(relayer: &T::AccountId) -> bool { + let registration = match Self::registered_relayer(relayer) { + Some(registration) => registration, + None => return false, + }; + + // registration is inactive if relayer stake is less than required + if registration.stake < Self::required_stake() { + return false + } + + // registration is inactive if it ends soon + let remaining_lease = registration + .valid_till + .saturating_sub(frame_system::Pallet::::block_number()); + if remaining_lease <= Self::required_registration_lease() { + return false + } + + true + } + + /// Slash and `deregister` relayer. This function slashes all staked balance. + /// + /// It may fail inside, but error is swallowed and we only log it. + pub fn slash_and_deregister( + relayer: &T::AccountId, + slash_destination: RewardsAccountParams, + ) { + let registration = match RegisteredRelayers::::take(relayer) { + Some(registration) => registration, + None => { + log::trace!( + target: crate::LOG_TARGET, + "Cannot slash unregistered relayer {:?}", + relayer, + ); + + return + }, + }; + + match T::StakeAndSlash::repatriate_reserved( + relayer, + slash_destination, + registration.stake, + ) { + Ok(failed_to_slash) if failed_to_slash.is_zero() => { + log::trace!( + target: crate::LOG_TARGET, + "Relayer account {:?} has been slashed for {:?}. Funds were deposited to {:?}", + relayer, + registration.stake, + slash_destination, + ); + }, + Ok(failed_to_slash) => { + log::trace!( + target: crate::LOG_TARGET, + "Relayer account {:?} has been partially slashed for {:?}. Funds were deposited to {:?}. \ + Failed to slash: {:?}", + relayer, + registration.stake, + slash_destination, + failed_to_slash, + ); + }, + Err(e) => { + // TODO: document this. Where? + + // it may fail if there's no beneficiary account. For us it means that this + // account must exists before we'll deploy the bridge + log::debug!( + target: crate::LOG_TARGET, + "Failed to slash relayer account {:?}: {:?}. Maybe beneficiary account doesn't exist? \ + Beneficiary: {:?}, amount: {:?}, failed to slash: {:?}", + relayer, + e, + slash_destination, + registration.stake, + registration.stake, + ); + }, + } + } + /// Register reward for given relayer. pub fn register_relayer_reward( rewards_account_params: RewardsAccountParams, @@ -132,6 +328,42 @@ pub mod pallet { }, ); } + + /// Return required registration lease. + pub(crate) fn required_registration_lease() -> T::BlockNumber { + >::RequiredRegistrationLease::get() + } + + /// Return required stake. + pub(crate) fn required_stake() -> T::Reward { + >::RequiredStake::get() + } + + /// `Unreserve` given amount on relayer account. + fn do_unreserve(relayer: &T::AccountId, amount: T::Reward) -> DispatchResult { + let failed_to_unreserve = T::StakeAndSlash::unreserve(relayer, amount); + if !failed_to_unreserve.is_zero() { + log::trace!( + target: LOG_TARGET, + "Failed to unreserve {:?}/{:?} on relayer {:?} account", + failed_to_unreserve, + amount, + relayer, + ); + + fail!(Error::::FailedToUnreserve) + } + + Ok(()) + } } #[pallet::event] @@ -146,6 +378,25 @@ pub mod pallet { /// Reward amount. reward: T::Reward, }, + /// Relayer registration has been added or updated. + RegistrationUpdated { + /// Relayer account that has been registered. + relayer: T::AccountId, + /// Relayer registration. + registration: Registration, + }, + /// Relayer has been `deregistered`. + Deregistered { + /// Relayer account that has been `deregistered`. + relayer: T::AccountId, + }, + /// Relayer has been slashed and `deregistered`. + SlashedAndDeregistered { + /// Relayer account that has been `deregistered`. + relayer: T::AccountId, + /// Registration that was removed. + registration: Registration, + }, } #[pallet::error] @@ -154,6 +405,19 @@ pub mod pallet { NoRewardForRelayer, /// Reward payment procedure has failed. FailedToPayReward, + /// The relayer has tried to register for past block or registration lease + /// is too short. + InvalidRegistrationLease, + /// New registration lease is less than the previous one. + CannotReduceRegistrationLease, + /// Failed to reserve enough funds on relayer account. + FailedToReserve, + /// Failed to `unreserve` enough funds on relayer account. + FailedToUnreserve, + /// Cannot `deregister` if not registered. + NotRegistered, + /// Failed to `deregister` relayer, because lease is still active. + RegistrationIsStillActive, } /// Map of the relayer => accumulated reward. @@ -168,6 +432,22 @@ pub mod pallet { as StorageDoubleMapKeyProvider>::Value, OptionQuery, >; + + /// Relayers that have reserved some of their balance to get free priority boost + /// for their message delivery transactions. + /// + /// Other relayers may submit transactions as well, but they will have default + /// priority and will be rejected (without significant tip) in case if registered + /// relayer is present. + #[pallet::storage] + #[pallet::getter(fn registered_relayer)] + pub type RegisteredRelayers = StorageMap< + _, + Blake2_128Concat, + T::AccountId, + Registration, + OptionQuery, + >; } #[cfg(test)] @@ -253,10 +533,10 @@ mod tests { None ); - //Check if the `RewardPaid` event was emitted. + // Check if the `RewardPaid` event was emitted. assert_eq!( - System::::events(), - vec![EventRecord { + System::::events().last(), + Some(&EventRecord { phase: Phase::Initialization, event: TestEvent::Relayers(RewardPaid { relayer: REGULAR_RELAYER, @@ -264,7 +544,7 @@ mod tests { reward: 100 }), topics: vec![], - }], + }), ); }); } @@ -306,4 +586,295 @@ mod tests { assert_eq!(Balances::balance(&1), 200); }); } + + #[test] + fn register_fails_if_valid_till_is_a_past_block() { + run_test(|| { + System::::set_block_number(100); + + assert_noop!( + Pallet::::register(RuntimeOrigin::signed(REGISTER_RELAYER), 50), + Error::::InvalidRegistrationLease, + ); + }); + } + + #[test] + fn register_fails_if_valid_till_lease_is_less_than_required() { + run_test(|| { + System::::set_block_number(100); + + assert_noop!( + Pallet::::register( + RuntimeOrigin::signed(REGISTER_RELAYER), + 99 + Lease::get() + ), + Error::::InvalidRegistrationLease, + ); + }); + } + + #[test] + fn register_works() { + run_test(|| { + get_ready_for_events(); + + assert_ok!(Pallet::::register( + RuntimeOrigin::signed(REGISTER_RELAYER), + 150 + )); + assert_eq!(Balances::reserved_balance(REGISTER_RELAYER), Stake::get()); + assert_eq!( + Pallet::::registered_relayer(REGISTER_RELAYER), + Some(Registration { valid_till: 150, stake: Stake::get() }), + ); + + assert_eq!( + System::::events().last(), + Some(&EventRecord { + phase: Phase::Initialization, + event: TestEvent::Relayers(Event::RegistrationUpdated { + relayer: REGISTER_RELAYER, + registration: Registration { valid_till: 150, stake: Stake::get() }, + }), + topics: vec![], + }), + ); + }); + } + + #[test] + fn register_fails_if_new_valid_till_is_lesser_than_previous() { + run_test(|| { + assert_ok!(Pallet::::register( + RuntimeOrigin::signed(REGISTER_RELAYER), + 150 + )); + + assert_noop!( + Pallet::::register(RuntimeOrigin::signed(REGISTER_RELAYER), 125), + Error::::CannotReduceRegistrationLease, + ); + }); + } + + #[test] + fn register_fails_if_it_cant_unreserve_some_balance_if_required_stake_decreases() { + run_test(|| { + RegisteredRelayers::::insert( + REGISTER_RELAYER, + Registration { valid_till: 150, stake: Stake::get() + 1 }, + ); + + assert_noop!( + Pallet::::register(RuntimeOrigin::signed(REGISTER_RELAYER), 150), + Error::::FailedToUnreserve, + ); + }); + } + + #[test] + fn register_unreserves_some_balance_if_required_stake_decreases() { + run_test(|| { + get_ready_for_events(); + + RegisteredRelayers::::insert( + REGISTER_RELAYER, + Registration { valid_till: 150, stake: Stake::get() + 1 }, + ); + TestStakeAndSlash::reserve(®ISTER_RELAYER, Stake::get() + 1).unwrap(); + assert_eq!(Balances::reserved_balance(REGISTER_RELAYER), Stake::get() + 1); + let free_balance = Balances::free_balance(REGISTER_RELAYER); + + assert_ok!(Pallet::::register( + RuntimeOrigin::signed(REGISTER_RELAYER), + 150 + )); + assert_eq!(Balances::reserved_balance(REGISTER_RELAYER), Stake::get()); + assert_eq!(Balances::free_balance(REGISTER_RELAYER), free_balance + 1); + assert_eq!( + Pallet::::registered_relayer(REGISTER_RELAYER), + Some(Registration { valid_till: 150, stake: Stake::get() }), + ); + + assert_eq!( + System::::events().last(), + Some(&EventRecord { + phase: Phase::Initialization, + event: TestEvent::Relayers(Event::RegistrationUpdated { + relayer: REGISTER_RELAYER, + registration: Registration { valid_till: 150, stake: Stake::get() } + }), + topics: vec![], + }), + ); + }); + } + + #[test] + fn register_fails_if_it_cant_reserve_some_balance() { + run_test(|| { + Balances::set_balance(®ISTER_RELAYER, 0); + assert_noop!( + Pallet::::register(RuntimeOrigin::signed(REGISTER_RELAYER), 150), + Error::::FailedToReserve, + ); + }); + } + + #[test] + fn register_fails_if_it_cant_reserve_some_balance_if_required_stake_increases() { + run_test(|| { + RegisteredRelayers::::insert( + REGISTER_RELAYER, + Registration { valid_till: 150, stake: Stake::get() - 1 }, + ); + Balances::set_balance(®ISTER_RELAYER, 0); + + assert_noop!( + Pallet::::register(RuntimeOrigin::signed(REGISTER_RELAYER), 150), + Error::::FailedToReserve, + ); + }); + } + + #[test] + fn register_reserves_some_balance_if_required_stake_increases() { + run_test(|| { + get_ready_for_events(); + + RegisteredRelayers::::insert( + REGISTER_RELAYER, + Registration { valid_till: 150, stake: Stake::get() - 1 }, + ); + TestStakeAndSlash::reserve(®ISTER_RELAYER, Stake::get() - 1).unwrap(); + + let free_balance = Balances::free_balance(REGISTER_RELAYER); + assert_ok!(Pallet::::register( + RuntimeOrigin::signed(REGISTER_RELAYER), + 150 + )); + assert_eq!(Balances::reserved_balance(REGISTER_RELAYER), Stake::get()); + assert_eq!(Balances::free_balance(REGISTER_RELAYER), free_balance - 1); + assert_eq!( + Pallet::::registered_relayer(REGISTER_RELAYER), + Some(Registration { valid_till: 150, stake: Stake::get() }), + ); + + assert_eq!( + System::::events().last(), + Some(&EventRecord { + phase: Phase::Initialization, + event: TestEvent::Relayers(Event::RegistrationUpdated { + relayer: REGISTER_RELAYER, + registration: Registration { valid_till: 150, stake: Stake::get() } + }), + topics: vec![], + }), + ); + }); + } + + #[test] + fn deregister_fails_if_not_registered() { + run_test(|| { + assert_noop!( + Pallet::::deregister(RuntimeOrigin::signed(REGISTER_RELAYER)), + Error::::NotRegistered, + ); + }); + } + + #[test] + fn deregister_fails_if_registration_is_still_active() { + run_test(|| { + assert_ok!(Pallet::::register( + RuntimeOrigin::signed(REGISTER_RELAYER), + 150 + )); + + System::::set_block_number(100); + + assert_noop!( + Pallet::::deregister(RuntimeOrigin::signed(REGISTER_RELAYER)), + Error::::RegistrationIsStillActive, + ); + }); + } + + #[test] + fn deregister_works() { + run_test(|| { + get_ready_for_events(); + + assert_ok!(Pallet::::register( + RuntimeOrigin::signed(REGISTER_RELAYER), + 150 + )); + + System::::set_block_number(151); + + let reserved_balance = Balances::reserved_balance(REGISTER_RELAYER); + let free_balance = Balances::free_balance(REGISTER_RELAYER); + assert_ok!(Pallet::::deregister(RuntimeOrigin::signed(REGISTER_RELAYER))); + assert_eq!( + Balances::reserved_balance(REGISTER_RELAYER), + reserved_balance - Stake::get() + ); + assert_eq!(Balances::free_balance(REGISTER_RELAYER), free_balance + Stake::get()); + + assert_eq!( + System::::events().last(), + Some(&EventRecord { + phase: Phase::Initialization, + event: TestEvent::Relayers(Event::Deregistered { relayer: REGISTER_RELAYER }), + topics: vec![], + }), + ); + }); + } + + #[test] + fn is_registration_active_is_false_for_unregistered_relayer() { + run_test(|| { + assert!(!Pallet::::is_registration_active(®ISTER_RELAYER)); + }); + } + + #[test] + fn is_registration_active_is_false_when_stake_is_too_low() { + run_test(|| { + RegisteredRelayers::::insert( + REGISTER_RELAYER, + Registration { valid_till: 150, stake: Stake::get() - 1 }, + ); + assert!(!Pallet::::is_registration_active(®ISTER_RELAYER)); + }); + } + + #[test] + fn is_registration_active_is_false_when_remaining_lease_is_too_low() { + run_test(|| { + System::::set_block_number(150 - Lease::get()); + + RegisteredRelayers::::insert( + REGISTER_RELAYER, + Registration { valid_till: 150, stake: Stake::get() }, + ); + assert!(!Pallet::::is_registration_active(®ISTER_RELAYER)); + }); + } + + #[test] + fn is_registration_active_is_true_when_relayer_is_properly_registeered() { + run_test(|| { + System::::set_block_number(150 - Lease::get()); + + RegisteredRelayers::::insert( + REGISTER_RELAYER, + Registration { valid_till: 151, stake: Stake::get() }, + ); + assert!(Pallet::::is_registration_active(®ISTER_RELAYER)); + }); + } } diff --git a/bridges/modules/relayers/src/mock.rs b/bridges/modules/relayers/src/mock.rs index fe8c586eecc..69d8418a024 100644 --- a/bridges/modules/relayers/src/mock.rs +++ b/bridges/modules/relayers/src/mock.rs @@ -19,8 +19,10 @@ use crate as pallet_bridge_relayers; use bp_messages::LaneId; -use bp_relayers::{PaymentProcedure, RewardsAccountOwner, RewardsAccountParams}; -use frame_support::{parameter_types, weights::RuntimeDbWeight}; +use bp_relayers::{ + PayRewardFromAccount, PaymentProcedure, RewardsAccountOwner, RewardsAccountParams, +}; +use frame_support::{parameter_types, traits::fungible::Mutate, weights::RuntimeDbWeight}; use sp_core::H256; use sp_runtime::{ testing::Header as SubstrateHeader, @@ -29,6 +31,16 @@ use sp_runtime::{ pub type AccountId = u64; pub type Balance = u64; +pub type BlockNumber = u64; + +pub type TestStakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed< + AccountId, + BlockNumber, + Balances, + ReserveId, + Stake, + Lease, +>; type Block = frame_system::mocking::MockBlock; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; @@ -47,13 +59,17 @@ frame_support::construct_runtime! { parameter_types! { pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight { read: 1, write: 2 }; + pub const ExistentialDeposit: Balance = 1; + pub const ReserveId: [u8; 8] = *b"brdgrlrs"; + pub const Stake: Balance = 1_000; + pub const Lease: BlockNumber = 8; } impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; type Index = u64; type RuntimeCall = RuntimeCall; - type BlockNumber = u64; + type BlockNumber = BlockNumber; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; @@ -81,11 +97,11 @@ impl pallet_balances::Config for TestRuntime { type Balance = Balance; type DustRemoval = (); type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = frame_support::traits::ConstU64<1>; + type ExistentialDeposit = ExistentialDeposit; type AccountStore = frame_system::Pallet; type WeightInfo = (); - type MaxReserves = (); - type ReserveIdentifier = (); + type MaxReserves = ConstU32<1>; + type ReserveIdentifier = [u8; 8]; type HoldIdentifier = (); type FreezeIdentifier = (); type MaxHolds = ConstU32<0>; @@ -96,18 +112,22 @@ impl pallet_bridge_relayers::Config for TestRuntime { type RuntimeEvent = RuntimeEvent; type Reward = Balance; type PaymentProcedure = TestPaymentProcedure; + type StakeAndSlash = TestStakeAndSlash; type WeightInfo = (); } #[cfg(feature = "runtime-benchmarks")] impl pallet_bridge_relayers::benchmarking::Config for TestRuntime { - fn prepare_environment(account_params: RewardsAccountParams, reward: Balance) { - use frame_support::traits::fungible::Mutate; + fn prepare_rewards_account(account_params: RewardsAccountParams, reward: Balance) { let rewards_account = bp_relayers::PayRewardFromAccount::::rewards_account( account_params, ); - Balances::mint_into(&rewards_account, reward).unwrap(); + Self::deposit_account(rewards_account, reward); + } + + fn deposit_account(account: Self::AccountId, balance: Self::Reward) { + Balances::mint_into(&account, balance.saturating_add(ExistentialDeposit::get())).unwrap(); } } @@ -121,9 +141,18 @@ pub const REGULAR_RELAYER: AccountId = 1; /// Relayer that can't receive rewards. pub const FAILING_RELAYER: AccountId = 2; +/// Relayer that is able to register. +pub const REGISTER_RELAYER: AccountId = 42; + /// Payment procedure that rejects payments to the `FAILING_RELAYER`. pub struct TestPaymentProcedure; +impl TestPaymentProcedure { + pub fn rewards_account(params: RewardsAccountParams) -> AccountId { + PayRewardFromAccount::<(), AccountId>::rewards_account(params) + } +} + impl PaymentProcedure for TestPaymentProcedure { type Error = (); @@ -147,5 +176,10 @@ pub fn new_test_ext() -> sp_io::TestExternalities { /// Run pallet test. pub fn run_test(test: impl FnOnce() -> T) -> T { - new_test_ext().execute_with(test) + new_test_ext().execute_with(|| { + Balances::mint_into(®ISTER_RELAYER, ExistentialDeposit::get() + 10 * Stake::get()) + .unwrap(); + + test() + }) } diff --git a/bridges/modules/relayers/src/stake_adapter.rs b/bridges/modules/relayers/src/stake_adapter.rs new file mode 100644 index 00000000000..055b6a111ec --- /dev/null +++ b/bridges/modules/relayers/src/stake_adapter.rs @@ -0,0 +1,186 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Code that allows `NamedReservableCurrency` to be used as a `StakeAndSlash` +//! mechanism of the relayers pallet. + +use bp_relayers::{PayRewardFromAccount, RewardsAccountParams, StakeAndSlash}; +use codec::Codec; +use frame_support::traits::{tokens::BalanceStatus, NamedReservableCurrency}; +use sp_runtime::{traits::Get, DispatchError, DispatchResult}; +use sp_std::{fmt::Debug, marker::PhantomData}; + +/// `StakeAndSlash` that works with `NamedReservableCurrency` and uses named +/// reservations. +/// +/// **WARNING**: this implementation assumes that the relayers pallet is configured to +/// use the [`bp_relayers::PayRewardFromAccount`] as its relayers payment scheme. +pub struct StakeAndSlashNamed( + PhantomData<(AccountId, BlockNumber, Currency, ReserveId, Stake, Lease)>, +); + +impl + StakeAndSlash + for StakeAndSlashNamed +where + AccountId: Codec + Debug, + Currency: NamedReservableCurrency, + ReserveId: Get, + Stake: Get, + Lease: Get, +{ + type RequiredStake = Stake; + type RequiredRegistrationLease = Lease; + + fn reserve(relayer: &AccountId, amount: Currency::Balance) -> DispatchResult { + Currency::reserve_named(&ReserveId::get(), relayer, amount) + } + + fn unreserve(relayer: &AccountId, amount: Currency::Balance) -> Currency::Balance { + Currency::unreserve_named(&ReserveId::get(), relayer, amount) + } + + fn repatriate_reserved( + relayer: &AccountId, + beneficiary: RewardsAccountParams, + amount: Currency::Balance, + ) -> Result { + let beneficiary_account = + PayRewardFromAccount::<(), AccountId>::rewards_account(beneficiary); + Currency::repatriate_reserved_named( + &ReserveId::get(), + relayer, + &beneficiary_account, + amount, + BalanceStatus::Free, + ) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::mock::*; + + use frame_support::traits::fungible::Mutate; + + fn test_stake() -> Balance { + Stake::get() + } + + #[test] + fn reserve_works() { + run_test(|| { + assert!(TestStakeAndSlash::reserve(&1, test_stake()).is_err()); + assert_eq!(Balances::free_balance(1), 0); + assert_eq!(Balances::reserved_balance(1), 0); + + Balances::mint_into(&2, test_stake() - 1).unwrap(); + assert!(TestStakeAndSlash::reserve(&2, test_stake()).is_err()); + assert_eq!(Balances::free_balance(2), test_stake() - 1); + assert_eq!(Balances::reserved_balance(2), 0); + + Balances::mint_into(&3, test_stake() * 2).unwrap(); + assert_eq!(TestStakeAndSlash::reserve(&3, test_stake()), Ok(())); + assert_eq!(Balances::free_balance(3), test_stake()); + assert_eq!(Balances::reserved_balance(3), test_stake()); + }) + } + + #[test] + fn unreserve_works() { + run_test(|| { + assert_eq!(TestStakeAndSlash::unreserve(&1, test_stake()), test_stake()); + assert_eq!(Balances::free_balance(1), 0); + assert_eq!(Balances::reserved_balance(1), 0); + + Balances::mint_into(&2, test_stake() * 2).unwrap(); + TestStakeAndSlash::reserve(&2, test_stake() / 3).unwrap(); + assert_eq!( + TestStakeAndSlash::unreserve(&2, test_stake()), + test_stake() - test_stake() / 3 + ); + assert_eq!(Balances::free_balance(2), test_stake() * 2); + assert_eq!(Balances::reserved_balance(2), 0); + + Balances::mint_into(&3, test_stake() * 2).unwrap(); + TestStakeAndSlash::reserve(&3, test_stake()).unwrap(); + assert_eq!(TestStakeAndSlash::unreserve(&3, test_stake()), 0); + assert_eq!(Balances::free_balance(3), test_stake() * 2); + assert_eq!(Balances::reserved_balance(3), 0); + }) + } + + #[test] + fn repatriate_reserved_works() { + run_test(|| { + let beneficiary = TEST_REWARDS_ACCOUNT_PARAMS; + let beneficiary_account = TestPaymentProcedure::rewards_account(beneficiary); + + let mut expected_balance = ExistentialDeposit::get(); + Balances::mint_into(&beneficiary_account, expected_balance).unwrap(); + + assert_eq!( + TestStakeAndSlash::repatriate_reserved(&1, beneficiary, test_stake()), + Ok(test_stake()) + ); + assert_eq!(Balances::free_balance(1), 0); + assert_eq!(Balances::reserved_balance(1), 0); + assert_eq!(Balances::free_balance(beneficiary_account), expected_balance); + assert_eq!(Balances::reserved_balance(beneficiary_account), 0); + + expected_balance += test_stake() / 3; + Balances::mint_into(&2, test_stake() * 2).unwrap(); + TestStakeAndSlash::reserve(&2, test_stake() / 3).unwrap(); + assert_eq!( + TestStakeAndSlash::repatriate_reserved(&2, beneficiary, test_stake()), + Ok(test_stake() - test_stake() / 3) + ); + assert_eq!(Balances::free_balance(2), test_stake() * 2 - test_stake() / 3); + assert_eq!(Balances::reserved_balance(2), 0); + assert_eq!(Balances::free_balance(beneficiary_account), expected_balance); + assert_eq!(Balances::reserved_balance(beneficiary_account), 0); + + expected_balance += test_stake(); + Balances::mint_into(&3, test_stake() * 2).unwrap(); + TestStakeAndSlash::reserve(&3, test_stake()).unwrap(); + assert_eq!( + TestStakeAndSlash::repatriate_reserved(&3, beneficiary, test_stake()), + Ok(0) + ); + assert_eq!(Balances::free_balance(3), test_stake()); + assert_eq!(Balances::reserved_balance(3), 0); + assert_eq!(Balances::free_balance(beneficiary_account), expected_balance); + assert_eq!(Balances::reserved_balance(beneficiary_account), 0); + }) + } + + #[test] + fn repatriate_reserved_doesnt_work_when_beneficiary_account_is_missing() { + run_test(|| { + let beneficiary = TEST_REWARDS_ACCOUNT_PARAMS; + let beneficiary_account = TestPaymentProcedure::rewards_account(beneficiary); + + Balances::mint_into(&3, test_stake() * 2).unwrap(); + TestStakeAndSlash::reserve(&3, test_stake()).unwrap(); + assert!(TestStakeAndSlash::repatriate_reserved(&3, beneficiary, test_stake()).is_err()); + assert_eq!(Balances::free_balance(3), test_stake()); + assert_eq!(Balances::reserved_balance(3), test_stake()); + assert_eq!(Balances::free_balance(beneficiary_account), 0); + assert_eq!(Balances::reserved_balance(beneficiary_account), 0); + }); + } +} diff --git a/bridges/modules/relayers/src/weights.rs b/bridges/modules/relayers/src/weights.rs index 1f111aaf136..1bc195a5424 100644 --- a/bridges/modules/relayers/src/weights.rs +++ b/bridges/modules/relayers/src/weights.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for pallet_bridge_relayers //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -35,7 +35,7 @@ // --wasm-execution=Compiled // --heap-pages=4096 // --output=./modules/relayers/src/weights.rs -// --template=./.maintain/millau-weight-template.hbs +// --template=./.maintain/bridge-weight-template.hbs #![allow(clippy::all)] #![allow(unused_parens)] @@ -51,6 +51,10 @@ use sp_std::marker::PhantomData; /// Weight functions needed for pallet_bridge_relayers. pub trait WeightInfo { fn claim_rewards() -> Weight; + fn register() -> Weight; + fn deregister() -> Weight; + fn slash_and_deregister() -> Weight; + fn register_relayer_reward() -> Weight; } /// Weights for `pallet_bridge_relayers` that are generated using one of the Bridge testnets. @@ -63,19 +67,96 @@ impl WeightInfo for BridgeWeight { /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, /// mode: MaxEncodedLen) /// + /// Storage: Balances TotalIssuance (r:1 w:0) + /// + /// Proof: Balances TotalIssuance (max_values: Some(1), max_size: Some(8), added: 503, mode: + /// MaxEncodedLen) + /// /// Storage: System Account (r:1 w:1) /// - /// Proof: System Account (max_values: None, max_size: Some(96), added: 2571, mode: + /// Proof: System Account (max_values: None, max_size: Some(104), added: 2579, mode: /// MaxEncodedLen) fn claim_rewards() -> Weight { // Proof Size summary in bytes: - // Measured: `275` - // Estimated: `5111` - // Minimum execution time: 48_639 nanoseconds. - Weight::from_parts(49_600_000, 5111) + // Measured: `294` + // Estimated: `8592` + // Minimum execution time: 77_614 nanoseconds. + Weight::from_parts(79_987_000, 8592) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + fn register() -> Weight { + // Proof Size summary in bytes: + // Measured: `87` + // Estimated: `7843` + // Minimum execution time: 39_590 nanoseconds. + Weight::from_parts(40_546_000, 7843) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + fn deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `264` + // Estimated: `7843` + // Minimum execution time: 43_332 nanoseconds. + Weight::from_parts(45_087_000, 7843) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + /// + /// Storage: System Account (r:1 w:1) + /// + /// Proof: System Account (max_values: None, max_size: Some(104), added: 2579, mode: + /// MaxEncodedLen) + fn slash_and_deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `380` + // Estimated: `11412` + // Minimum execution time: 42_358 nanoseconds. + Weight::from_parts(43_539_000, 11412) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, + /// mode: MaxEncodedLen) + fn register_relayer_reward() -> Weight { + // Proof Size summary in bytes: + // Measured: `12` + // Estimated: `3530` + // Minimum execution time: 6_338 nanoseconds. + Weight::from_parts(6_526_000, 3530) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } // For backwards compatibility and tests @@ -85,17 +166,94 @@ impl WeightInfo for () { /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, /// mode: MaxEncodedLen) /// + /// Storage: Balances TotalIssuance (r:1 w:0) + /// + /// Proof: Balances TotalIssuance (max_values: Some(1), max_size: Some(8), added: 503, mode: + /// MaxEncodedLen) + /// /// Storage: System Account (r:1 w:1) /// - /// Proof: System Account (max_values: None, max_size: Some(96), added: 2571, mode: + /// Proof: System Account (max_values: None, max_size: Some(104), added: 2579, mode: /// MaxEncodedLen) fn claim_rewards() -> Weight { // Proof Size summary in bytes: - // Measured: `275` - // Estimated: `5111` - // Minimum execution time: 48_639 nanoseconds. - Weight::from_parts(49_600_000, 5111) + // Measured: `294` + // Estimated: `8592` + // Minimum execution time: 77_614 nanoseconds. + Weight::from_parts(79_987_000, 8592) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + fn register() -> Weight { + // Proof Size summary in bytes: + // Measured: `87` + // Estimated: `7843` + // Minimum execution time: 39_590 nanoseconds. + Weight::from_parts(40_546_000, 7843) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + fn deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `264` + // Estimated: `7843` + // Minimum execution time: 43_332 nanoseconds. + Weight::from_parts(45_087_000, 7843) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + /// + /// Storage: System Account (r:1 w:1) + /// + /// Proof: System Account (max_values: None, max_size: Some(104), added: 2579, mode: + /// MaxEncodedLen) + fn slash_and_deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `380` + // Estimated: `11412` + // Minimum execution time: 42_358 nanoseconds. + Weight::from_parts(43_539_000, 11412) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) + } + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, + /// mode: MaxEncodedLen) + fn register_relayer_reward() -> Weight { + // Proof Size summary in bytes: + // Measured: `12` + // Estimated: `3530` + // Minimum execution time: 6_338 nanoseconds. + Weight::from_parts(6_526_000, 3530) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) + } } diff --git a/bridges/modules/relayers/src/weights_ext.rs b/bridges/modules/relayers/src/weights_ext.rs new file mode 100644 index 00000000000..d459b0686bd --- /dev/null +++ b/bridges/modules/relayers/src/weights_ext.rs @@ -0,0 +1,49 @@ +// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Weight-related utilities. + +use crate::weights::WeightInfo; + +use frame_support::pallet_prelude::Weight; + +/// Extended weight info. +pub trait WeightInfoExt: WeightInfo { + /// Returns weight, that needs to be added to the pre-dispatch weight of message delivery call, + /// if `RefundBridgedParachainMessages` signed extension is deployed at runtime level. + fn receive_messages_proof_overhead_from_runtime() -> Weight { + Self::slash_and_deregister().max(Self::register_relayer_reward()) + } + + /// Returns weight, that needs to be added to the pre-dispatch weight of message delivery + /// confirmation call, if `RefundBridgedParachainMessages` signed extension is deployed at + /// runtime level. + fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight { + Self::register_relayer_reward() + } + + /// Returns weight that we need to deduct from the message delivery call weight that has + /// completed successfully. + /// + /// Usually, the weight of `slash_and_deregister` is larger than the weight of the + /// `register_relayer_reward`. So if relayer has been rewarded, we want to deduct the difference + /// to get the actual post-dispatch weight. + fn extra_weight_of_successful_receive_messages_proof_call() -> Weight { + Self::slash_and_deregister().saturating_sub(Self::register_relayer_reward()) + } +} + +impl WeightInfoExt for T {} diff --git a/bridges/primitives/header-chain/Cargo.toml b/bridges/primitives/header-chain/Cargo.toml index 5b9f87614a8..e0349ebc9b9 100644 --- a/bridges/primitives/header-chain/Cargo.toml +++ b/bridges/primitives/header-chain/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false } finality-grandpa = { version = "0.16.2", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } serde = { version = "1.0", optional = true } # Bridge dependencies diff --git a/bridges/primitives/messages/Cargo.toml b/bridges/primitives/messages/Cargo.toml index 32d7c65ebcb..32a89f6cf78 100644 --- a/bridges/primitives/messages/Cargo.toml +++ b/bridges/primitives/messages/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "bit-vec"] } -scale-info = { version = "2.5.0", default-features = false, features = ["bit-vec", "derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["bit-vec", "derive"] } serde = { version = "1.0", optional = true, features = ["derive"] } # Bridge dependencies diff --git a/bridges/primitives/messages/src/lib.rs b/bridges/primitives/messages/src/lib.rs index 2828d5af006..e485aa2f801 100644 --- a/bridges/primitives/messages/src/lib.rs +++ b/bridges/primitives/messages/src/lib.rs @@ -316,6 +316,21 @@ pub struct UnrewardedRelayersState { pub last_delivered_nonce: MessageNonce, } +impl From<&InboundLaneData> for UnrewardedRelayersState { + fn from(lane: &InboundLaneData) -> UnrewardedRelayersState { + UnrewardedRelayersState { + unrewarded_relayer_entries: lane.relayers.len() as _, + messages_in_oldest_entry: lane + .relayers + .front() + .and_then(|entry| (entry.messages.begin..=entry.messages.end).checked_len()) + .unwrap_or(0), + total_messages: total_unrewarded_messages(&lane.relayers).unwrap_or(MessageNonce::MAX), + last_delivered_nonce: lane.last_delivered_nonce(), + } + } +} + /// Outbound lane data. #[derive(Encode, Decode, Clone, RuntimeDebug, PartialEq, Eq, TypeInfo, MaxEncodedLen)] pub struct OutboundLaneData { diff --git a/bridges/primitives/messages/src/target_chain.rs b/bridges/primitives/messages/src/target_chain.rs index 8496b90214c..3c2e8cf0cb0 100644 --- a/bridges/primitives/messages/src/target_chain.rs +++ b/bridges/primitives/messages/src/target_chain.rs @@ -83,7 +83,7 @@ pub trait SourceHeaderChain { } /// Called when inbound message is received. -pub trait MessageDispatch { +pub trait MessageDispatch { /// Decoded message payload type. Valid message may contain invalid payload. In this case /// message is delivered, but dispatch fails. Therefore, two separate types of payload /// (opaque `MessagePayload` used in delivery and this `DispatchPayload` used in dispatch). @@ -103,11 +103,7 @@ pub trait MessageDispatch { /// /// It is up to the implementers of this trait to determine whether the message /// is invalid (i.e. improperly encoded, has too large weight, ...) or not. - /// - /// If your configuration allows paying dispatch fee at the target chain, then - /// it must be paid inside this method to the `relayer_account`. fn dispatch( - relayer_account: &AccountId, message: DispatchMessage, ) -> MessageDispatchResult; } @@ -186,7 +182,7 @@ impl SourceHeaderChain } } -impl MessageDispatch +impl MessageDispatch for ForbidInboundMessages { type DispatchPayload = DispatchPayload; @@ -197,7 +193,6 @@ impl MessageDispatch, ) -> MessageDispatchResult { MessageDispatchResult { unspent_weight: Weight::zero(), dispatch_level_result: () } diff --git a/bridges/primitives/parachains/Cargo.toml b/bridges/primitives/parachains/Cargo.toml index e47b8c5e68c..426597a2508 100644 --- a/bridges/primitives/parachains/Cargo.toml +++ b/bridges/primitives/parachains/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } impl-trait-for-tuples = "0.2" -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Bridge dependencies diff --git a/bridges/primitives/polkadot-core/Cargo.toml b/bridges/primitives/polkadot-core/Cargo.toml index daae99ec71c..56c6de04d41 100644 --- a/bridges/primitives/polkadot-core/Cargo.toml +++ b/bridges/primitives/polkadot-core/Cargo.toml @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive"] } parity-util-mem = { version = "0.12.0", optional = true } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] } # Bridge Dependencies diff --git a/bridges/primitives/relayers/Cargo.toml b/bridges/primitives/relayers/Cargo.toml index 8ac31258488..b84b0393adf 100644 --- a/bridges/primitives/relayers/Cargo.toml +++ b/bridges/primitives/relayers/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0-or-later WITH Classpath-exception-2.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false, features = ["derive", "bit-vec"] } -scale-info = { version = "2.5.0", default-features = false, features = ["bit-vec", "derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["bit-vec", "derive"] } # Bridge Dependencies diff --git a/bridges/primitives/relayers/src/lib.rs b/bridges/primitives/relayers/src/lib.rs index f14b841fa9e..21f66a2ffa1 100644 --- a/bridges/primitives/relayers/src/lib.rs +++ b/bridges/primitives/relayers/src/lib.rs @@ -19,6 +19,8 @@ #![warn(missing_docs)] #![cfg_attr(not(feature = "std"), no_std)] +pub use registration::{Registration, StakeAndSlash}; + use bp_messages::LaneId; use bp_runtime::{ChainId, StorageDoubleMapKeyProvider}; use frame_support::{traits::tokens::Preservation, Blake2_128Concat, Identity}; @@ -30,6 +32,8 @@ use sp_runtime::{ }; use sp_std::{fmt::Debug, marker::PhantomData}; +mod registration; + /// The owner of the sovereign account that should pay the rewards. /// /// Each of the 2 final points connected by a bridge owns a sovereign account at each end of the diff --git a/bridges/primitives/relayers/src/registration.rs b/bridges/primitives/relayers/src/registration.rs new file mode 100644 index 00000000000..7ab20844bdf --- /dev/null +++ b/bridges/primitives/relayers/src/registration.rs @@ -0,0 +1,121 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Parity Bridges Common. + +// Parity Bridges Common is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Parity Bridges Common is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Parity Bridges Common. If not, see . + +//! Bridge relayers registration and slashing scheme. +//! +//! There is an option to add a refund-relayer signed extension that will compensate +//! relayer costs of the message delivery and confirmation transactions (as well as +//! required finality proofs). This extension boosts priority of message delivery +//! transactions, based on the number of bundled messages. So transaction with more +//! messages has larger priority than the transaction with less messages. +//! See `bridge_runtime_common::priority_calculator` for details; +//! +//! This encourages relayers to include more messages to their delivery transactions. +//! At the same time, we are not verifying storage proofs before boosting +//! priority. Instead, we simply trust relayer, when it says that transaction delivers +//! `N` messages. +//! +//! This allows relayers to submit transactions which declare large number of bundled +//! transactions to receive priority boost for free, potentially pushing actual delivery +//! transactions from the block (or even transaction queue). Such transactions are +//! not free, but their cost is relatively small. +//! +//! To alleviate that, we only boost transactions of relayers that have some stake +//! that guarantees that their transactions are valid. Such relayers get priority +//! for free, but they risk to lose their stake. + +use crate::RewardsAccountParams; + +use codec::{Decode, Encode, MaxEncodedLen}; +use scale_info::TypeInfo; +use sp_runtime::{ + traits::{Get, Zero}, + DispatchError, DispatchResult, +}; + +/// Relayer registration. +#[derive(Copy, Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo, MaxEncodedLen)] +pub struct Registration { + /// The last block number, where this registration is considered active. + /// + /// Relayer has an option to renew his registration (this may be done before it + /// is spoiled as well). Starting from block `valid_till + 1`, relayer may `deregister` + /// himself and get his stake back. + /// + /// Please keep in mind that priority boost stops working some blocks before the + /// registration ends (see [`StakeAndSlash::RequiredRegistrationLease`]). + pub valid_till: BlockNumber, + /// Active relayer stake, which is mapped to the relayer reserved balance. + /// + /// If `stake` is less than the [`StakeAndSlash::RequiredStake`], the registration + /// is considered inactive even if `valid_till + 1` is not yet reached. + pub stake: Balance, +} + +/// Relayer stake-and-slash mechanism. +pub trait StakeAndSlash { + /// The stake that the relayer must have to have its transactions boosted. + type RequiredStake: Get; + /// Required **remaining** registration lease to be able to get transaction priority boost. + /// + /// If the difference between registration's `valid_till` and the current block number + /// is less than the `RequiredRegistrationLease`, it becomes inactive and relayer transaction + /// won't get priority boost. This period exists, because priority is calculated when + /// transaction is placed to the queue (and it is reevaluated periodically) and then some time + /// may pass before transaction will be included into the block. + type RequiredRegistrationLease: Get; + + /// Reserve the given amount at relayer account. + fn reserve(relayer: &AccountId, amount: Balance) -> DispatchResult; + /// `Unreserve` the given amount from relayer account. + /// + /// Returns amount that we have failed to `unreserve`. + fn unreserve(relayer: &AccountId, amount: Balance) -> Balance; + /// Slash up to `amount` from reserved balance of account `relayer` and send funds to given + /// `beneficiary`. + /// + /// Returns `Ok(_)` with non-zero balance if we have failed to repatriate some portion of stake. + fn repatriate_reserved( + relayer: &AccountId, + beneficiary: RewardsAccountParams, + amount: Balance, + ) -> Result; +} + +impl StakeAndSlash for () +where + Balance: Default + Zero, + BlockNumber: Default, +{ + type RequiredStake = (); + type RequiredRegistrationLease = (); + + fn reserve(_relayer: &AccountId, _amount: Balance) -> DispatchResult { + Ok(()) + } + + fn unreserve(_relayer: &AccountId, _amount: Balance) -> Balance { + Zero::zero() + } + + fn repatriate_reserved( + _relayer: &AccountId, + _beneficiary: RewardsAccountParams, + _amount: Balance, + ) -> Result { + Ok(Zero::zero()) + } +} diff --git a/bridges/primitives/runtime/Cargo.toml b/bridges/primitives/runtime/Cargo.toml index 4d48ad61894..694ff4e1aa6 100644 --- a/bridges/primitives/runtime/Cargo.toml +++ b/bridges/primitives/runtime/Cargo.toml @@ -11,7 +11,7 @@ codec = { package = "parity-scale-codec", version = "3.1.5", default-features = hash-db = { version = "0.16.0", default-features = false } impl-trait-for-tuples = "0.2.2" num-traits = { version = "0.2", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } serde = { version = "1.0", optional = true, features = ["derive"] } # Substrate Dependencies diff --git a/bridges/scripts/verify-pallets-build.sh b/bridges/scripts/verify-pallets-build.sh index ad69c5df008..dfee5341673 100755 --- a/bridges/scripts/verify-pallets-build.sh +++ b/bridges/scripts/verify-pallets-build.sh @@ -81,6 +81,7 @@ rm -rf $BRIDGES_FOLDER/scripts/build-containers.sh rm -rf $BRIDGES_FOLDER/scripts/ci-cache.sh rm -rf $BRIDGES_FOLDER/scripts/dump-logs.sh rm -rf $BRIDGES_FOLDER/scripts/license_header +rm -rf $BRIDGES_FOLDER/scripts/regenerate_runtimes.sh rm -rf $BRIDGES_FOLDER/scripts/send-message-from-millau-rialto.sh rm -rf $BRIDGES_FOLDER/scripts/send-message-from-rialto-millau.sh rm -rf $BRIDGES_FOLDER/scripts/update-weights.sh @@ -93,6 +94,7 @@ rm -f $BRIDGES_FOLDER/.gitlab-ci.yml rm -f $BRIDGES_FOLDER/.editorconfig rm -f $BRIDGES_FOLDER/Cargo.toml rm -f $BRIDGES_FOLDER/ci.Dockerfile +rm -f $BRIDGES_FOLDER/CODEOWNERS rm -f $BRIDGES_FOLDER/Dockerfile # let's fix Cargo.toml a bit (it'll be helpful if we are in the bridges repo) diff --git a/client/cli/Cargo.toml b/client/cli/Cargo.toml index 68f8b472cf2..b6a8804a4a4 100644 --- a/client/cli/Cargo.toml +++ b/client/cli/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Parity Technologies "] edition = "2021" [dependencies] -clap = { version = "4.1.14", features = ["derive"] } +clap = { version = "4.2.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } url = "2.3.1" diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 294527f1f9f..3576ced1858 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -15,13 +15,15 @@ // along with Cumulus. If not, see . use sc_client_api::{blockchain::Backend as _, Backend, HeaderBackend as _}; -use sp_blockchain::{HashAndNumber, TreeRoute}; +use sp_blockchain::{HashAndNumber, HeaderMetadata, TreeRoute}; use sp_runtime::traits::{Block as BlockT, NumberFor, One, Saturating, UniqueSaturatedInto, Zero}; use std::{ collections::{HashMap, HashSet}, sync::Arc, }; +const LOG_TARGET: &'static str = "level-monitor"; + /// Value good enough to be used with parachains using the current backend implementation /// that ships with Substrate. This value may change in the future. pub const MAX_LEAVES_PER_LEVEL_SENSIBLE_DEFAULT: usize = 32; @@ -48,17 +50,17 @@ pub enum LevelLimit { /// Support structure to constrain the number of leaves at each level. pub struct LevelMonitor { - // Max number of leaves for each level. + /// Max number of leaves for each level. level_limit: usize, - // Monotonic counter used to keep track of block freshness. + /// Monotonic counter used to keep track of block freshness. pub(crate) import_counter: NumberFor, - // Map between blocks hashes and freshness. + /// Map between blocks hashes and freshness. pub(crate) freshness: HashMap>, - // Blockchain levels cache. + /// Blockchain levels cache. pub(crate) levels: HashMap, HashSet>, - // Lower level number stored by the levels map. + /// Lower level number stored by the levels map. lowest_level: NumberFor, - // Backend reference to remove blocks on level saturation. + /// Backend reference to remove blocks on level saturation. backend: Arc, } @@ -96,39 +98,40 @@ where /// /// Level limits are not enforced during this phase. fn restore(&mut self) { + const ERR_MSG: &str = "route from finalized to leaf should be available; qed"; let info = self.backend.blockchain().info(); + log::debug!( - target: "parachain", + target: LOG_TARGET, "Restoring chain level monitor from last finalized block: {} {}", - info.finalized_number, info.finalized_hash + info.finalized_number, + info.finalized_hash ); self.lowest_level = info.finalized_number; self.import_counter = info.finalized_number; - self.block_imported(info.finalized_number, info.finalized_hash); - - let mut counter_max = info.finalized_number; for leaf in self.backend.blockchain().leaves().unwrap_or_default() { - let route = - sp_blockchain::tree_route(self.backend.blockchain(), info.finalized_hash, leaf) - .expect("Route from finalized to leaf should be available; qed"); - if !route.retracted().is_empty() { - continue - } - route.enacted().iter().for_each(|elem| { - if !self.freshness.contains_key(&elem.hash) { - // Use the block height value as the freshness. - self.import_counter = elem.number; - self.block_imported(elem.number, elem.hash); + let mut meta = self.backend.blockchain().header_metadata(leaf).expect(ERR_MSG); + + self.import_counter = self.import_counter.max(meta.number); + + // Populate the monitor until we don't hit an already imported branch + while !self.freshness.contains_key(&meta.hash) { + self.freshness.insert(meta.hash, meta.number); + self.levels.entry(meta.number).or_default().insert(meta.hash); + if meta.number <= self.lowest_level { + break } - }); - counter_max = std::cmp::max(self.import_counter, counter_max); + meta = self.backend.blockchain().header_metadata(meta.parent).expect(ERR_MSG); + } } - log::debug!(target: "parachain", "Restored chain level monitor up to height {}", counter_max); - - self.import_counter = counter_max; + log::debug!( + target: LOG_TARGET, + "Restored chain level monitor up to height {}", + self.import_counter + ); } /// Check and enforce the limit bound at the given height. @@ -165,7 +168,7 @@ where let remove_count = level_len - self.level_limit + 1; log::debug!( - target: "parachain", + target: LOG_TARGET, "Detected leaves overflow at height {number}, removing {remove_count} obsolete blocks", ); @@ -228,9 +231,11 @@ where }), Err(err) => { log::warn!( - target: "parachain", + target: LOG_TARGET, "(Lookup) Unable getting route from {:?} to {:?}: {}", - blk_hash, leaf_hash, err, + blk_hash, + leaf_hash, + err, ); None }, @@ -247,7 +252,7 @@ where None => { // This should never happen log::error!( - target: "parachain", + target: LOG_TARGET, "Unable getting route to any leaf from {:?} (this is a bug)", blk_hash, ); @@ -298,9 +303,9 @@ where invalidated_leaves: &mut HashSet, ) { let mut remove_leaf = |number, hash| { - log::debug!(target: "parachain", "Removing block (@{}) {:?}", number, hash); + log::debug!(target: LOG_TARGET, "Removing block (@{}) {:?}", number, hash); if let Err(err) = self.backend.remove_leaf_block(hash) { - log::debug!(target: "parachain", "Remove not possible for {}: {}", hash, err); + log::debug!(target: LOG_TARGET, "Remove not possible for {}: {}", hash, err); return false } self.levels.get_mut(&number).map(|level| level.remove(&hash)); @@ -341,9 +346,11 @@ where }, Err(err) => { log::warn!( - target: "parachain", + target: LOG_TARGET, "(Removal) unable getting route from {:?} to {:?}: {}", - target_hash, leaf_hash, err, + target_hash, + leaf_hash, + err, ); }, _ => (), @@ -355,9 +362,9 @@ where /// Add a new imported block information to the monitor. pub fn block_imported(&mut self, number: NumberFor, hash: Block::Hash) { + self.import_counter += One::one(); self.freshness.insert(hash, self.import_counter); self.levels.entry(number).or_default().insert(hash); - self.import_counter += One::one(); // Do cleanup once in a while, we are allowed to have some obsolete information. let finalized_num = self.backend.blockchain().info().finalized_number; diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index e44c26e85d1..23516d96388 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -765,6 +765,12 @@ fn restore_limit_monitor() { LevelLimit::Some(LEVEL_LIMIT), ); + let monitor_sd = para_import.monitor.clone().unwrap(); + + let monitor = monitor_sd.shared_data(); + assert_eq!(monitor.import_counter, 3); + std::mem::drop(monitor); + let block13 = build_and_import_block_ext( &*client, BlockOrigin::Own, @@ -783,14 +789,13 @@ fn restore_limit_monitor() { let expected = vec![blocks1[1].header.hash(), block13.header.hash()]; assert_eq!(leaves, expected); - let monitor = para_import.monitor.unwrap(); - let monitor = monitor.shared_data(); - assert_eq!(monitor.import_counter, 5); + let monitor = monitor_sd.shared_data(); + assert_eq!(monitor.import_counter, 4); assert!(monitor.levels.iter().all(|(number, hashes)| { hashes .iter() .filter(|hash| **hash != block13.header.hash()) .all(|hash| *number == *monitor.freshness.get(hash).unwrap()) })); - assert_eq!(*monitor.freshness.get(&block13.header.hash()).unwrap(), monitor.import_counter - 1); + assert_eq!(*monitor.freshness.get(&block13.header.hash()).unwrap(), monitor.import_counter); } diff --git a/client/network/src/lib.rs b/client/network/src/lib.rs index 5a2043ab5f7..0c15ab3add5 100644 --- a/client/network/src/lib.rs +++ b/client/network/src/lib.rs @@ -303,9 +303,9 @@ where Ok(Validation::Success { is_new_best: true }) } else if block_number >= known_best_number { tracing::debug!( - target: LOG_TARGET, - "Validation failed because a justification is needed if the block at the top of the chain." - ); + target: LOG_TARGET, + "Validation failed because a justification is needed if the block at the top of the chain." + ); Ok(Validation::Failure { disconnect: false }) } else { diff --git a/client/pov-recovery/src/lib.rs b/client/pov-recovery/src/lib.rs index 60fbdab310c..7d92934c784 100644 --- a/client/pov-recovery/src/lib.rs +++ b/client/pov-recovery/src/lib.rs @@ -47,7 +47,7 @@ use sc_client_api::{BlockBackend, BlockchainEvents, UsageProvider}; use sc_consensus::import_queue::{ImportQueueService, IncomingBlock}; -use sp_consensus::{BlockOrigin, BlockStatus}; +use sp_consensus::{BlockOrigin, BlockStatus, SyncOracle}; use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor}; use polkadot_node_primitives::{AvailableData, POV_BOMB_LIMIT}; @@ -228,6 +228,7 @@ pub struct PoVRecovery { recovery_chan_rx: Receiver>, /// Blocks that we are retrying currently candidates_in_retry: HashSet, + parachain_sync_service: Arc, } impl PoVRecovery @@ -244,6 +245,7 @@ where relay_chain_interface: RCInterface, para_id: ParaId, recovery_chan_rx: Receiver>, + parachain_sync_service: Arc, ) -> Self { Self { candidates: HashMap::new(), @@ -256,6 +258,7 @@ where para_id, candidates_in_retry: HashSet::new(), recovery_chan_rx, + parachain_sync_service, } } @@ -538,14 +541,19 @@ where pub async fn run(mut self) { let mut imported_blocks = self.parachain_client.import_notification_stream().fuse(); let mut finalized_blocks = self.parachain_client.finality_notification_stream().fuse(); - let pending_candidates = - match pending_candidates(self.relay_chain_interface.clone(), self.para_id).await { - Ok(pending_candidate_stream) => pending_candidate_stream.fuse(), - Err(err) => { - tracing::error!(target: LOG_TARGET, error = ?err, "Unable to retrieve pending candidate stream."); - return - }, - }; + let pending_candidates = match pending_candidates( + self.relay_chain_interface.clone(), + self.para_id, + self.parachain_sync_service.clone(), + ) + .await + { + Ok(pending_candidate_stream) => pending_candidate_stream.fuse(), + Err(err) => { + tracing::error!(target: LOG_TARGET, error = ?err, "Unable to retrieve pending candidate stream."); + return + }, + }; futures::pin_mut!(pending_candidates); @@ -600,13 +608,24 @@ where async fn pending_candidates( relay_chain_client: impl RelayChainInterface + Clone, para_id: ParaId, + sync_service: Arc, ) -> RelayChainResult> { let import_notification_stream = relay_chain_client.import_notification_stream().await?; let filtered_stream = import_notification_stream.filter_map(move |n| { let client_for_closure = relay_chain_client.clone(); + let sync_oracle = sync_service.clone(); async move { let hash = n.hash(); + if sync_oracle.is_major_syncing() { + tracing::debug!( + target: LOG_TARGET, + relay_hash = ?hash, + "Skipping candidate due to sync.", + ); + return None + } + let pending_availability_result = client_for_closure .candidate_pending_availability(hash, para_id) .await diff --git a/client/relay-chain-minimal-node/src/collator_overseer.rs b/client/relay-chain-minimal-node/src/collator_overseer.rs index bd3dfa8e0f8..a2ad87fa758 100644 --- a/client/relay-chain-minimal-node/src/collator_overseer.rs +++ b/client/relay-chain-minimal-node/src/collator_overseer.rs @@ -99,7 +99,7 @@ fn build_overseer<'a>( let network_bridge_metrics: NetworkBridgeMetrics = Metrics::register(registry)?; let builder = Overseer::builder() .availability_distribution(DummySubsystem) - .availability_recovery(AvailabilityRecoverySubsystem::with_chunks_only( + .availability_recovery(AvailabilityRecoverySubsystem::with_availability_store_skip( available_data_req_receiver, Metrics::register(registry)?, )) diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 6f0d5790586..894db91ba8f 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -70,6 +70,7 @@ pub struct StartCollatorParams<'a, Block: BlockT, BS, Client, RCInterface, Spawn pub collator_key: CollatorPair, pub relay_chain_slot_duration: Duration, pub recovery_handle: Box, + pub sync_service: Arc>, } /// Start a collator node for a parachain. @@ -91,6 +92,7 @@ pub async fn start_collator<'a, Block, BS, Client, Backend, RCInterface, Spawner collator_key, relay_chain_slot_duration, recovery_handle, + sync_service, }: StartCollatorParams<'a, Block, BS, Client, RCInterface, Spawner>, ) -> sc_service::error::Result<()> where @@ -123,7 +125,7 @@ where task_manager .spawn_essential_handle() - .spawn("cumulus-consensus", None, consensus); + .spawn_blocking("cumulus-consensus", None, consensus); let pov_recovery = PoVRecovery::new( recovery_handle, @@ -136,6 +138,7 @@ where relay_chain_interface.clone(), para_id, recovery_chan_rx, + sync_service, ); task_manager @@ -170,6 +173,7 @@ pub struct StartFullNodeParams<'a, Block: BlockT, Client, RCInterface> { pub relay_chain_slot_duration: Duration, pub import_queue: Box>, pub recovery_handle: Box, + pub sync_service: Arc>, } /// Start a full node for a parachain. @@ -186,6 +190,7 @@ pub fn start_full_node( relay_chain_slot_duration, import_queue, recovery_handle, + sync_service, }: StartFullNodeParams, ) -> sc_service::error::Result<()> where @@ -213,7 +218,7 @@ where task_manager .spawn_essential_handle() - .spawn("cumulus-consensus", None, consensus); + .spawn_blocking("cumulus-consensus", None, consensus); let pov_recovery = PoVRecovery::new( recovery_handle, @@ -231,6 +236,7 @@ where relay_chain_interface, para_id, recovery_chan_rx, + sync_service, ); task_manager diff --git a/pallets/aura-ext/Cargo.toml b/pallets/aura-ext/Cargo.toml index 1db43697511..6c890eeceb0 100644 --- a/pallets/aura-ext/Cargo.toml +++ b/pallets/aura-ext/Cargo.toml @@ -7,7 +7,7 @@ description = "AURA consensus extension pallet for parachains" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/pallets/parachain-system/src/validate_block/implementation.rs b/pallets/parachain-system/src/validate_block/implementation.rs index cc85a2e1161..f953dfc77c5 100644 --- a/pallets/parachain-system/src/validate_block/implementation.rs +++ b/pallets/parachain-system/src/validate_block/implementation.rs @@ -236,7 +236,7 @@ where .expect("Could not find `set_validation_data` inherent") } -/// Validate the given [`PersistedValidationData`] against the [`ValidationParams`]. +/// Validate the given [`PersistedValidationData`] against the [`MemoryOptimizedValidationParams`]. fn validate_validation_data( validation_data: &PersistedValidationData, relay_parent_number: RelayChainBlockNumber, diff --git a/parachain-template/node/src/service.rs b/parachain-template/node/src/service.rs index 6fc04ef91d5..4c9e1febf70 100644 --- a/parachain-template/node/src/service.rs +++ b/parachain-template/node/src/service.rs @@ -271,7 +271,7 @@ async fn start_node_impl( &task_manager, relay_chain_interface.clone(), transaction_pool, - sync_service, + sync_service.clone(), params.keystore_container.keystore(), force_authoring, para_id, @@ -291,6 +291,7 @@ async fn start_node_impl( collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_collator(params).await?; @@ -304,6 +305,7 @@ async fn start_node_impl( relay_chain_slot_duration, import_queue: import_queue_service, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_full_node(params)?; diff --git a/parachain-template/runtime/src/xcm_config.rs b/parachain-template/runtime/src/xcm_config.rs index b82be7aebf0..bd395c83d38 100644 --- a/parachain-template/runtime/src/xcm_config.rs +++ b/parachain-template/runtime/src/xcm_config.rs @@ -5,20 +5,20 @@ use super::{ use core::{marker::PhantomData, ops::ControlFlow}; use frame_support::{ log, match_types, parameter_types, - traits::{ConstU32, Everything, Nothing}, + traits::{ConstU32, Everything, Nothing, ProcessMessageError}, weights::Weight, }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; use polkadot_parachain::primitives::Sibling; use polkadot_runtime_common::impls::ToAuthor; -use xcm::{latest::prelude::*, CreateMatcher, MatchXcm}; +use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowTopLevelPaidExecutionFrom, - CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, NativeAsset, ParentIsPreset, - RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, - SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, - UsingComponents, WithComputedOrigin, + CreateMatcher, CurrencyAdapter, EnsureXcmOrigin, FixedWeightBounds, IsConcrete, MatchXcm, + NativeAsset, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, + SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, + SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin, }; use xcm_executor::{traits::ShouldExecute, XcmExecutor}; @@ -108,7 +108,7 @@ where message: &mut [Instruction], max_weight: Weight, weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), ProcessMessageError> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) } @@ -122,7 +122,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { message: &mut [Instruction], _max_weight: Weight, _weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), ProcessMessageError> { message.matcher().match_next_inst_while( |_| true, |inst| match inst { @@ -136,7 +136,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { TransferReserveAsset { dest: MultiLocation { parents: 1, interior: Here }, .. } => { - Err(()) // Deny + Err(ProcessMessageError::Unsupported) // Deny }, // An unexpected reserve transfer has arrived from the Relay Chain. Generally, // `IsReserve` should not allow this, but we just log it here. diff --git a/parachains/chain-specs/bridge-hub-rococo.json b/parachains/chain-specs/bridge-hub-rococo.json index 6bc55f916b7..ff20d8fb482 100644 --- a/parachains/chain-specs/bridge-hub-rococo.json +++ b/parachains/chain-specs/bridge-hub-rococo.json @@ -3,14 +3,10 @@ "id": "bridge-hub-rococo", "chainType": "Live", "bootNodes": [ - "/dns/rococo-bridge-hub-collator-0.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWNARtf7sSXKHsdzHctSZYaPMskTw3fVFbBoRK4Joc1KqY", - "/dns/rococo-bridge-hub-collator-1.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWB4E9XQFHerwn3HH2biX6cBkMu6pkkVieMoSGfmMHZsFv", - "/dns/rococo-bridge-hub-collator-2.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWHC2RcMS8sHjicdS9FMTy1XDWvyZDQRut6TwxyWpBMUo3", - "/dns/rococo-bridge-hub-collator-3.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWP3E4oQUh8XejaubDZKoD1bNapu7UEvPc3cCfsNdQngSq", - "/dns/rococo-bridge-hub-collator-0.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWNARtf7sSXKHsdzHctSZYaPMskTw3fVFbBoRK4Joc1KqY", - "/dns/rococo-bridge-hub-collator-1.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWB4E9XQFHerwn3HH2biX6cBkMu6pkkVieMoSGfmMHZsFv", - "/dns/rococo-bridge-hub-collator-2.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWHC2RcMS8sHjicdS9FMTy1XDWvyZDQRut6TwxyWpBMUo3", - "/dns/rococo-bridge-hub-collator-3.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWP3E4oQUh8XejaubDZKoD1bNapu7UEvPc3cCfsNdQngSq" + "/dns/rococo-bridge-hub-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWJCFBJmFF65xz5xHeZQRSCf35BxfSEB3RHQFoLza28LWU", + "/dns/rococo-bridge-hub-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWJzLd8skcAgA24EcJey7aJAhYctfUxWGjSP5Usk9wbpPZ", + "/dns/rococo-bridge-hub-collator-node-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPZLWbbDJzEXAHPuAcVssPrjQLyZK4nvvmV2ez6gy2FQ3", + "/dns/rococo-bridge-hub-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKWMENpCNH7wBVQoHLwQoWUs6acAEmfdV694v9jCuJwYc" ], "telemetryEndpoints": null, "protocolId": null, diff --git a/parachains/chain-specs/bridge-hub-wococo.json b/parachains/chain-specs/bridge-hub-wococo.json index dd02842f2f4..7024789b8cc 100644 --- a/parachains/chain-specs/bridge-hub-wococo.json +++ b/parachains/chain-specs/bridge-hub-wococo.json @@ -3,14 +3,10 @@ "id": "bridge-hub-wococo", "chainType": "Live", "bootNodes": [ - "/dns/wococo-bridge-hub-collator-0.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWCNomXYZWuhwHsWhZpmrFmswEG8W89UY9NjEGExM38yCr", - "/dns/wococo-bridge-hub-collator-1.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWKSq37RLqP3Ws3FtJDYB1xsjoBeJmehVYDZcCDRNLBXas", - "/dns/wococo-bridge-hub-collator-2.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWDkSQzQYC7VwpJKF8VJtJZMG8bcvWXm1UEJSKk8UE2iv5", - "/dns/wococo-bridge-hub-collator-3.parity-testnet.parity.io/tcp/30334/p2p/12D3KooWQoUFxyPbpotTdUpfnsxQfQ4uyxz1beW5Z39LGM8JPhLi", - "/dns/wococo-bridge-hub-collator-0.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWCNomXYZWuhwHsWhZpmrFmswEG8W89UY9NjEGExM38yCr", - "/dns/wococo-bridge-hub-collator-1.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWKSq37RLqP3Ws3FtJDYB1xsjoBeJmehVYDZcCDRNLBXas", - "/dns/wococo-bridge-hub-collator-2.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWDkSQzQYC7VwpJKF8VJtJZMG8bcvWXm1UEJSKk8UE2iv5", - "/dns/wococo-bridge-hub-collator-3.parity-testnet.parity.io/tcp/443/wss/p2p/12D3KooWQoUFxyPbpotTdUpfnsxQfQ4uyxz1beW5Z39LGM8JPhLi" + "/dns/wococo-bridge-hub-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWCNomXYZWuhwHsWhZpmrFmswEG8W89UY9NjEGExM38yCr", + "/dns/wococo-bridge-hub-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKSq37RLqP3Ws3FtJDYB1xsjoBeJmehVYDZcCDRNLBXas", + "/dns/wococo-bridge-hub-collator-node-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWDkSQzQYC7VwpJKF8VJtJZMG8bcvWXm1UEJSKk8UE2iv5", + "/dns/wococo-bridge-hub-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWQoUFxyPbpotTdUpfnsxQfQ4uyxz1beW5Z39LGM8JPhLi" ], "telemetryEndpoints": null, "protocolId": null, diff --git a/parachains/common/src/xcm_config.rs b/parachains/common/src/xcm_config.rs index d367fd4d1a1..61e6f389e6d 100644 --- a/parachains/common/src/xcm_config.rs +++ b/parachains/common/src/xcm_config.rs @@ -2,11 +2,14 @@ use crate::impls::AccountIdOf; use core::{marker::PhantomData, ops::ControlFlow}; use frame_support::{ log, - traits::{fungibles::Inspect, tokens::ConversionToAssetBalance, ContainsPair}, + traits::{ + fungibles::Inspect, tokens::ConversionToAssetBalance, ContainsPair, ProcessMessageError, + }, weights::Weight, }; use sp_runtime::traits::Get; -use xcm::{latest::prelude::*, CreateMatcher, MatchXcm}; +use xcm::latest::prelude::*; +use xcm_builder::{CreateMatcher, MatchXcm}; use xcm_executor::traits::ShouldExecute; //TODO: move DenyThenTry to polkadot's xcm module. @@ -27,7 +30,7 @@ where message: &mut [Instruction], max_weight: Weight, weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), ProcessMessageError> { Deny::should_execute(origin, message, max_weight, weight_credit)?; Allow::should_execute(origin, message, max_weight, weight_credit) } @@ -41,7 +44,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { message: &mut [Instruction], _max_weight: Weight, _weight_credit: &mut Weight, - ) -> Result<(), ()> { + ) -> Result<(), ProcessMessageError> { message.matcher().match_next_inst_while( |_| true, |inst| match inst { @@ -55,7 +58,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain { TransferReserveAsset { dest: MultiLocation { parents: 1, interior: Here }, .. } => { - Err(()) // Deny + Err(ProcessMessageError::Unsupported) // Deny }, // An unexpected reserve transfer has arrived from the Relay Chain. Generally, diff --git a/parachains/pallets/parachain-info/Cargo.toml b/parachains/pallets/parachain-info/Cargo.toml index 3d706e35e8e..7ff346fe24b 100644 --- a/parachains/pallets/parachain-info/Cargo.toml +++ b/parachains/pallets/parachain-info/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/pallets/ping/Cargo.toml b/parachains/pallets/ping/Cargo.toml index 1dd218ccc79..b705a9a2f10 100644 --- a/parachains/pallets/ping/Cargo.toml +++ b/parachains/pallets/ping/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/assets/common/Cargo.toml b/parachains/runtimes/assets/common/Cargo.toml index 69f56a2405e..303b0bd9c64 100644 --- a/parachains/runtimes/assets/common/Cargo.toml +++ b/parachains/runtimes/assets/common/Cargo.toml @@ -7,7 +7,7 @@ description = "Assets common utilities" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } log = { version = "0.4.17", default-features = false } # Substrate diff --git a/parachains/runtimes/assets/common/src/runtime_api.rs b/parachains/runtimes/assets/common/src/runtime_api.rs index 36a8df1271e..ceb8bc13fcc 100644 --- a/parachains/runtimes/assets/common/src/runtime_api.rs +++ b/parachains/runtimes/assets/common/src/runtime_api.rs @@ -31,11 +31,16 @@ pub enum FungiblesAccessError { sp_api::decl_runtime_apis! { /// The API for querying account's balances from runtime. + #[api_version(2)] pub trait FungiblesApi where AccountId: Codec, { /// Returns the list of all [`MultiAsset`] that an `AccountId` has. + #[changed_in(2)] fn query_account_balances(account: AccountId) -> Result, FungiblesAccessError>; + + /// Returns the list of all [`MultiAsset`] that an `AccountId` has. + fn query_account_balances(account: AccountId) -> Result; } } diff --git a/parachains/runtimes/assets/statemine/Cargo.toml b/parachains/runtimes/assets/statemine/Cargo.toml index 8328106fade..c3231e23958 100644 --- a/parachains/runtimes/assets/statemine/Cargo.toml +++ b/parachains/runtimes/assets/statemine/Cargo.toml @@ -9,7 +9,7 @@ description = "Kusama variant of Statemint parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate diff --git a/parachains/runtimes/assets/statemine/src/lib.rs b/parachains/runtimes/assets/statemine/src/lib.rs index 62425aa7496..961a9300a56 100644 --- a/parachains/runtimes/assets/statemine/src/lib.rs +++ b/parachains/runtimes/assets/statemine/src/lib.rs @@ -28,6 +28,9 @@ pub mod constants; mod weights; pub mod xcm_config; +use assets_common::{ + foreign_creators::ForeignCreators, matching::FromSiblingParachain, MultiLocationForAssetId, +}; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; @@ -74,9 +77,6 @@ use xcm_config::{ pub use sp_runtime::BuildStorage; // Polkadot imports -use assets_common::{ - foreign_creators::ForeignCreators, matching::FromSiblingParachain, MultiLocationForAssetId, -}; use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use xcm::latest::BodyId; @@ -951,7 +951,7 @@ impl_runtime_apis! { AccountId, > for Runtime { - fn query_account_balances(account: AccountId) -> Result, assets_common::runtime_api::FungiblesAccessError> { + fn query_account_balances(account: AccountId) -> Result { use assets_common::fungible_conversion::{convert, convert_balance}; Ok([ // collect pallet_balance @@ -976,7 +976,7 @@ impl_runtime_apis! { .filter(|(_, balance)| balance > &0) )?, // collect ... e.g. other tokens - ].concat()) + ].concat().into()) } } diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs index 832a9af5f5e..e2ff9a974b5 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_xcm.rs @@ -171,6 +171,15 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_092_000 picoseconds. + Weight::from_parts(3_217_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index 5d4c45fd4f3..45f95ee07d4 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -356,7 +356,7 @@ pub type Barrier = DenyThenTry< ( // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent and its plurality (i.e. governance bodies) gets free execution. + // Parent and its pluralities (i.e. governance bodies) get free execution. AllowExplicitUnpaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, diff --git a/parachains/runtimes/assets/statemine/tests/tests.rs b/parachains/runtimes/assets/statemine/tests/tests.rs index 972abe9d427..b9001a35a99 100644 --- a/parachains/runtimes/assets/statemine/tests/tests.rs +++ b/parachains/runtimes/assets/statemine/tests/tests.rs @@ -383,7 +383,11 @@ fn test_assets_balances_api_works() { 0 ); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), 0); - assert!(Runtime::query_account_balances(AccountId::from(ALICE)).unwrap().is_empty()); + assert!(Runtime::query_account_balances(AccountId::from(ALICE)) + .unwrap() + .try_as::() + .unwrap() + .is_none()); // Drip some balance use frame_support::traits::fungible::Mutate; @@ -437,24 +441,27 @@ fn test_assets_balances_api_works() { ); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), some_currency); - let result = Runtime::query_account_balances(AccountId::from(ALICE)).unwrap(); + let result: MultiAssets = Runtime::query_account_balances(AccountId::from(ALICE)) + .unwrap() + .try_into() + .unwrap(); assert_eq!(result.len(), 3); // check currency - assert!(result.iter().any(|asset| asset.eq( + assert!(result.inner().iter().any(|asset| asset.eq( &assets_common::fungible_conversion::convert_balance::( some_currency ) .unwrap() ))); // check trusted asset - assert!(result.iter().any(|asset| asset.eq(&( + assert!(result.inner().iter().any(|asset| asset.eq(&( AssetIdForTrustBackedAssetsConvert::reverse_ref(local_asset_id).unwrap(), minimum_asset_balance ) .into()))); // check foreign asset - assert!(result.iter().any(|asset| asset.eq(&( + assert!(result.inner().iter().any(|asset| asset.eq(&( Identity::reverse_ref(foreign_asset_id_multilocation).unwrap(), 6 * foreign_asset_minimum_asset_balance ) @@ -485,7 +492,8 @@ asset_test_utils::include_teleports_for_native_asset_works!( Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), _ => None, } - }) + }), + 1000 ); asset_test_utils::include_teleports_for_foreign_assets_works!( diff --git a/parachains/runtimes/assets/statemint/Cargo.toml b/parachains/runtimes/assets/statemint/Cargo.toml index a5d2841418a..837be9a2738 100644 --- a/parachains/runtimes/assets/statemint/Cargo.toml +++ b/parachains/runtimes/assets/statemint/Cargo.toml @@ -9,7 +9,7 @@ description = "Statemint parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate diff --git a/parachains/runtimes/assets/statemint/src/lib.rs b/parachains/runtimes/assets/statemint/src/lib.rs index a72df7314e6..aa90ca7a157 100644 --- a/parachains/runtimes/assets/statemint/src/lib.rs +++ b/parachains/runtimes/assets/statemint/src/lib.rs @@ -855,7 +855,7 @@ impl_runtime_apis! { AccountId, > for Runtime { - fn query_account_balances(account: AccountId) -> Result, assets_common::runtime_api::FungiblesAccessError> { + fn query_account_balances(account: AccountId) -> Result { use assets_common::fungible_conversion::{convert, convert_balance}; Ok([ // collect pallet_balance @@ -874,7 +874,7 @@ impl_runtime_apis! { .filter(|(_, balance)| balance > &0) )?, // collect ... e.g. pallet_assets ForeignAssets - ].concat()) + ].concat().into()) } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs index 26e19764b8a..32f1d1cd687 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_xcm.rs @@ -171,6 +171,15 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_451_000 picoseconds. + Weight::from_parts(3_580_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { diff --git a/parachains/runtimes/assets/statemint/src/xcm_config.rs b/parachains/runtimes/assets/statemint/src/xcm_config.rs index 90b0ee85fef..9d31bc0da60 100644 --- a/parachains/runtimes/assets/statemint/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemint/src/xcm_config.rs @@ -259,7 +259,7 @@ pub type Barrier = DenyThenTry< ( // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent, its plurality (i.e. governance bodies) and Fellows plurality gets free execution. + // Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution. AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, diff --git a/parachains/runtimes/assets/statemint/tests/tests.rs b/parachains/runtimes/assets/statemint/tests/tests.rs index 501c16960aa..7bbed6bb54a 100644 --- a/parachains/runtimes/assets/statemint/tests/tests.rs +++ b/parachains/runtimes/assets/statemint/tests/tests.rs @@ -389,7 +389,11 @@ fn test_assets_balances_api_works() { // check before assert_eq!(Assets::balance(local_asset_id, AccountId::from(ALICE)), 0); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), 0); - assert!(Runtime::query_account_balances(AccountId::from(ALICE)).unwrap().is_empty()); + assert!(Runtime::query_account_balances(AccountId::from(ALICE)) + .unwrap() + .try_as::() + .unwrap() + .is_none()); // Drip some balance use frame_support::traits::fungible::Mutate; @@ -421,18 +425,21 @@ fn test_assets_balances_api_works() { ); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), some_currency); - let result = Runtime::query_account_balances(AccountId::from(ALICE)).unwrap(); + let result: MultiAssets = Runtime::query_account_balances(AccountId::from(ALICE)) + .unwrap() + .try_into() + .unwrap(); assert_eq!(result.len(), 2); // check currency - assert!(result.iter().any(|asset| asset.eq( + assert!(result.inner().iter().any(|asset| asset.eq( &assets_common::fungible_conversion::convert_balance::( some_currency ) .unwrap() ))); // check trusted asset - assert!(result.iter().any(|asset| asset.eq(&( + assert!(result.inner().iter().any(|asset| asset.eq(&( AssetIdForTrustBackedAssetsConvert::reverse_ref(local_asset_id).unwrap(), minimum_asset_balance ) @@ -463,7 +470,8 @@ asset_test_utils::include_teleports_for_native_asset_works!( Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), _ => None, } - }) + }), + 1000 ); asset_test_utils::include_asset_transactor_transfer_with_local_consensus_currency_works!( diff --git a/parachains/runtimes/assets/test-utils/Cargo.toml b/parachains/runtimes/assets/test-utils/Cargo.toml index 2a9e70ce2dd..8a1ce0e6e3c 100644 --- a/parachains/runtimes/assets/test-utils/Cargo.toml +++ b/parachains/runtimes/assets/test-utils/Cargo.toml @@ -23,6 +23,7 @@ sp-core = { git = "https://github.com/paritytech/substrate", default-features = # Cumulus cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false } cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false } +cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false } pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false } parachains-common = { path = "../../../common", default-features = false } assets-common = { path = "../common", default-features = false } @@ -69,4 +70,5 @@ std = [ "xcm-executor/std", "pallet-xcm/std", "cumulus-pallet-xcmp-queue/std", + "cumulus-pallet-dmp-queue/std", ] diff --git a/parachains/runtimes/assets/test-utils/src/lib.rs b/parachains/runtimes/assets/test-utils/src/lib.rs index 06d6282e008..1e0b31f18a3 100644 --- a/parachains/runtimes/assets/test-utils/src/lib.rs +++ b/parachains/runtimes/assets/test-utils/src/lib.rs @@ -16,7 +16,7 @@ use sp_core::Encode; use sp_runtime::{Digest, DigestItem}; use xcm::{ latest::{MultiAsset, MultiLocation, XcmContext, XcmHash}, - prelude::{Concrete, Fungible, Outcome, XcmError, XcmVersion}, + prelude::*, }; use xcm_executor::{traits::TransactAsset, Assets}; @@ -252,6 +252,31 @@ impl Runt } } +impl + RuntimeHelper +{ + pub fn execute_as_governance(call: Vec, require_weight_at_most: Weight) -> Outcome { + // prepare xcm as governance will do + let xcm = Xcm(vec![ + UnpaidExecution { weight_limit: Unlimited, check_origin: None }, + Transact { + origin_kind: OriginKind::Superuser, + require_weight_at_most, + call: call.into(), + }, + ]); + + // execute xcm as parent origin + let hash = xcm.using_encoded(sp_io::hashing::blake2_256); + <::XcmExecutor>::execute_xcm( + MultiLocation::parent(), + xcm, + hash, + Self::xcm_max_weight(XcmReceivedFrom::Parent), + ) + } +} + pub enum XcmReceivedFrom { Parent, Sibling, diff --git a/parachains/runtimes/assets/test-utils/src/test_cases.rs b/parachains/runtimes/assets/test-utils/src/test_cases.rs index 079e6bd60ae..954ff0d7589 100644 --- a/parachains/runtimes/assets/test-utils/src/test_cases.rs +++ b/parachains/runtimes/assets/test-utils/src/test_cases.rs @@ -78,6 +78,7 @@ pub fn teleports_for_native_asset_works< unwrap_xcmp_queue_event: Box< dyn Fn(Vec) -> Option>, >, + runtime_para_id: u32, ) where Runtime: frame_system::Config + pallet_balances::Config @@ -102,7 +103,6 @@ pub fn teleports_for_native_asset_works< Call = cumulus_pallet_parachain_system::Call, >, { - let runtime_para_id = 1000; ExtBuilder::::default() .with_collators(collator_session_keys.collators()) .with_session_keys(collator_session_keys.session_keys()) @@ -273,14 +273,15 @@ macro_rules! include_teleports_for_native_asset_works( $collator_session_key:expr, $existential_deposit:expr, $unwrap_pallet_xcm_event:expr, - $unwrap_xcmp_queue_event:expr + $unwrap_xcmp_queue_event:expr, + $runtime_para_id:expr ) => { #[test] fn teleports_for_native_asset_works() { const BOB: [u8; 32] = [2u8; 32]; let target_account = parachains_common::AccountId::from(BOB); - asset_test_utils::test_cases::teleports_for_native_asset_works::< + $crate::test_cases::teleports_for_native_asset_works::< $runtime, $xcm_config, $checking_account, @@ -291,7 +292,8 @@ macro_rules! include_teleports_for_native_asset_works( $existential_deposit, target_account, $unwrap_pallet_xcm_event, - $unwrap_xcmp_queue_event + $unwrap_xcmp_queue_event, + $runtime_para_id ) } } @@ -598,7 +600,7 @@ macro_rules! include_teleports_for_foreign_assets_works( const SOME_ASSET_OWNER: [u8; 32] = [5u8; 32]; let asset_owner = parachains_common::AccountId::from(SOME_ASSET_OWNER); - asset_test_utils::test_cases::teleports_for_foreign_assets_works::< + $crate::test_cases::teleports_for_foreign_assets_works::< $runtime, $xcm_config, $checking_account, @@ -715,7 +717,7 @@ macro_rules! include_asset_transactor_transfer_with_local_consensus_currency_wor const BOB: [u8; 32] = [2u8; 32]; let target_account = parachains_common::AccountId::from(BOB); - asset_test_utils::test_cases::asset_transactor_transfer_with_local_consensus_currency_works::< + $crate::test_cases::asset_transactor_transfer_with_local_consensus_currency_works::< $runtime, $xcm_config >( @@ -969,7 +971,7 @@ macro_rules! include_asset_transactor_transfer_with_pallet_assets_instance_works const CHARLIE: [u8; 32] = [3u8; 32]; let charlie_account = parachains_common::AccountId::from(CHARLIE); - asset_test_utils::test_cases::asset_transactor_transfer_with_pallet_assets_instance_works::< + $crate::test_cases::asset_transactor_transfer_with_pallet_assets_instance_works::< $runtime, $xcm_config, $assets_pallet_instance, @@ -1094,7 +1096,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor additional_checks_before(); // execute XCM with Transacts to create/manage foreign assets by foreign governance - // prepapre data for xcm::Transact(create) + // prepare data for xcm::Transact(create) let foreign_asset_create = runtime_call_encode(pallet_assets::Call::< Runtime, ForeignAssetsPalletInstance, @@ -1104,7 +1106,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor admin: foreign_creator_as_account_id.clone().into(), min_balance: 1.into(), }); - // prepapre data for xcm::Transact(set_metadata) + // prepare data for xcm::Transact(set_metadata) let foreign_asset_set_metadata = runtime_call_encode(pallet_assets::Call::< Runtime, ForeignAssetsPalletInstance, @@ -1114,7 +1116,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor symbol: Vec::from(ASSET_SYMBOL), decimals: 12, }); - // prepapre data for xcm::Transact(set_team - change just freezer to Bob) + // prepare data for xcm::Transact(set_team - change just freezer to Bob) let foreign_asset_set_team = runtime_call_encode(pallet_assets::Call::< Runtime, ForeignAssetsPalletInstance, @@ -1297,7 +1299,7 @@ macro_rules! include_create_and_manage_foreign_assets_for_local_consensus_parach const BOB: [u8; 32] = [2u8; 32]; let bob_account = parachains_common::AccountId::from(BOB); - asset_test_utils::test_cases::create_and_manage_foreign_assets_for_local_consensus_parachain_assets_works::< + $crate::test_cases::create_and_manage_foreign_assets_for_local_consensus_parachain_assets_works::< $runtime, $xcm_config, $weight_to_fee, diff --git a/parachains/runtimes/assets/westmint/Cargo.toml b/parachains/runtimes/assets/westmint/Cargo.toml index a63353adb4e..91b06660dfa 100644 --- a/parachains/runtimes/assets/westmint/Cargo.toml +++ b/parachains/runtimes/assets/westmint/Cargo.toml @@ -9,7 +9,7 @@ description = "Westend variant of Statemint parachain runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index 97d2596a4bd..c237c8dc5cf 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -963,7 +963,7 @@ impl_runtime_apis! { AccountId, > for Runtime { - fn query_account_balances(account: AccountId) -> Result, assets_common::runtime_api::FungiblesAccessError> { + fn query_account_balances(account: AccountId) -> Result { use assets_common::fungible_conversion::{convert, convert_balance}; Ok([ // collect pallet_balance @@ -988,7 +988,7 @@ impl_runtime_apis! { .filter(|(_, balance)| balance > &0) )?, // collect ... e.g. other tokens - ].concat()) + ].concat().into()) } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs index 12b4dd66653..0d650e50929 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_xcm.rs @@ -169,6 +169,15 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_144_000 picoseconds. + Weight::from_parts(3_225_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index 1f57b34fcae..d9987a627ae 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -354,7 +354,7 @@ pub type Barrier = DenyThenTry< ( // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent or its plurality (i.e. governance bodies) gets free execution. + // Parent and its pluralities (i.e. governance bodies) get free execution. AllowExplicitUnpaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, diff --git a/parachains/runtimes/assets/westmint/tests/tests.rs b/parachains/runtimes/assets/westmint/tests/tests.rs index e04c163b01f..3ef09d14e52 100644 --- a/parachains/runtimes/assets/westmint/tests/tests.rs +++ b/parachains/runtimes/assets/westmint/tests/tests.rs @@ -388,7 +388,11 @@ fn test_assets_balances_api_works() { 0 ); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), 0); - assert!(Runtime::query_account_balances(AccountId::from(ALICE)).unwrap().is_empty()); + assert!(Runtime::query_account_balances(AccountId::from(ALICE)) + .unwrap() + .try_as::() + .unwrap() + .is_none()); // Drip some balance use frame_support::traits::fungible::Mutate; @@ -442,24 +446,27 @@ fn test_assets_balances_api_works() { ); assert_eq!(Balances::free_balance(AccountId::from(ALICE)), some_currency); - let result = Runtime::query_account_balances(AccountId::from(ALICE)).unwrap(); + let result: MultiAssets = Runtime::query_account_balances(AccountId::from(ALICE)) + .unwrap() + .try_into() + .unwrap(); assert_eq!(result.len(), 3); // check currency - assert!(result.iter().any(|asset| asset.eq( + assert!(result.inner().iter().any(|asset| asset.eq( &assets_common::fungible_conversion::convert_balance::( some_currency ) .unwrap() ))); // check trusted asset - assert!(result.iter().any(|asset| asset.eq(&( + assert!(result.inner().iter().any(|asset| asset.eq(&( AssetIdForTrustBackedAssetsConvert::reverse_ref(local_asset_id).unwrap(), minimum_asset_balance ) .into()))); // check foreign asset - assert!(result.iter().any(|asset| asset.eq(&( + assert!(result.inner().iter().any(|asset| asset.eq(&( Identity::reverse_ref(foreign_asset_id_multilocation).unwrap(), 6 * foreign_asset_minimum_asset_balance ) @@ -490,7 +497,8 @@ asset_test_utils::include_teleports_for_native_asset_works!( Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), _ => None, } - }) + }), + 1000 ); asset_test_utils::include_teleports_for_foreign_assets_works!( diff --git a/parachains/runtimes/bridge-hubs/README.md b/parachains/runtimes/bridge-hubs/README.md index cc9c76d75a7..9b024769195 100644 --- a/parachains/runtimes/bridge-hubs/README.md +++ b/parachains/runtimes/bridge-hubs/README.md @@ -10,20 +10,20 @@ - [Live Rockmine2 to Wockmint](#live-rockmine2-to-wockmint) * [How to test local BridgeHubKusama](#how-to-test-local-bridgehubkusama) * [How to test local BridgeHubPolkadot](#how-to-test-local-bridgehubpolkadot) - * [Git subtree `./bridges`](#git-subtree---bridges-) - + [How to update `bridges` subtree](#how-to-update--bridges--subtree) - + [How was first time initialized (dont need anymore)](#how-was-first-time-initialized--dont-need-anymore-) # Bridge-hub Parachains -Implementation of _BridgeHub_, a blockchain to support message passing between Substrate based chains like Polkadot and Kusama networks. - -_BridgeHub_ allows users to: - -- Passing arbitrary messages between different Substrate chains (Polkadot <-> Kusama). - -_BridgeHub_ is meant to be **_system parachain_** with main responsibilities: -- sync finality proofs between relay chains +_BridgeHub(s)_ are **_system parachains_** that will house trustless bridges from the local +ecosystem to others. +The current trustless bridges planned for the BridgeHub(s) are: +- `BridgeHubPolkadot` system parachain: + 1. Polkadot <-> Kusama bridge + 2. Polkadot <-> Ethereum bridge (Snowbridge) +- `BridgeHubKusama` system parachain: + 1. Kusama <-> Polkadot bridge + 2. Kusama <-> Ethereum bridge + The high-level responsibilities of each bridge living on BridgeHub: +- sync finality proofs between relay chains (or equivalent) - sync finality proofs between BridgeHub parachains - pass (XCM) messages between different BridgeHub parachains @@ -49,7 +49,9 @@ cp target/release/polkadot ~/local_bridge_testing/bin/polkadot # 3. Build cumulus polkadot-parachain binary cd -git checkout -b bridge-hub-rococo-wococo --track origin/bridge-hub-rococo-wococo +# checkout desired branch or use master: +# git checkout -b bridge-hub-rococo-wococo --track origin/bridge-hub-rococo-wococo +git checkout -b master --track origin/master cargo build --release --locked -p polkadot-parachain-bin cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-mint diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml index 00a9da0103c..4f7338a8e81 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -12,7 +12,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } serde = { version = "1.0.160", optional = true, features = ["derive"] } smallvec = "1.8.1" @@ -29,7 +29,6 @@ pallet-authorship = { git = "https://github.com/paritytech/substrate", default-f pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -72,6 +71,9 @@ pallet-collator-selection = { path = "../../../../pallets/collator-selection", d parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } parachains-common = { path = "../../../../parachains/common", default-features = false } +[dev-dependencies] +bridge-hub-test-utils = { path = "../test-utils"} + [features] default = [ "std", @@ -100,7 +102,6 @@ std = [ "pallet-collator-selection/std", "pallet-multisig/std", "pallet-session/std", - "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index e7f7da5ae99..952c3147306 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -64,15 +64,15 @@ use xcm_config::{ #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -// Polkadot imports use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; + // XCM Imports use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; @@ -259,7 +259,8 @@ parameter_types! { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs index 6210755b2bd..df103d9266b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/pallet_xcm.rs @@ -170,6 +170,15 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_073_000 picoseconds. + Weight::from_parts(3_178_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index 539333943e9..7b395a4d4e3 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -24,11 +24,11 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::xcm_config::{ - ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry, +use parachains_common::{ + impls::ToStakingPot, + xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, }; use polkadot_parachain::primitives::Sibling; -use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, @@ -112,7 +112,6 @@ match_types! { MultiLocation { parents: 1, interior: X1(_) } }; } - /// A call filter for the XCM Transact instruction. This is a temporary measure until we properly /// account for proof size weights. /// @@ -165,9 +164,9 @@ pub type Barrier = DenyThenTry< AllowKnownQueryResponses, WithComputedOrigin< ( - // Allow anything to pay for execution. + // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent and its plurality (i.e. governance bodies) gets free execution. + // Parent and its pluralities (i.e. governance bodies) get free execution. AllowExplicitUnpaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, @@ -197,7 +196,7 @@ impl xcm_executor::Config for XcmConfig { MaxInstructions, >; type Trader = - UsingComponents>; + UsingComponents>; type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/tests/tests.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/tests/tests.rs new file mode 100644 index 00000000000..9998e3d804d --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/tests/tests.rs @@ -0,0 +1,56 @@ +// Copyright 2023 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +pub use bridge_hub_kusama_runtime::{ + constants::fee::WeightToFee, xcm_config::XcmConfig, Balances, ExistentialDeposit, + ParachainSystem, PolkadotXcm, Runtime, RuntimeEvent, SessionKeys, +}; +use codec::Decode; +use frame_support::parameter_types; +use parachains_common::{AccountId, AuraId}; + +const ALICE: [u8; 32] = [1u8; 32]; + +parameter_types! { + pub CheckingAccount: AccountId = PolkadotXcm::check_account(); +} + +bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!( + Runtime, + XcmConfig, + CheckingAccount, + WeightToFee, + ParachainSystem, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + ExistentialDeposit::get(), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + 1002 +); diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml index 86bb0780027..3b42507b1da 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -12,7 +12,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } serde = { version = "1.0.160", optional = true, features = ["derive"] } smallvec = "1.8.1" @@ -29,7 +29,6 @@ pallet-authorship = { git = "https://github.com/paritytech/substrate", default-f pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } -pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -72,6 +71,9 @@ pallet-collator-selection = { path = "../../../../pallets/collator-selection", d parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } parachains-common = { path = "../../../../parachains/common", default-features = false } +[dev-dependencies] +bridge-hub-test-utils = { path = "../test-utils"} + [features] default = [ "std", @@ -100,7 +102,6 @@ std = [ "pallet-collator-selection/std", "pallet-multisig/std", "pallet-session/std", - "pallet-sudo/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs index cbaa3a612e1..dfc08b4c184 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -70,7 +70,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; // XCM Imports @@ -143,11 +143,6 @@ pub fn native_version() -> NativeVersion { parameter_types! { pub const Version: RuntimeVersion = VERSION; - - // This part is copied from Substrate's `bin/node/runtime/src/lib.rs`. - // The `RuntimeBlockLength` and `RuntimeBlockWeights` exist here because the - // `DeletionWeightLimit` and `DeletionQueueDepth` depend on those to parameterize - // the lazy contract deletion. pub RuntimeBlockLength: BlockLength = BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO); pub RuntimeBlockWeights: BlockWeights = BlockWeights::builder() @@ -264,7 +259,8 @@ parameter_types! { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; @@ -712,7 +708,6 @@ impl_runtime_apis! { fn export_message_origin_and_destination( ) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> { - // TODO - don't skip Err(BenchmarkError::Skip) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs index db01f989e76..05bfdc8339e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/pallet_xcm.rs @@ -170,6 +170,15 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_994_000 picoseconds. + Weight::from_parts(3_160_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index 189e7c74f81..d063fda2c13 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -24,11 +24,11 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; -use parachains_common::xcm_config::{ - ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry, +use parachains_common::{ + impls::ToStakingPot, + xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, }; use polkadot_parachain::primitives::Sibling; -use polkadot_runtime_common::impls::ToAuthor; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, @@ -96,22 +96,24 @@ pub type XcmOriginToTransactDispatchOrigin = ( // transaction from the Root origin. ParentAsSuperuser, // Native signed account converter; this just converts an `AccountId32` origin into a normal - // `Origin::Signed` origin of the same 32-byte value. + // `RuntimeOrigin::Signed` origin of the same 32-byte value. SignedAccountId32AsNative, // Xcm origins can be represented natively under the Xcm pallet's Xcm origin. XcmPassthrough, ); match_types! { - // TODO: map gov2 origins here - after merge https://github.com/paritytech/cumulus/pull/1895 - pub type ParentOrParentsExecutivePlurality: impl Contains = { + pub type ParentOrParentsPlurality: impl Contains = { MultiLocation { parents: 1, interior: Here } | - MultiLocation { parents: 1, interior: X1(Plurality { id: BodyId::Executive, .. }) } + MultiLocation { parents: 1, interior: X1(Plurality { .. }) } }; pub type ParentOrSiblings: impl Contains = { MultiLocation { parents: 1, interior: Here } | MultiLocation { parents: 1, interior: X1(_) } }; + pub type FellowsPlurality: impl Contains = { + MultiLocation { parents: 1, interior: X2(Parachain(1001), Plurality { id: BodyId::Technical, ..}) } + }; } /// A call filter for the XCM Transact instruction. This is a temporary measure until we properly /// account for proof size weights. @@ -165,10 +167,10 @@ pub type Barrier = DenyThenTry< AllowKnownQueryResponses, WithComputedOrigin< ( - // Allow anything to pay for execution. + // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent and its exec plurality get free execution. - AllowExplicitUnpaidExecutionFrom, + // Parent, its pluralities (i.e. governance bodies), and the Fellows plurality get free execution. + AllowExplicitUnpaidExecutionFrom<(ParentOrParentsPlurality, FellowsPlurality)>, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, ), @@ -197,7 +199,7 @@ impl xcm_executor::Config for XcmConfig { MaxInstructions, >; type Trader = - UsingComponents>; + UsingComponents>; type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/tests/tests.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/tests/tests.rs new file mode 100644 index 00000000000..9a3ccd59cd6 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/tests/tests.rs @@ -0,0 +1,56 @@ +// Copyright 2023 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +pub use bridge_hub_polkadot_runtime::{ + constants::fee::WeightToFee, xcm_config::XcmConfig, Balances, ExistentialDeposit, + ParachainSystem, PolkadotXcm, Runtime, RuntimeEvent, SessionKeys, +}; +use codec::Decode; +use frame_support::parameter_types; +use parachains_common::{AccountId, AuraId}; + +const ALICE: [u8; 32] = [1u8; 32]; + +parameter_types! { + pub CheckingAccount: AccountId = PolkadotXcm::check_account(); +} + +bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!( + Runtime, + XcmConfig, + CheckingAccount, + WeightToFee, + ParachainSystem, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + ExistentialDeposit::get(), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + 1002 +); diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 0d4a3f63227..fb36355bc22 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -12,7 +12,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } serde = { version = "1.0.160", optional = true, features = ["derive"] } smallvec = "1.8.1" diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs index b2f4a7af81b..bfa6f98ebae 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs @@ -40,7 +40,6 @@ use xcm::{ }; use xcm_builder::{BridgeBlobDispatcher, HaulBlobExporter}; -// TODO:check-parameter parameter_types! { pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; @@ -86,7 +85,7 @@ impl XcmBlobHauler for ToBridgeHubWococoXcmBlobHauler { DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO } } -const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO: LaneId = LaneId([0, 0, 0, 1]); +pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO: LaneId = LaneId([0, 0, 0, 1]); /// Messaging Bridge configuration for BridgeHubRococo -> BridgeHubWococo pub struct WithBridgeHubWococoMessageBridge; @@ -166,10 +165,15 @@ mod tests { #[test] fn ensure_bridge_hub_rococo_message_lane_weights_are_correct() { - check_message_lane_weights::( + check_message_lane_weights::< + bp_bridge_hub_rococo::BridgeHubRococo, + Runtime, + WithBridgeHubWococoMessagesInstance, + >( bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE, bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, + true, ); } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs index 02d95c0646a..2c9ec3c82bc 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs @@ -40,7 +40,6 @@ use xcm::{ }; use xcm_builder::{BridgeBlobDispatcher, HaulBlobExporter}; -// TODO:check-parameter parameter_types! { pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; @@ -86,7 +85,7 @@ impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler { DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO } } -const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 1]); +pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 1]); /// Messaging Bridge configuration for BridgeHubWococo -> BridgeHubRococo pub struct WithBridgeHubRococoMessageBridge; @@ -166,10 +165,15 @@ mod tests { #[test] fn ensure_bridge_hub_wococo_message_lane_weights_are_correct() { - check_message_lane_weights::( + check_message_lane_weights::< + bp_bridge_hub_wococo::BridgeHubWococo, + Runtime, + WithBridgeHubRococoMessagesInstance, + >( bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE, bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, + true, ); } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index fe05a55d948..82eb4b1bb49 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -90,7 +90,7 @@ use bridge_runtime_common::{ messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch}, }; use parachains_common::{ - opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use xcm_executor::XcmExecutor; @@ -282,7 +282,8 @@ parameter_types! { impl pallet_transaction_payment::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter; + type OnChargeTransaction = + pallet_transaction_payment::CurrencyAdapter>; type OperationalFeeMultiplier = ConstU8<5>; type WeightToFee = WeightToFee; type LengthToFee = ConstantMultiplier; @@ -400,7 +401,7 @@ impl pallet_utility::Config for Runtime { // Add bridge pallets (GPA) -/// Add granda bridge pallet to track Wococo relay chain on Rococo BridgeHub +/// Add GRANDPA bridge pallet to track Wococo relay chain on Rococo BridgeHub pub type BridgeGrandpaWococoInstance = pallet_bridge_grandpa::Instance1; impl pallet_bridge_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -410,7 +411,7 @@ impl pallet_bridge_grandpa::Config for Runtime { type WeightInfo = weights::pallet_bridge_grandpa_bridge_wococo_grandpa::WeightInfo; } -/// Add granda bridge pallet to track Rococo relay chain on Wococo BridgeHub +/// Add GRANDPA bridge pallet to track Rococo relay chain on Wococo BridgeHub pub type BridgeGrandpaRococoInstance = pallet_bridge_grandpa::Instance2; impl pallet_bridge_grandpa::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -423,15 +424,17 @@ impl pallet_bridge_grandpa::Config for Runtime { parameter_types! { pub const RelayChainHeadersToKeep: u32 = 1024; pub const ParachainHeadsToKeep: u32 = 64; - pub const MaxRequests: u32 = 64; + pub const RelayerStakeLease: u32 = 8; pub const RococoBridgeParachainPalletName: &'static str = "Paras"; pub const WococoBridgeParachainPalletName: &'static str = "Paras"; pub const MaxRococoParaHeadDataSize: u32 = bp_rococo::MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE; pub const MaxWococoParaHeadDataSize: u32 = bp_wococo::MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE; - // TODO:check-parameter - setup initial values https://github.com/paritytech/parity-bridges-common/issues/1677 pub storage DeliveryRewardInBalance: u64 = 1_000_000; + pub storage RequiredStakeForStakeAndSlash: Balance = 1_000_000; + + pub const RelayerStakeReserveId: [u8; 8] = *b"brdgrlrs"; } /// Add parachain bridge pallet to track Wococo bridge hub parachain @@ -460,7 +463,7 @@ impl pallet_bridge_parachains::Config for Runtime type MaxParaHeadDataSize = MaxRococoParaHeadDataSize; } -/// Add XCM messages support for BrigdeHubRococo to support Rococo->Wococo XCM messages +/// Add XCM messages support for BridgeHubRococo to support Rococo->Wococo XCM messages pub type WithBridgeHubWococoMessagesInstance = pallet_bridge_messages::Instance1; impl pallet_bridge_messages::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -489,15 +492,11 @@ impl pallet_bridge_messages::Config for Run >; type SourceHeaderChain = SourceHeaderChainAdapter; - type MessageDispatch = XcmBlobMessageDispatch< - bp_bridge_hub_wococo::BridgeHubWococo, - bp_bridge_hub_rococo::BridgeHubRococo, - OnBridgeHubRococoBlobDispatcher, - Self::WeightInfo, - >; + type MessageDispatch = + XcmBlobMessageDispatch; } -/// Add XCM messages support for BrigdeHubWococo to support Wococo->Rococo XCM messages +/// Add XCM messages support for BridgeHubWococo to support Wococo->Rococo XCM messages pub type WithBridgeHubRococoMessagesInstance = pallet_bridge_messages::Instance2; impl pallet_bridge_messages::Config for Runtime { type RuntimeEvent = RuntimeEvent; @@ -526,12 +525,8 @@ impl pallet_bridge_messages::Config for Run >; type SourceHeaderChain = SourceHeaderChainAdapter; - type MessageDispatch = XcmBlobMessageDispatch< - bp_bridge_hub_rococo::BridgeHubRococo, - bp_bridge_hub_wococo::BridgeHubWococo, - OnBridgeHubWococoBlobDispatcher, - Self::WeightInfo, - >; + type MessageDispatch = + XcmBlobMessageDispatch; } /// Allows collect and claim rewards for relayers @@ -540,6 +535,14 @@ impl pallet_bridge_relayers::Config for Runtime { type Reward = Balance; type PaymentProcedure = bp_relayers::PayRewardFromAccount, AccountId>; + type StakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed< + AccountId, + BlockNumber, + Balances, + RelayerStakeReserveId, + RequiredStakeForStakeAndSlash, + RelayerStakeLease, + >; type WeightInfo = weights::pallet_bridge_relayers::WeightInfo; } @@ -695,7 +698,6 @@ construct_runtime!( // Handy utilities. Utility: pallet_utility::{Pallet, Call, Event} = 40, - // TODO:check-parameter - change back to 41 a align bridge pallets Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 36, // Rococo and Wococo Bridge Hubs are sharing the runtime, so this runtime has two sets of @@ -740,7 +742,6 @@ mod benches { define_benchmarks!( [frame_system, SystemBench::] [pallet_balances, Balances] - [pallet_session, SessionBench::] [pallet_multisig, Multisig] [pallet_session, SessionBench::] [pallet_utility, Utility] @@ -933,6 +934,7 @@ impl_runtime_apis! { } } + // This exposed by BridgeHubRococo impl bp_bridge_hub_wococo::ToBridgeHubWococoOutboundLaneApi for Runtime { fn message_details( lane: bp_messages::LaneId, @@ -959,6 +961,7 @@ impl_runtime_apis! { } } + // This is exposed by BridgeHubWococo impl bp_bridge_hub_rococo::ToBridgeHubRococoOutboundLaneApi for Runtime { fn message_details( lane: bp_messages::LaneId, @@ -1269,16 +1272,20 @@ impl_runtime_apis! { } impl BridgeRelayersConfig for Runtime { - fn prepare_environment( + fn prepare_rewards_account( account_params: bp_relayers::RewardsAccountParams, reward: Balance, ) { - use frame_support::traits::fungible::Mutate; let rewards_account = bp_relayers::PayRewardFromAccount::< Balances, AccountId >::rewards_account(account_params); - Balances::mint_into(&rewards_account, reward).unwrap(); + Self::deposit_account(rewards_account, reward); + } + + fn deposit_account(account: AccountId, balance: Balance) { + use frame_support::traits::fungible::Mutate; + Balances::mint_into(&account, balance.saturating_add(ExistentialDeposit::get())).unwrap(); } } @@ -1340,6 +1347,9 @@ mod tests { use bridge_hub_test_utils::test_header; use codec::Encode; + pub type TestBlockHeader = + sp_runtime::generic::Header; + #[test] fn ensure_signed_extension_definition_is_compatible_with_relay() { let payload: SignedExtra = ( @@ -1364,7 +1374,7 @@ mod tests { 10, 10, TransactionEra::Immortal, - test_header::(1).hash(), + test_header::(1).hash(), 10, 10, ); @@ -1377,7 +1387,7 @@ mod tests { 10, 10, TransactionEra::Immortal, - test_header::(1).hash(), + test_header::(1).hash(), 10, 10, ); diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs index 3ddb50c7a5e..d2bc8df00b2 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs @@ -45,16 +45,38 @@ pub use extrinsic_weights::constants::ExtrinsicBaseWeight; pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; +use crate::Runtime; +use frame_support::weights::Weight; + +// import trait from dependency module +use ::pallet_bridge_relayers::WeightInfoExt as _; + impl pallet_bridge_messages::WeightInfoExt for pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance::WeightInfo { fn expected_extra_storage_proof_size() -> u32 { bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE } + + fn receive_messages_proof_overhead_from_runtime() -> Weight { + pallet_bridge_relayers::WeightInfo::::receive_messages_proof_overhead_from_runtime() + } + + fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight { + pallet_bridge_relayers::WeightInfo::::receive_messages_delivery_proof_overhead_from_runtime() + } } impl pallet_bridge_messages::WeightInfoExt for pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance::WeightInfo { fn expected_extra_storage_proof_size() -> u32 { bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE } + + fn receive_messages_proof_overhead_from_runtime() -> Weight { + pallet_bridge_relayers::WeightInfo::::receive_messages_proof_overhead_from_runtime() + } + + fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight { + pallet_bridge_relayers::WeightInfo::::receive_messages_delivery_proof_overhead_from_runtime() + } } impl pallet_bridge_parachains::WeightInfoExt for pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance::WeightInfo { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs index 88e9c24bc58..68e540adb7b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs @@ -1,4 +1,4 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. +// Copyright Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -17,41 +17,40 @@ //! Autogenerated weights for `pallet_bridge_grandpa` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `10`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet -// --steps=10 -// --repeat=1 +// --steps=50 +// --repeat=20 // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=./bench.json -// --header=./file_header.txt -// --chain=bridge-hub-rococo-dev +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_bridge_grandpa -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_grandpa`. pub struct WeightInfo(PhantomData); impl pallet_bridge_grandpa::WeightInfo for WeightInfo { /// Storage: BridgeRococoGrandpa PalletOperatingMode (r:1 w:0) /// Proof: BridgeRococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: BridgeRococoGrandpa RequestCount (r:1 w:1) - /// Proof: BridgeRococoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BridgeRococoGrandpa BestFinalized (r:1 w:1) /// Proof: BridgeRococoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen) /// Storage: BridgeRococoGrandpa CurrentAuthoritySet (r:1 w:0) @@ -66,18 +65,16 @@ impl pallet_bridge_grandpa::WeightInfo for WeightInfo Weight { + fn submit_finality_proof(p: u32, _v: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `295 + p * (60 ±0)` - // Estimated: `60231` - // Minimum execution time: 616_404_000 picoseconds. - Weight::from_parts(616_404_000, 0) - .saturating_add(Weight::from_parts(0, 60231)) - // Standard Error: 10_615_697 - .saturating_add(Weight::from_parts(107_372_374, 0).saturating_mul(p.into())) - // Standard Error: 81_776_733 - .saturating_add(Weight::from_parts(97_333_232, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(6)) + // Measured: `231 + p * (60 ±0)` + // Estimated: `51735` + // Minimum execution time: 224_590_000 picoseconds. + Weight::from_parts(225_581_000, 0) + .saturating_add(Weight::from_parts(0, 51735)) + // Standard Error: 5_887 + .saturating_add(Weight::from_parts(47_424_657, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs index 68265a8c489..1c3bfb2feef 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs @@ -1,4 +1,4 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. +// Copyright Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -17,41 +17,40 @@ //! Autogenerated weights for `pallet_bridge_grandpa` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `10`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet -// --steps=10 -// --repeat=1 +// --steps=50 +// --repeat=20 // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=./bench.json -// --header=./file_header.txt -// --chain=bridge-hub-rococo-dev +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_bridge_grandpa -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_grandpa`. pub struct WeightInfo(PhantomData); impl pallet_bridge_grandpa::WeightInfo for WeightInfo { /// Storage: BridgeWococoGrandpa PalletOperatingMode (r:1 w:0) /// Proof: BridgeWococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: BridgeWococoGrandpa RequestCount (r:1 w:1) - /// Proof: BridgeWococoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: BridgeWococoGrandpa BestFinalized (r:1 w:1) /// Proof: BridgeWococoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen) /// Storage: BridgeWococoGrandpa CurrentAuthoritySet (r:1 w:0) @@ -68,14 +67,14 @@ impl pallet_bridge_grandpa::WeightInfo for WeightInfo Weight { // Proof Size summary in bytes: - // Measured: `332 + p * (60 ±0)` - // Estimated: `60231` - // Minimum execution time: 672_054_000 picoseconds. - Weight::from_parts(47_309_240_121, 0) - .saturating_add(Weight::from_parts(0, 60231)) - // Standard Error: 16_649_480 - .saturating_add(Weight::from_parts(98_202_871, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(6)) - .saturating_add(T::DbWeight::get().writes(6)) + // Measured: `268 + p * (60 ±0)` + // Estimated: `51735` + // Minimum execution time: 224_665_000 picoseconds. + Weight::from_parts(225_737_000, 0) + .saturating_add(Weight::from_parts(0, 51735)) + // Standard Error: 5_325 + .saturating_add(Weight::from_parts(47_412_944, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(5)) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs index 7f61b0d6a11..47d1ec8d47c 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs @@ -1,4 +1,4 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. +// Copyright Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -17,13 +17,13 @@ //! Autogenerated weights for `pallet_bridge_messages` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: -// target/debug/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet // --steps=50 @@ -32,17 +32,19 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_bridge_messages // --chain=bridge-hub-rococo-dev // --header=./file_header.txt -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_messages`. pub struct WeightInfo(PhantomData); @@ -58,10 +60,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof() -> Weight { // Proof Size summary in bytes: // Measured: `367` - // Estimated: `57797` - // Minimum execution time: 1_052_304_000 picoseconds. - Weight::from_parts(1_067_318_000, 0) - .saturating_add(Weight::from_parts(0, 57797)) + // Estimated: `52645` + // Minimum execution time: 42_364_000 picoseconds. + Weight::from_parts(43_780_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -76,10 +78,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_two_messages_proof() -> Weight { // Proof Size summary in bytes: // Measured: `367` - // Estimated: `57797` - // Minimum execution time: 1_358_159_000 picoseconds. - Weight::from_parts(1_371_112_000, 0) - .saturating_add(Weight::from_parts(0, 57797)) + // Estimated: `52645` + // Minimum execution time: 54_010_000 picoseconds. + Weight::from_parts(66_691_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -94,10 +96,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_with_outbound_lane_state() -> Weight { // Proof Size summary in bytes: // Measured: `367` - // Estimated: `57797` - // Minimum execution time: 1_248_139_000 picoseconds. - Weight::from_parts(1_262_958_000, 0) - .saturating_add(Weight::from_parts(0, 57797)) + // Estimated: `52645` + // Minimum execution time: 48_066_000 picoseconds. + Weight::from_parts(48_635_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -110,10 +112,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_1_kb() -> Weight { // Proof Size summary in bytes: // Measured: `335` - // Estimated: `56308` - // Minimum execution time: 1_006_936_000 picoseconds. - Weight::from_parts(1_017_299_000, 0) - .saturating_add(Weight::from_parts(0, 56308)) + // Estimated: `52645` + // Minimum execution time: 40_997_000 picoseconds. + Weight::from_parts(41_710_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -126,10 +128,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_16_kb() -> Weight { // Proof Size summary in bytes: // Measured: `335` - // Estimated: `56308` - // Minimum execution time: 1_734_842_000 picoseconds. - Weight::from_parts(1_750_451_000, 0) - .saturating_add(Weight::from_parts(0, 56308)) + // Estimated: `52645` + // Minimum execution time: 67_556_000 picoseconds. + Weight::from_parts(68_573_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -146,10 +148,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_delivery_proof_for_single_message() -> Weight { // Proof Size summary in bytes: // Measured: `339` - // Estimated: `12534` - // Minimum execution time: 983_917_000 picoseconds. - Weight::from_parts(991_532_000, 0) - .saturating_add(Weight::from_parts(0, 12534)) + // Estimated: `3804` + // Minimum execution time: 32_221_000 picoseconds. + Weight::from_parts(32_582_000, 0) + .saturating_add(Weight::from_parts(0, 3804)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -166,10 +168,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { // Proof Size summary in bytes: // Measured: `339` - // Estimated: `12534` - // Minimum execution time: 983_370_000 picoseconds. - Weight::from_parts(992_178_000, 0) - .saturating_add(Weight::from_parts(0, 12534)) + // Estimated: `3804` + // Minimum execution time: 32_395_000 picoseconds. + Weight::from_parts(32_703_000, 0) + .saturating_add(Weight::from_parts(0, 3804)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -186,10 +188,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { // Proof Size summary in bytes: // Measured: `339` - // Estimated: `15082` - // Minimum execution time: 1_118_509_000 picoseconds. - Weight::from_parts(1_136_181_000, 0) - .saturating_add(Weight::from_parts(0, 15082)) + // Estimated: `6086` + // Minimum execution time: 34_409_000 picoseconds. + Weight::from_parts(34_927_000, 0) + .saturating_add(Weight::from_parts(0, 6086)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -218,12 +220,12 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `635` - // Estimated: `71012` - // Minimum execution time: 1_887_056_000 picoseconds. - Weight::from_parts(1_896_414_726, 0) - .saturating_add(Weight::from_parts(0, 71012)) - // Standard Error: 2_462 - .saturating_add(Weight::from_parts(557_738, 0).saturating_mul(i.into())) + // Estimated: `52645` + // Minimum execution time: 129_154_000 picoseconds. + Weight::from_parts(103_525_480, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 2_595 + .saturating_add(Weight::from_parts(536_761, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs index 811e483a779..0b2aceb489e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs @@ -1,4 +1,4 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. +// Copyright Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -17,13 +17,13 @@ //! Autogenerated weights for `pallet_bridge_messages` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-24, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: -// target/debug/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet // --steps=50 @@ -32,17 +32,19 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_bridge_messages // --chain=bridge-hub-rococo-dev // --header=./file_header.txt -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_messages`. pub struct WeightInfo(PhantomData); @@ -58,10 +60,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof() -> Weight { // Proof Size summary in bytes: // Measured: `404` - // Estimated: `57797` - // Minimum execution time: 1_063_700_000 picoseconds. - Weight::from_parts(1_073_859_000, 0) - .saturating_add(Weight::from_parts(0, 57797)) + // Estimated: `52645` + // Minimum execution time: 43_745_000 picoseconds. + Weight::from_parts(45_462_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -76,10 +78,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_two_messages_proof() -> Weight { // Proof Size summary in bytes: // Measured: `404` - // Estimated: `57797` - // Minimum execution time: 1_363_828_000 picoseconds. - Weight::from_parts(1_383_808_000, 0) - .saturating_add(Weight::from_parts(0, 57797)) + // Estimated: `52645` + // Minimum execution time: 55_455_000 picoseconds. + Weight::from_parts(65_023_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -94,10 +96,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_with_outbound_lane_state() -> Weight { // Proof Size summary in bytes: // Measured: `404` - // Estimated: `57797` - // Minimum execution time: 1_258_314_000 picoseconds. - Weight::from_parts(1_276_600_000, 0) - .saturating_add(Weight::from_parts(0, 57797)) + // Estimated: `52645` + // Minimum execution time: 48_603_000 picoseconds. + Weight::from_parts(50_377_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -110,10 +112,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_1_kb() -> Weight { // Proof Size summary in bytes: // Measured: `372` - // Estimated: `56308` - // Minimum execution time: 1_019_420_000 picoseconds. - Weight::from_parts(1_031_056_000, 0) - .saturating_add(Weight::from_parts(0, 56308)) + // Estimated: `52645` + // Minimum execution time: 42_777_000 picoseconds. + Weight::from_parts(43_499_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -126,10 +128,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_16_kb() -> Weight { // Proof Size summary in bytes: // Measured: `372` - // Estimated: `56308` - // Minimum execution time: 1_745_271_000 picoseconds. - Weight::from_parts(1_759_460_000, 0) - .saturating_add(Weight::from_parts(0, 56308)) + // Estimated: `52645` + // Minimum execution time: 69_408_000 picoseconds. + Weight::from_parts(69_916_000, 0) + .saturating_add(Weight::from_parts(0, 52645)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -146,10 +148,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_delivery_proof_for_single_message() -> Weight { // Proof Size summary in bytes: // Measured: `376` - // Estimated: `12571` - // Minimum execution time: 993_132_000 picoseconds. - Weight::from_parts(1_005_111_000, 0) - .saturating_add(Weight::from_parts(0, 12571)) + // Estimated: `3841` + // Minimum execution time: 33_122_000 picoseconds. + Weight::from_parts(34_379_000, 0) + .saturating_add(Weight::from_parts(0, 3841)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -166,10 +168,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { // Proof Size summary in bytes: // Measured: `376` - // Estimated: `12571` - // Minimum execution time: 995_201_000 picoseconds. - Weight::from_parts(1_003_630_000, 0) - .saturating_add(Weight::from_parts(0, 12571)) + // Estimated: `3841` + // Minimum execution time: 33_049_000 picoseconds. + Weight::from_parts(33_747_000, 0) + .saturating_add(Weight::from_parts(0, 3841)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -186,10 +188,10 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { // Proof Size summary in bytes: // Measured: `376` - // Estimated: `15119` - // Minimum execution time: 1_126_518_000 picoseconds. - Weight::from_parts(1_143_524_000, 0) - .saturating_add(Weight::from_parts(0, 15119)) + // Estimated: `6086` + // Minimum execution time: 35_578_000 picoseconds. + Weight::from_parts(36_007_000, 0) + .saturating_add(Weight::from_parts(0, 6086)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -218,12 +220,12 @@ impl pallet_bridge_messages::WeightInfo for WeightInfo< fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `672` - // Estimated: `71234` - // Minimum execution time: 1_893_906_000 picoseconds. - Weight::from_parts(1_907_046_615, 0) - .saturating_add(Weight::from_parts(0, 71234)) - // Standard Error: 2_494 - .saturating_add(Weight::from_parts(561_329, 0).saturating_mul(i.into())) + // Estimated: `52645` + // Minimum execution time: 130_070_000 picoseconds. + Weight::from_parts(104_597_637, 0) + .saturating_add(Weight::from_parts(0, 52645)) + // Standard Error: 2_607 + .saturating_add(Weight::from_parts(538_698, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(4)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs index 410bd211af9..9e88bd08b7f 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs @@ -1,4 +1,4 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. +// Copyright Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -17,13 +17,13 @@ //! Autogenerated weights for `pallet_bridge_parachains` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet // --steps=50 @@ -32,18 +32,19 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=./bench.json -// --header=./file_header.txt -// --chain=bridge-hub-rococo-dev +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_bridge_parachains -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_parachains`. pub struct WeightInfo(PhantomData); @@ -60,15 +61,13 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) /// The range of component `p` is `[1, 2]`. /// The range of component `p` is `[1, 2]`. - fn submit_parachain_heads_with_n_parachains(p: u32, ) -> Weight { + fn submit_parachain_heads_with_n_parachains(_p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `326` - // Estimated: `7618` - // Minimum execution time: 43_640_000 picoseconds. - Weight::from_parts(70_049_694, 0) - .saturating_add(Weight::from_parts(0, 7618)) - // Standard Error: 651_207 - .saturating_add(Weight::from_parts(7_744_677, 0).saturating_mul(p.into())) + // Measured: `294` + // Estimated: `2543` + // Minimum execution time: 33_300_000 picoseconds. + Weight::from_parts(34_117_420, 0) + .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -84,11 +83,11 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) fn submit_parachain_heads_with_1kb_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `326` - // Estimated: `7618` - // Minimum execution time: 69_524_000 picoseconds. - Weight::from_parts(83_696_000, 0) - .saturating_add(Weight::from_parts(0, 7618)) + // Measured: `294` + // Estimated: `2543` + // Minimum execution time: 34_550_000 picoseconds. + Weight::from_parts(35_046_000, 0) + .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -104,11 +103,11 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) fn submit_parachain_heads_with_16kb_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `326` - // Estimated: `7618` - // Minimum execution time: 126_315_000 picoseconds. - Weight::from_parts(147_026_000, 0) - .saturating_add(Weight::from_parts(0, 7618)) + // Measured: `294` + // Estimated: `2543` + // Minimum execution time: 61_071_000 picoseconds. + Weight::from_parts(61_554_000, 0) + .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs index b02641ab918..238fa8725d3 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs @@ -1,4 +1,4 @@ -// Copyright 2021 Parity Technologies (UK) Ltd. +// Copyright Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -17,13 +17,13 @@ //! Autogenerated weights for `pallet_bridge_parachains` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot-parachain +// target/production/polkadot-parachain // benchmark // pallet // --steps=50 @@ -32,18 +32,19 @@ // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --json-file=./bench.json -// --header=./file_header.txt -// --chain=bridge-hub-rococo-dev +// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json // --pallet=pallet_bridge_parachains -// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weight functions for `pallet_bridge_parachains`. pub struct WeightInfo(PhantomData); @@ -60,15 +61,13 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) /// The range of component `p` is `[1, 2]`. /// The range of component `p` is `[1, 2]`. - fn submit_parachain_heads_with_n_parachains(p: u32, ) -> Weight { + fn submit_parachain_heads_with_n_parachains(_p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `399` - // Estimated: `7618` - // Minimum execution time: 47_436_000 picoseconds. - Weight::from_parts(75_670_977, 0) - .saturating_add(Weight::from_parts(0, 7618)) - // Standard Error: 724_179 - .saturating_add(Weight::from_parts(5_669_961, 0).saturating_mul(p.into())) + // Measured: `367` + // Estimated: `2543` + // Minimum execution time: 34_469_000 picoseconds. + Weight::from_parts(35_382_374, 0) + .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -84,11 +83,11 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) fn submit_parachain_heads_with_1kb_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `399` - // Estimated: `7618` - // Minimum execution time: 70_961_000 picoseconds. - Weight::from_parts(83_138_000, 0) - .saturating_add(Weight::from_parts(0, 7618)) + // Measured: `367` + // Estimated: `2543` + // Minimum execution time: 35_690_000 picoseconds. + Weight::from_parts(36_400_000, 0) + .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -104,11 +103,11 @@ impl pallet_bridge_parachains::WeightInfo for WeightInf /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) fn submit_parachain_heads_with_16kb_proof() -> Weight { // Proof Size summary in bytes: - // Measured: `399` - // Estimated: `7618` - // Minimum execution time: 122_639_000 picoseconds. - Weight::from_parts(142_091_000, 0) - .saturating_add(Weight::from_parts(0, 7618)) + // Measured: `367` + // Estimated: `2543` + // Minimum execution time: 62_242_000 picoseconds. + Weight::from_parts(62_690_000, 0) + .saturating_add(Weight::from_parts(0, 2543)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs index 3959e424c26..2b4b5ac716b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs @@ -62,4 +62,76 @@ impl pallet_bridge_relayers::WeightInfo for WeightInfo< .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(2)) } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + fn register() -> Weight { + // Proof Size summary in bytes: + // Measured: `87` + // Estimated: `7843` + // Minimum execution time: 39_590 nanoseconds. + Weight::from_parts(40_546_000, 7843) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + fn deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `264` + // Estimated: `7843` + // Minimum execution time: 43_332 nanoseconds. + Weight::from_parts(45_087_000, 7843) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(64), added: 2539, + /// mode: MaxEncodedLen) + /// + /// Storage: Balances Reserves (r:1 w:1) + /// + /// Proof: Balances Reserves (max_values: None, max_size: Some(849), added: 3324, mode: + /// MaxEncodedLen) + /// + /// Storage: System Account (r:1 w:1) + /// + /// Proof: System Account (max_values: None, max_size: Some(104), added: 2579, mode: + /// MaxEncodedLen) + fn slash_and_deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `380` + // Estimated: `11412` + // Minimum execution time: 42_358 nanoseconds. + Weight::from_parts(43_539_000, 11412) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(65), added: 2540, + /// mode: MaxEncodedLen) + fn register_relayer_reward() -> Weight { + // Proof Size summary in bytes: + // Measured: `12` + // Estimated: `3530` + // Minimum execution time: 6_338 nanoseconds. + Weight::from_parts(6_526_000, 3530) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs index 6472867bfbc..23f4f1cb27b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_xcm.rs @@ -170,6 +170,15 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_218_000 picoseconds. + Weight::from_parts(3_311_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index af2b8ba7868..91fd15136bb 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -29,6 +29,10 @@ use frame_support::{ }; use frame_system::EnsureRoot; use pallet_xcm::XcmPassthrough; +use parachains_common::{ + impls::ToStakingPot, + xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, +}; use polkadot_parachain::primitives::Sibling; use sp_core::Get; use xcm::latest::prelude::*; @@ -45,11 +49,6 @@ use xcm_executor::{ XcmExecutor, }; -use parachains_common::xcm_config::{ - ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry, -}; -use polkadot_runtime_common::impls::ToAuthor; - parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); @@ -200,9 +199,9 @@ pub type Barrier = DenyThenTry< AllowKnownQueryResponses, WithComputedOrigin< ( - // Allow anything to pay for execution. + // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent and its plurality (i.e. governance bodies) gets free execution. + // Parent and its pluralities (i.e. governance bodies) get free execution. AllowExplicitUnpaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, @@ -210,7 +209,8 @@ pub type Barrier = DenyThenTry< UniversalLocation, ConstU32<8>, >, - // TODO:check-parameter - supporting unpaid execution at first, then SovereignPaid + // TODO:check-parameter - (https://github.com/paritytech/parity-bridges-common/issues/2084) + // remove this and extend `AllowExplicitUnpaidExecutionFrom` with "or SystemParachains" once merged https://github.com/paritytech/polkadot/pull/7005 AllowUnpaidExecutionFrom, ), >; @@ -234,7 +234,7 @@ impl xcm_executor::Config for XcmConfig { MaxInstructions, >; type Trader = - UsingComponents>; + UsingComponents>; type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; type AssetClaims = PolkadotXcm; @@ -275,7 +275,7 @@ impl pallet_xcm::Config for Runtime { type SendXcmOrigin = EnsureXcmOrigin; // We support local origins dispatching XCM executions in principle... type ExecuteXcmOrigin = EnsureXcmOrigin; - type XcmExecuteFilter = Everything; + type XcmExecuteFilter = Nothing; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Everything; type XcmReserveTransferFilter = Nothing; // This parachain is not meant as a reserve location. diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs index 84cdb3ecb4c..a31171ba609 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Parity Technologies (UK) Ltd. +// Copyright 2023 Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -14,257 +14,212 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -use bp_messages::target_chain::MessageDispatch; -use bp_runtime::messages::MessageDispatchResult; pub use bridge_hub_rococo_runtime::{ - xcm_config::{XcmConfig, XcmRouter}, - Runtime, *, + constants::fee::WeightToFee, + xcm_config::{RelayNetwork, XcmConfig, XcmRouter}, + Balances, BridgeGrandpaRococoInstance, BridgeGrandpaWococoInstance, BridgeWococoMessages, + ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, + SessionKeys, }; -use codec::Encode; +use codec::{Decode, Encode}; use xcm::latest::prelude::*; -use bridge_hub_test_utils::*; -use bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatchResult; -use frame_support::weights::Weight; -use xcm_builder::DispatchBlobError; -use xcm_executor::XcmExecutor; - -fn execute_on_runtime( - with_para_id: u32, - open_hrmp_to_para_id: Option, - execute: impl FnOnce() -> R, -) -> R { - new_test_ext::(with_para_id.into(), 3).execute_with(|| { - if let Some(open_hrmp_to_para_id) = open_hrmp_to_para_id { - mock_open_hrmp_channel::( - with_para_id.into(), - open_hrmp_to_para_id.into(), - ); - } - execute() - }) -} - -#[test] -fn dispatch_blob_and_xcm_routing_works_on_bridge_hub_wococo() { - let universal_source_as_senders = - vec![X1(GlobalConsensus(Rococo)), X2(GlobalConsensus(Rococo), Parachain(1000))]; - let runtime_para_id = bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID; - let destination_network_id = Wococo; - let destination_para_id = 1000; - - for univeral_source_as_sender in universal_source_as_senders { - // 1. message is sent to other global consensus - Wococo(Here) - let bridging_message = - simulate_export_message::( - univeral_source_as_sender, - destination_network_id, - Here, - dummy_xcm(), - ); - let result: MessageDispatchResult = execute_on_runtime( - runtime_para_id, - None, - || { - <>::MessageDispatch as MessageDispatch<_>>::dispatch( - &dummy_account(), - wrap_as_dispatch_message(bridging_message) - ) - }, - ); - assert_eq!(result.dispatch_level_result, XcmBlobMessageDispatchResult::Dispatched); - - // 2. message is sent to other global consensus and its parachains - Wococo(Here) - let bridging_message = - simulate_export_message::( - univeral_source_as_sender, - destination_network_id, - X1(Parachain(destination_para_id)), - dummy_xcm(), - ); - - // 2.1. WITHOUT hrmp channel -> RoutingError - let result: MessageDispatchResult = execute_on_runtime( - runtime_para_id, - None, - || { - <>::MessageDispatch as MessageDispatch<_>>::dispatch( - &dummy_account(), - wrap_as_dispatch_message(bridging_message.clone()) - ) - }, - ); - assert_eq!( - result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched(Some(DispatchBlobError::RoutingError)) - ); - - // 2.1. WITH hrmp channel -> Ok - let result: MessageDispatchResult = execute_on_runtime( - runtime_para_id, - Some(destination_para_id), - || { - <>::MessageDispatch as MessageDispatch<_>>::dispatch( - &dummy_account(), - wrap_as_dispatch_message(bridging_message.clone()) - ) - }, - ); - assert_eq!(result.dispatch_level_result, XcmBlobMessageDispatchResult::Dispatched); - } -} - -#[test] -fn dispatch_blob_and_xcm_routing_works_on_bridge_hub_rococo() { - let universal_source_as_senders = - vec![X1(GlobalConsensus(Wococo)), X2(GlobalConsensus(Wococo), Parachain(1000))]; - let runtime_para_id = bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID; - let destination_network_id = Rococo; - let destination_para_id = 1000; - - for univeral_source_as_sender in universal_source_as_senders { - // 1. message is sent to other global consensus - Wococo(Here) - let bridging_message = - simulate_export_message::( - univeral_source_as_sender, - destination_network_id, - Here, - dummy_xcm(), - ); - let result: MessageDispatchResult = execute_on_runtime( - runtime_para_id, - None, - || { - <>::MessageDispatch as MessageDispatch<_>>::dispatch( - &dummy_account(), - wrap_as_dispatch_message(bridging_message) - ) - }, - ); - assert_eq!(result.dispatch_level_result, XcmBlobMessageDispatchResult::Dispatched); +use bridge_hub_rococo_runtime::{ + bridge_hub_rococo_config, bridge_hub_wococo_config, WithBridgeHubRococoMessagesInstance, + WithBridgeHubWococoMessagesInstance, +}; - // 2. message is sent to other global consensus and its parachains - Wococo(Here) - let bridging_message = - simulate_export_message::( - univeral_source_as_sender, - destination_network_id, - X1(Parachain(destination_para_id)), - dummy_xcm(), - ); +use frame_support::parameter_types; +use parachains_common::{AccountId, AuraId}; - // 2.1. WITHOUT hrmp channel -> RoutingError - let result: MessageDispatchResult = execute_on_runtime( - runtime_para_id, - None, - || { - <>::MessageDispatch as MessageDispatch<_>>::dispatch( - &dummy_account(), - wrap_as_dispatch_message(bridging_message.clone()) - ) - }, - ); - assert_eq!( - result.dispatch_level_result, - XcmBlobMessageDispatchResult::NotDispatched(Some(DispatchBlobError::RoutingError)) - ); +const ALICE: [u8; 32] = [1u8; 32]; - // 2.1. WITH hrmp channel -> Ok - let result: MessageDispatchResult = execute_on_runtime( - runtime_para_id, - Some(destination_para_id), - || { - <>::MessageDispatch as MessageDispatch<_>>::dispatch( - &dummy_account(), - wrap_as_dispatch_message(bridging_message.clone()) - ) - }, - ); - assert_eq!(result.dispatch_level_result, XcmBlobMessageDispatchResult::Dispatched); - } +parameter_types! { + pub CheckingAccount: AccountId = PolkadotXcm::check_account(); } -#[test] -fn can_govornance_call_xcm_transact_with_initialize_on_bridge_hub_rococo() { - // prepare xcm as govornance will do - let initialize_call: RuntimeCall = - RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< - Runtime, - BridgeGrandpaRococoInstance, - >::initialize { - init_data: mock_initialiation_data(), - }); - let xcm = Xcm(vec![ - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - Transact { - origin_kind: OriginKind::Superuser, - require_weight_at_most: Weight::from_parts(1000000000, 0), - call: initialize_call.encode().into(), - }, - ]); - // origin as relay chain - let origin = MultiLocation { parents: 1, interior: Here }; - - execute_on_runtime(bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, None, || { - // check mode before - assert_eq!( - pallet_bridge_grandpa::PalletOperatingMode::::try_get(), - Err(()) - ); - - // initialize bridge through governance-like - let hash = xcm.using_encoded(sp_io::hashing::blake2_256); - let weight_limit = Weight::from_parts(41666666666, 0); - let outcome = XcmExecutor::::execute_xcm(origin, xcm, hash, weight_limit); - - // check mode after - assert_eq!(outcome.ensure_complete(), Ok(())); - assert_eq!( - pallet_bridge_grandpa::PalletOperatingMode::::try_get(), - Ok(bp_runtime::BasicOperatingMode::Normal) - ); - }) +mod bridge_hub_rococo_tests { + use super::*; + + bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!( + Runtime, + XcmConfig, + CheckingAccount, + WeightToFee, + ParachainSystem, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + ExistentialDeposit::get(), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID + ); + + bridge_hub_test_utils::include_initialize_bridge_by_governance_works!( + Runtime, + BridgeGrandpaWococoInstance, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::BridgeWococoGrandpa(call).encode()) + ); + + bridge_hub_test_utils::include_handle_export_message_from_system_parachain_to_outbound_queue_works!( + Runtime, + XcmConfig, + WithBridgeHubWococoMessagesInstance, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + 1000, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeWococoMessages(event)) => Some(event), + _ => None, + } + }), + || ExportMessage { network: Wococo, destination: X1(Parachain(1234)), xcm: Xcm(vec![]) }, + bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO + ); + + bridge_hub_test_utils::include_message_dispatch_routing_works!( + Runtime, + XcmConfig, + ParachainSystem, + WithBridgeHubWococoMessagesInstance, + RelayNetwork, + bridge_hub_rococo_config::WococoGlobalConsensusNetwork, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID, + 1000, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::ParachainSystem(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + bridge_hub_rococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO + ); } -#[test] -fn can_govornance_call_xcm_transact_with_initialize_bridge_on_bridge_hub_wococo() { - // prepare xcm as govornance will do - let initialize_call: RuntimeCall = - RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< - Runtime, - BridgeGrandpaWococoInstance, - >::initialize { - init_data: mock_initialiation_data(), - }); - let xcm = Xcm(vec![ - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - Transact { - origin_kind: OriginKind::Superuser, - require_weight_at_most: Weight::from_parts(1000000000, 0), - call: initialize_call.encode().into(), - }, - ]); - // origin as relay chain - let origin = MultiLocation { parents: 1, interior: Here }; - - execute_on_runtime(bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, None, || { - // check mode before - assert_eq!( - pallet_bridge_grandpa::PalletOperatingMode::::try_get(), - Err(()) - ); - - // initialize bridge through governance-like - let hash = xcm.using_encoded(sp_io::hashing::blake2_256); - let weight_limit = Weight::from_parts(41666666666, 0); - let outcome = XcmExecutor::::execute_xcm(origin, xcm, hash, weight_limit); - - // check mode after - assert_eq!(outcome.ensure_complete(), Ok(())); - assert_eq!( - pallet_bridge_grandpa::PalletOperatingMode::::try_get(), - Ok(bp_runtime::BasicOperatingMode::Normal) - ); - }) +mod bridge_hub_wococo_tests { + use super::*; + + bridge_hub_test_utils::test_cases::include_teleports_for_native_asset_works!( + Runtime, + XcmConfig, + CheckingAccount, + WeightToFee, + ParachainSystem, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + ExistentialDeposit::get(), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::PolkadotXcm(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID + ); + + bridge_hub_test_utils::include_initialize_bridge_by_governance_works!( + Runtime, + BridgeGrandpaRococoInstance, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + Box::new(|call| RuntimeCall::BridgeRococoGrandpa(call).encode()) + ); + + bridge_hub_test_utils::include_handle_export_message_from_system_parachain_to_outbound_queue_works!( + Runtime, + XcmConfig, + WithBridgeHubRococoMessagesInstance, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + 1000, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::BridgeRococoMessages(event)) => Some(event), + _ => None, + } + }), + || ExportMessage { network: Rococo, destination: X1(Parachain(4321)), xcm: Xcm(vec![]) }, + bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO + ); + + bridge_hub_test_utils::include_message_dispatch_routing_works!( + Runtime, + XcmConfig, + ParachainSystem, + WithBridgeHubRococoMessagesInstance, + RelayNetwork, + bridge_hub_wococo_config::RococoGlobalConsensusNetwork, + bridge_hub_test_utils::CollatorSessionKeys::new( + AccountId::from(ALICE), + AccountId::from(ALICE), + SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) } + ), + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID, + 1000, + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::ParachainSystem(event)) => Some(event), + _ => None, + } + }), + Box::new(|runtime_event_encoded: Vec| { + match RuntimeEvent::decode(&mut &runtime_event_encoded[..]) { + Ok(RuntimeEvent::XcmpQueue(event)) => Some(event), + _ => None, + } + }), + bridge_hub_wococo_config::DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO + ); } - -// TODO:check-parameter - add test for DeliveryConfirmationPayments when receive_messages_delivery_proof diff --git a/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml b/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml index 123bbfb501a..096c777901a 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml @@ -6,22 +6,26 @@ edition = "2021" description = "Utils for BridgeHub testing" [dependencies] +codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } +log = { version = "0.4.17", default-features = false } # Substrate frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } # Cumulus -parachains-common = { path = "../../../common", default-features = false } -cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false } +cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-features = false } +pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false } cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false } -cumulus-primitives-parachain-inherent = { path = "../../../../primitives/parachain-inherent", default-features = false } -cumulus-test-relay-sproof-builder = { path = "../../../../test/relay-sproof-builder", default-features = false } +cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false } parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } +asset-test-utils = { path = "../../assets/test-utils"} # Polkadot -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } pallet-xcm-benchmarks = { git = "https://github.com/paritytech/polkadot", branch = "master", default-features = false, optional = true } xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } @@ -34,10 +38,15 @@ bp-messages = { path = "../../../../bridges/primitives/messages", default-featur bp-polkadot-core = { path = "../../../../bridges/primitives/polkadot-core", default-features = false } bp-runtime = { path = "../../../../bridges/primitives/runtime", default-features = false } bp-test-utils = { path = "../../../../bridges/primitives/test-utils", default-features = false } +pallet-bridge-grandpa = { path = "../../../../bridges/modules/grandpa", default-features = false } +pallet-bridge-messages = { path = "../../../../bridges/modules/messages", default-features = false } +bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", default-features = false } [features] default = [ "std" ] std = [ + "codec/std", + "log/std", "frame-support/std", "frame-system/std", "bp-messages/std", @@ -45,16 +54,20 @@ std = [ "bp-header-chain/std", "bp-runtime/std", "bp-test-utils/std", - "parachains-common/std", + "bridge-runtime-common/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", "parachain-info/std", - "cumulus-primitives-core/std", "cumulus-pallet-parachain-system/std", - "cumulus-primitives-parachain-inherent/std", - "cumulus-test-relay-sproof-builder/std", - "polkadot-parachain/std", + "cumulus-pallet-xcmp-queue/std", "pallet-xcm/std", + "sp-io/std", "sp-runtime/std", "xcm/std", "xcm-builder/std", "xcm-executor/std", + "asset-test-utils/std", + "cumulus-pallet-dmp-queue/std", + "pallet-session/std", + "pallet-balances/std", ] diff --git a/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs b/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs index 0605677c4df..b65b25c525d 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Parity Technologies (UK) Ltd. +// Copyright 2023 Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -14,197 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . -use bp_messages::{ - target_chain::{DispatchMessage, DispatchMessageData}, - LaneId, MessageKey, -}; -use cumulus_primitives_core::{AbridgedHrmpChannel, ParaId, PersistedValidationData}; -use cumulus_primitives_parachain_inherent::ParachainInherentData; -use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; -use frame_support::{ - dispatch::{RawOrigin, UnfilteredDispatchable}, - inherent::{InherentData, ProvideInherent}, - sp_io, - traits::Get, -}; -use parachains_common::AccountId; -use polkadot_parachain::primitives::{HrmpChannelId, RelayChainBlockNumber}; -use xcm::{latest::prelude::*, prelude::XcmVersion}; -use xcm_builder::{HaulBlob, HaulBlobError, HaulBlobExporter}; -use xcm_executor::traits::{validate_export, ExportXcm}; - pub use bp_test_utils::test_header; - -/// Dummy xcm -pub fn dummy_xcm() -> Xcm<()> { - vec![Trap(42)].into() -} - -pub fn wrap_as_dispatch_message(payload: Vec) -> DispatchMessage> { - DispatchMessage { - key: MessageKey { lane_id: LaneId([0, 0, 0, 0]), nonce: 1 }, - data: DispatchMessageData { payload: Ok(payload) }, - } -} - -/// Dummy account -pub fn dummy_account() -> AccountId { - AccountId::from([0u8; 32]) -} - -/// Macro used for simulate_export_message and capturing bytes -macro_rules! grab_haul_blob ( - ($name:ident, $grabbed_payload:ident) => { - std::thread_local! { - static $grabbed_payload: std::cell::RefCell>> = std::cell::RefCell::new(None); - } - - struct $name; - impl HaulBlob for $name { - fn haul_blob(blob: Vec) -> Result<(), HaulBlobError>{ - $grabbed_payload.with(|rm| *rm.borrow_mut() = Some(blob)); - Ok(()) - } - } - } -); - -/// Simulates HaulBlobExporter and all its wrapping and captures generated plain bytes -pub fn simulate_export_message>( - sender: Junctions, - destination_network: NetworkId, - destination: Junctions, - xcm: xcm::v3::Xcm<()>, -) -> Vec { - grab_haul_blob!(GrabbingHaulBlob, GRABBED_HAUL_BLOB_PAYLOAD); - - let channel = 1_u32; - let universal_source = sender; - - // simulate XCM message export - let (ticket, fee) = validate_export::>( - destination_network, - channel, - universal_source, - destination, - xcm, - ) - .expect("validate_export error"); - println!("[MessageExporter::fee] {:?}", fee); - let result = HaulBlobExporter::::deliver(ticket) - .expect("deliver error"); - println!("[MessageExporter::deliver] {:?}", result); - - GRABBED_HAUL_BLOB_PAYLOAD.with(|r| r.take().expect("xcm::ExportMessage should be here")) -} - -/// Initialize runtime/externalities -pub fn new_test_ext( - para_id: ParaId, - xcm_version: XcmVersion, -) -> sp_io::TestExternalities { - frame_support::sp_tracing::try_init_simple(); - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(xcm_version) }, - &mut t, - ) - .unwrap(); - >::assimilate_storage( - ¶chain_info::GenesisConfig { parachain_id: para_id }, - &mut t, - ) - .unwrap(); - - sp_io::TestExternalities::new(t) -} - -/// Helper function which emulates opening HRMP channel which is needed for XcmpQueue xcm router to pass -pub fn mock_open_hrmp_channel< - C: cumulus_pallet_parachain_system::Config, - T: ProvideInherent>, ->( - sender: ParaId, - recipient: ParaId, -) { - let n = 1_u32; - let mut sproof_builder = RelayStateSproofBuilder::default(); - sproof_builder.para_id = sender; - sproof_builder.hrmp_channels.insert( - HrmpChannelId { sender, recipient }, - AbridgedHrmpChannel { - max_capacity: 10, - max_total_size: 10_000_000_u32, - max_message_size: 10_000_000_u32, - msg_count: 10, - total_size: 10_000_000_u32, - mqc_head: None, - }, - ); - sproof_builder.hrmp_egress_channel_index = Some(vec![recipient]); - - let (relay_parent_storage_root, relay_chain_state) = sproof_builder.into_state_root_and_proof(); - let vfp = PersistedValidationData { - relay_parent_number: n as RelayChainBlockNumber, - relay_parent_storage_root, - ..Default::default() - }; - // It is insufficient to push the validation function params - // to storage; they must also be included in the inherent data. - let inherent_data = { - let mut inherent_data = InherentData::default(); - let system_inherent_data = ParachainInherentData { - validation_data: vfp.clone(), - relay_chain_state, - downward_messages: Default::default(), - horizontal_messages: Default::default(), - }; - inherent_data - .put_data( - cumulus_primitives_parachain_inherent::INHERENT_IDENTIFIER, - &system_inherent_data, - ) - .expect("failed to put VFP inherent"); - inherent_data - }; - - // execute the block - T::create_inherent(&inherent_data) - .expect("got an inherent") - .dispatch_bypass_filter(RawOrigin::None.into()) - .expect("dispatch succeeded"); -} - -pub type RelayBlockNumber = bp_polkadot_core::BlockNumber; -pub type RelayBlockHasher = bp_polkadot_core::Hasher; -pub type RelayBlockHeader = sp_runtime::generic::Header; - -/// Helper that creates InitializationData mock data, that can be used to initialize bridge GRANDPA pallet -pub fn mock_initialiation_data() -> bp_header_chain::InitializationData { - use sp_runtime::traits::Header; - use std::str::FromStr; - - let header = RelayBlockHeader::new( - 75, - bp_polkadot_core::Hash::from_str( - "0xd2c0afaab32de0cb8f7f0d89217e37c5ea302c1ffb5a7a83e10d20f12c32874d", - ) - .expect("invalid value"), - bp_polkadot_core::Hash::from_str( - "0x92b965f0656a4e0e5fc0167da2d4b5ee72b3be2c1583c4c1e5236c8c12aa141b", - ) - .expect("invalid value"), - bp_polkadot_core::Hash::from_str( - "0xae4a25acf250d72ed02c149ecc7dd3c9ee976d41a2888fc551de8064521dc01d", - ) - .expect("invalid value"), - Default::default(), - ); - bp_header_chain::InitializationData { - header: Box::new(header), - authority_list: Default::default(), - set_id: 6, - operating_mode: bp_runtime::BasicOperatingMode::Normal, - } -} +pub mod test_cases; +pub use test_cases::CollatorSessionKeys; diff --git a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs new file mode 100644 index 00000000000..5cdc2af9968 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs @@ -0,0 +1,491 @@ +// Copyright 2023 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Module contains predefined test-case scenarios for `Runtime` with bridging capabilities. + +use codec::Encode; +use frame_support::{assert_ok, traits::Get}; +use xcm::latest::prelude::*; +use xcm_builder::DispatchBlobError; +use xcm_executor::XcmExecutor; + +// Lets re-use this stuff from assets (later we plan to move it outside of assets as `runtimes/test-utils`) +use asset_test_utils::{ + mock_open_hrmp_channel, AccountIdOf, ExtBuilder, RuntimeHelper, ValidatorIdOf, +}; + +// Re-export test_cases from assets +pub use asset_test_utils::{ + include_teleports_for_native_asset_works, CollatorSessionKeys, XcmReceivedFrom, +}; +use bp_messages::{ + target_chain::{DispatchMessage, DispatchMessageData, MessageDispatch}, + LaneId, MessageKey, OutboundLaneData, +}; +use bridge_runtime_common::messages_xcm_extension::{ + XcmAsPlainPayload, XcmBlobMessageDispatchResult, +}; + +/// Test-case makes sure that `Runtime` can process bridging initialize via governance-like call +pub fn initialize_bridge_by_governance_works( + collator_session_key: CollatorSessionKeys, + runtime_para_id: u32, + runtime_call_encode: Box< + dyn Fn(pallet_bridge_grandpa::Call) -> Vec, + >, +) where + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config + + pallet_collator_selection::Config + + cumulus_pallet_dmp_queue::Config + + cumulus_pallet_parachain_system::Config + + pallet_bridge_grandpa::Config, + GrandpaPalletInstance: 'static, + ValidatorIdOf: From>, +{ + ExtBuilder::::default() + .with_collators(collator_session_key.collators()) + .with_session_keys(collator_session_key.session_keys()) + .with_para_id(runtime_para_id.into()) + .with_tracing() + .build() + .execute_with(|| { + // check mode before + assert_eq!( + pallet_bridge_grandpa::PalletOperatingMode::::try_get(), + Err(()) + ); + + // encode `initialize` call + let initialize_call = runtime_call_encode(pallet_bridge_grandpa::Call::< + Runtime, + GrandpaPalletInstance, + >::initialize { + init_data: test_data::initialization_data::(12345), + }); + + // overestimate - check weight for `pallet_bridge_grandpa::Pallet::initialize()` call + let require_weight_at_most = + ::DbWeight::get().reads_writes(7, 7); + + // execute XCM with Transacts to initialize bridge as governance does + // prepare data for xcm::Transact(create) + assert_ok!(RuntimeHelper::::execute_as_governance( + initialize_call, + require_weight_at_most + ) + .ensure_complete()); + + // check mode after + assert_eq!( + pallet_bridge_grandpa::PalletOperatingMode::::try_get(), + Ok(bp_runtime::BasicOperatingMode::Normal) + ); + }) +} + +#[macro_export] +macro_rules! include_initialize_bridge_by_governance_works( + ( + $runtime:path, + $pallet_bridge_grandpa_instance:path, + $collator_session_key:expr, + $runtime_para_id:expr, + $runtime_call_encode:expr + ) => { + #[test] + fn initialize_bridge_by_governance_works() { + $crate::test_cases::initialize_bridge_by_governance_works::< + $runtime, + $pallet_bridge_grandpa_instance, + >( + $collator_session_key, + $runtime_para_id, + $runtime_call_encode + ) + } + } +); + +/// Test-case makes sure that `Runtime` can handle xcm `ExportMessage`: +/// Checks if received XCM messages is correctly added to the message outbound queue for delivery. +/// For SystemParachains we expect unpaid execution. +pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< + Runtime, + XcmConfig, + MessagesPalletInstance, +>( + collator_session_key: CollatorSessionKeys, + runtime_para_id: u32, + sibling_parachain_id: u32, + unwrap_pallet_bridge_messages_event: Box< + dyn Fn(Vec) -> Option>, + >, + export_message_instruction: fn() -> Instruction, + expected_lane_id: LaneId, +) where + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config + + pallet_collator_selection::Config + + cumulus_pallet_dmp_queue::Config + + cumulus_pallet_parachain_system::Config + + pallet_bridge_messages::Config, + XcmConfig: xcm_executor::Config, + MessagesPalletInstance: 'static, + ValidatorIdOf: From>, +{ + assert_ne!(runtime_para_id, sibling_parachain_id); + let sibling_parachain_location = MultiLocation::new(1, Parachain(sibling_parachain_id)); + + ExtBuilder::::default() + .with_collators(collator_session_key.collators()) + .with_session_keys(collator_session_key.session_keys()) + .with_para_id(runtime_para_id.into()) + .with_tracing() + .build() + .execute_with(|| { + // check queue before + assert_eq!( + pallet_bridge_messages::OutboundLanes::::try_get( + &expected_lane_id + ), + Err(()) + ); + + // prepare `ExportMessage` + let xcm = Xcm(vec![ + UnpaidExecution { weight_limit: Unlimited, check_origin: None }, + export_message_instruction(), + ]); + + // execute XCM + let hash = xcm.using_encoded(sp_io::hashing::blake2_256); + assert_ok!(XcmExecutor::::execute_xcm( + sibling_parachain_location, + xcm, + hash, + RuntimeHelper::::xcm_max_weight(XcmReceivedFrom::Sibling), + ) + .ensure_complete()); + + // check queue after + assert_eq!( + pallet_bridge_messages::OutboundLanes::::try_get( + &expected_lane_id + ), + Ok(OutboundLaneData { + oldest_unpruned_nonce: 1, + latest_received_nonce: 0, + latest_generated_nonce: 1, + }) + ); + + // check events + let mut events = >::events() + .into_iter() + .filter_map(|e| unwrap_pallet_bridge_messages_event(e.event.encode())); + assert!( + events.any(|e| matches!(e, pallet_bridge_messages::Event::MessageAccepted { .. })) + ); + }) +} + +#[macro_export] +macro_rules! include_handle_export_message_from_system_parachain_to_outbound_queue_works( + ( + $runtime:path, + $xcm_config:path, + $pallet_bridge_messages_instance:path, + $collator_session_key:expr, + $runtime_para_id:expr, + $sibling_parachain_id:expr, + $unwrap_pallet_bridge_messages_event:expr, + $export_message_instruction:expr, + $expected_lane_id:expr + ) => { + #[test] + fn handle_export_message_from_system_parachain_add_to_outbound_queue_works() { + $crate::test_cases::handle_export_message_from_system_parachain_to_outbound_queue_works::< + $runtime, + $xcm_config, + $pallet_bridge_messages_instance + >( + $collator_session_key, + $runtime_para_id, + $sibling_parachain_id, + $unwrap_pallet_bridge_messages_event, + $export_message_instruction, + $expected_lane_id + ) + } + } +); + +/// Test-case makes sure that Runtime can route XCM messages received in inbound queue, +/// We just test here `MessageDispatch` configuration. +/// We expect that runtime can route messages: +/// 1. to Parent (relay chain) +/// 2. to Sibling parachain +pub fn message_dispatch_routing_works< + Runtime, + XcmConfig, + HrmpChannelOpener, + MessagesPalletInstance, + RuntimeNetwork, + BridgedNetwork, +>( + collator_session_key: CollatorSessionKeys, + runtime_para_id: u32, + sibling_parachain_id: u32, + unwrap_cumulus_pallet_parachain_system_event: Box< + dyn Fn(Vec) -> Option>, + >, + unwrap_cumulus_pallet_xcmp_queue_event: Box< + dyn Fn(Vec) -> Option>, + >, + expected_lane_id: LaneId, +) where + Runtime: frame_system::Config + + pallet_balances::Config + + pallet_session::Config + + pallet_xcm::Config + + parachain_info::Config + + pallet_collator_selection::Config + + cumulus_pallet_dmp_queue::Config + + cumulus_pallet_parachain_system::Config + + cumulus_pallet_xcmp_queue::Config + + pallet_bridge_messages::Config, + XcmConfig: xcm_executor::Config, + MessagesPalletInstance: 'static, + ValidatorIdOf: From>, + HrmpChannelOpener: frame_support::inherent::ProvideInherent< + Call = cumulus_pallet_parachain_system::Call, + >, + // MessageDispatcher: MessageDispatch, DispatchLevelResult = XcmBlobMessageDispatchResult, DispatchPayload = XcmAsPlainPayload>, + RuntimeNetwork: Get, + BridgedNetwork: Get, +{ + assert_ne!(runtime_para_id, sibling_parachain_id); + + ExtBuilder::::default() + .with_collators(collator_session_key.collators()) + .with_session_keys(collator_session_key.session_keys()) + .with_safe_xcm_version(XCM_VERSION) + .with_para_id(runtime_para_id.into()) + .with_tracing() + .build() + .execute_with(|| { + // 1. this message is sent from other global consensus with destination of this Runtime relay chain (UMP) + let bridging_message = + test_data::simulate_message_exporter_on_bridged_chain::( + (RuntimeNetwork::get(), Here) + ); + let result = <>::MessageDispatch>::dispatch( + test_data::dispatch_message(expected_lane_id, 1, bridging_message) + ); + assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)); + + // check events - UpwardMessageSent + let mut events = >::events() + .into_iter() + .filter_map(|e| unwrap_cumulus_pallet_parachain_system_event(e.event.encode())); + assert!( + events.any(|e| matches!(e, cumulus_pallet_parachain_system::Event::UpwardMessageSent { .. })) + ); + + // 2. this message is sent from other global consensus with destination of this Runtime sibling parachain (HRMP) + let bridging_message = + test_data::simulate_message_exporter_on_bridged_chain::( + (RuntimeNetwork::get(), X1(Parachain(sibling_parachain_id))), + ); + + // 2.1. WITHOUT opened hrmp channel -> RoutingError + let result = + <>::MessageDispatch>::dispatch( + DispatchMessage { + key: MessageKey { lane_id: expected_lane_id, nonce: 1 }, + data: DispatchMessageData { payload: Ok(bridging_message.clone()) }, + } + ); + assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::NotDispatched(Some(DispatchBlobError::RoutingError)))); + + // check events - no XcmpMessageSent + assert_eq!(>::events() + .into_iter() + .filter_map(|e| unwrap_cumulus_pallet_xcmp_queue_event(e.event.encode())) + .count(), 0); + + // 2.1. WITH hrmp channel -> Ok + mock_open_hrmp_channel::(runtime_para_id.into(), sibling_parachain_id.into()); + let result = <>::MessageDispatch>::dispatch( + DispatchMessage { + key: MessageKey { lane_id: expected_lane_id, nonce: 1 }, + data: DispatchMessageData { payload: Ok(bridging_message) }, + } + ); + assert_eq!(format!("{:?}", result.dispatch_level_result), format!("{:?}", XcmBlobMessageDispatchResult::Dispatched)); + + // check events - XcmpMessageSent + let mut events = >::events() + .into_iter() + .filter_map(|e| unwrap_cumulus_pallet_xcmp_queue_event(e.event.encode())); + assert!( + events.any(|e| matches!(e, cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. })) + ); + }) +} + +#[macro_export] +macro_rules! include_message_dispatch_routing_works( + ( + $runtime:path, + $xcm_config:path, + $hrmp_channel_opener:path, + $pallet_bridge_messages_instance:path, + $runtime_network:path, + $bridged_network:path, + $collator_session_key:expr, + $runtime_para_id:expr, + $sibling_parachain_id:expr, + $unwrap_cumulus_pallet_parachain_system_event:expr, + $unwrap_cumulus_pallet_xcmp_queue_event:expr, + $expected_lane_id:expr + ) => { + #[test] + fn message_dispatch_routing_works() { + $crate::test_cases::message_dispatch_routing_works::< + $runtime, + $xcm_config, + $hrmp_channel_opener, + $pallet_bridge_messages_instance, + $runtime_network, + $bridged_network + >( + $collator_session_key, + $runtime_para_id, + $sibling_parachain_id, + $unwrap_cumulus_pallet_parachain_system_event, + $unwrap_cumulus_pallet_xcmp_queue_event, + $expected_lane_id, + ) + } + } +); + +mod test_data { + use super::*; + use bp_messages::MessageNonce; + use xcm_builder::{HaulBlob, HaulBlobError, HaulBlobExporter}; + use xcm_executor::traits::{validate_export, ExportXcm}; + + /// Helper that creates InitializationData mock data, that can be used to initialize bridge GRANDPA pallet + pub(crate) fn initialization_data< + Runtime: pallet_bridge_grandpa::Config, + GrandpaPalletInstance: 'static, + >( + block_number: u32, + ) -> bp_header_chain::InitializationData< + pallet_bridge_grandpa::BridgedHeader, + > { + bp_header_chain::InitializationData { + header: Box::new(bp_test_utils::test_header(block_number.into())), + authority_list: Default::default(), + set_id: 6, + operating_mode: bp_runtime::BasicOperatingMode::Normal, + } + } + + /// Dummy xcm + pub(crate) fn dummy_xcm() -> Xcm<()> { + vec![Trap(42)].into() + } + + pub(crate) fn dispatch_message( + lane_id: LaneId, + nonce: MessageNonce, + payload: Vec, + ) -> DispatchMessage> { + DispatchMessage { + key: MessageKey { lane_id, nonce }, + data: DispatchMessageData { payload: Ok(payload) }, + } + } + + /// Macro used for simulate_export_message and capturing bytes + macro_rules! grab_haul_blob ( + ($name:ident, $grabbed_payload:ident) => { + std::thread_local! { + static $grabbed_payload: std::cell::RefCell>> = std::cell::RefCell::new(None); + } + + struct $name; + impl HaulBlob for $name { + fn haul_blob(blob: Vec) -> Result<(), HaulBlobError>{ + $grabbed_payload.with(|rm| *rm.borrow_mut() = Some(blob)); + Ok(()) + } + } + } + ); + + /// Simulates `HaulBlobExporter` and all its wrapping and captures generated plain bytes, + /// which are transfered over bridge. + pub(crate) fn simulate_message_exporter_on_bridged_chain< + SourceNetwork: Get, + DestinationNetwork: Get, + >( + (destination_network, destination_junctions): (NetworkId, Junctions), + ) -> Vec { + grab_haul_blob!(GrabbingHaulBlob, GRABBED_HAUL_BLOB_PAYLOAD); + + // lets pretend that some parachain on bridged chain exported the message + let universal_source_on_bridged_chain = + X2(GlobalConsensus(SourceNetwork::get()), Parachain(5678)); + let channel = 1_u32; + + // simulate XCM message export + let (ticket, fee) = + validate_export::>( + destination_network, + channel, + universal_source_on_bridged_chain, + destination_junctions, + dummy_xcm(), + ) + .expect("validate_export to pass"); + log::info!( + target: "simulate_message_exporter_on_bridged_chain", + "HaulBlobExporter::validate fee: {:?}", + fee + ); + let xcm_hash = + HaulBlobExporter::::deliver(ticket) + .expect("deliver to pass"); + log::info!( + target: "simulate_message_exporter_on_bridged_chain", + "HaulBlobExporter::deliver xcm_hash: {:?}", + xcm_hash + ); + + GRABBED_HAUL_BLOB_PAYLOAD.with(|r| r.take().expect("Encoded message should be here")) + } +} diff --git a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml index 3f5c956d454..13fe985a63b 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml +++ b/parachains/runtimes/collectives/collectives-polkadot/Cargo.toml @@ -9,7 +9,7 @@ description = "Polkadot Collectives Parachain Runtime" codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive", "max-encoded-len"] } hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 6e53920201c..e0f95cb052b 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -450,6 +450,7 @@ pub const ALLIANCE_MOTION_DURATION: BlockNumber = 5 * DAYS; parameter_types! { pub const AllianceMotionDuration: BlockNumber = ALLIANCE_MOTION_DURATION; + pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; } pub const ALLIANCE_MAX_PROPOSALS: u32 = 100; pub const ALLIANCE_MAX_MEMBERS: u32 = 100; @@ -465,6 +466,7 @@ impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote; type SetMembersOrigin = EnsureRoot; type WeightInfo = weights::pallet_collective::WeightInfo; + type MaxProposalWeight = MaxProposalWeight; } pub const MAX_FELLOWS: u32 = ALLIANCE_MAX_MEMBERS; diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs index 43fee0b52e6..43823d56560 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/weights/pallet_xcm.rs @@ -170,6 +170,15 @@ impl pallet_xcm::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) } + fn force_suspension() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_994_000 picoseconds. + Weight::from_parts(3_125_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } /// Storage: PolkadotXcm SupportedVersion (r:4 w:2) /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) fn migrate_supported_version() -> Weight { diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs index 9c1fda61bd8..b2b93d88ffe 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs @@ -204,7 +204,7 @@ pub type Barrier = DenyThenTry< ( // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent and its plurality (i.e. governance bodies) gets free execution. + // Parent and its pluralities (i.e. governance bodies) get free execution. AllowExplicitUnpaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, diff --git a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml index 10f222713f9..74186c0e53c 100644 --- a/parachains/runtimes/contracts/contracts-rococo/Cargo.toml +++ b/parachains/runtimes/contracts/contracts-rococo/Cargo.toml @@ -14,7 +14,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.17", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate diff --git a/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs b/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs index 27a16a6357e..f184dfd4ff8 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/contracts.rs @@ -18,6 +18,7 @@ pub const CONTRACTS_DEBUG_OUTPUT: bool = true; parameter_types! { pub const DepositPerItem: Balance = deposit(1, 0); pub const DepositPerByte: Balance = deposit(0, 1); + pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024); pub MySchedule: Schedule = Default::default(); } @@ -36,6 +37,7 @@ impl Config for Runtime { type CallFilter = Nothing; type DepositPerItem = DepositPerItem; type DepositPerByte = DepositPerByte; + type DefaultDepositLimit = DefaultDepositLimit; type WeightPrice = pallet_transaction_payment::Pallet; type WeightInfo = SubstrateWeight; type ChainExtension = (); diff --git a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs index d8ed043fb54..1b42819b423 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs @@ -129,7 +129,7 @@ pub type Barrier = DenyThenTry< ( // If the message is one that immediately attemps to pay for execution, then allow it. AllowTopLevelPaidExecutionFrom, - // Parent and its plurality (i.e. governance bodies) gets free execution. + // Parent and its pluralities (i.e. governance bodies) get free execution. AllowExplicitUnpaidExecutionFrom, // Subscriptions for version tracking are OK. AllowSubscriptionsFrom, diff --git a/parachains/runtimes/starters/seedling/Cargo.toml b/parachains/runtimes/starters/seedling/Cargo.toml index 96ec9544009..0a9e05d4bb4 100644 --- a/parachains/runtimes/starters/seedling/Cargo.toml +++ b/parachains/runtimes/starters/seedling/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/starters/shell/Cargo.toml b/parachains/runtimes/starters/shell/Cargo.toml index a176e73906a..7332ff8d012 100644 --- a/parachains/runtimes/starters/shell/Cargo.toml +++ b/parachains/runtimes/starters/shell/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/parachains/runtimes/testing/penpal/Cargo.toml b/parachains/runtimes/testing/penpal/Cargo.toml index 460e3b1d4b4..2886d799a4c 100644 --- a/parachains/runtimes/testing/penpal/Cargo.toml +++ b/parachains/runtimes/testing/penpal/Cargo.toml @@ -18,7 +18,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } hex-literal = { version = "0.4.1", optional = true } log = { version = "0.4.16", default-features = false } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } smallvec = "1.10.0" # Substrate diff --git a/parachains/runtimes/testing/rococo-parachain/Cargo.toml b/parachains/runtimes/testing/rococo-parachain/Cargo.toml index ecf6acda9e3..9b3f993bb77 100644 --- a/parachains/runtimes/testing/rococo-parachain/Cargo.toml +++ b/parachains/runtimes/testing/rococo-parachain/Cargo.toml @@ -7,7 +7,7 @@ description = "Simple runtime used by the rococo parachain(s)" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, default-features = false, branch = "master" } diff --git a/polkadot-parachain/Cargo.toml b/polkadot-parachain/Cargo.toml index f5a9bc70eed..a5d9b9fc801 100644 --- a/polkadot-parachain/Cargo.toml +++ b/polkadot-parachain/Cargo.toml @@ -12,7 +12,7 @@ path = "src/main.rs" [dependencies] async-trait = "0.1.68" -clap = { version = "4.1.14", features = ["derive"] } +clap = { version = "4.2.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } futures = "0.3.28" hex-literal = "0.4.1" diff --git a/polkadot-parachain/src/chain_spec/bridge_hubs.rs b/polkadot-parachain/src/chain_spec/bridge_hubs.rs index 4c5b457db8d..670f5a9ced3 100644 --- a/polkadot-parachain/src/chain_spec/bridge_hubs.rs +++ b/polkadot-parachain/src/chain_spec/bridge_hubs.rs @@ -153,7 +153,7 @@ impl BridgeHubRuntimeType { |_| (), ))), BridgeHubRuntimeType::Wococo => - Ok(Box::new(rococo::BridgeHubChainSpec::from_json_bytes( + Ok(Box::new(wococo::BridgeHubChainSpec::from_json_bytes( &include_bytes!("../../../parachains/chain-specs/bridge-hub-wococo.json")[..], )?)), BridgeHubRuntimeType::WococoLocal => Ok(Box::new(wococo::local_config( diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 000ebef80fd..803d0987844 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -460,7 +460,7 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - sync_service, + sync_service.clone(), params.keystore_container.keystore(), force_authoring, )?; @@ -480,6 +480,7 @@ where collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_collator(params).await?; @@ -493,6 +494,7 @@ where relay_chain_slot_duration, import_queue: import_queue_service, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_full_node(params)?; @@ -659,7 +661,7 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - sync_service, + sync_service.clone(), params.keystore_container.keystore(), force_authoring, )?; @@ -679,6 +681,7 @@ where collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_collator(params).await?; @@ -692,6 +695,7 @@ where relay_chain_slot_duration, import_queue: import_queue_service, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_full_node(params)?; @@ -1429,7 +1433,7 @@ where &task_manager, relay_chain_interface.clone(), transaction_pool, - sync_service, + sync_service.clone(), params.keystore_container.keystore(), force_authoring, )?; @@ -1449,6 +1453,7 @@ where collator_key: collator_key.expect("Command line arguments do not allow this. qed"), relay_chain_slot_duration, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_collator(params).await?; @@ -1462,6 +1467,7 @@ where relay_chain_slot_duration, import_queue: import_queue_service, recovery_handle: Box::new(overseer_handle), + sync_service, }; start_full_node(params)?; diff --git a/primitives/core/Cargo.toml b/primitives/core/Cargo.toml index 8429cd0d0d3..b2adf290db1 100644 --- a/primitives/core/Cargo.toml +++ b/primitives/core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Substrate sp-api = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/primitives/parachain-inherent/Cargo.toml b/primitives/parachain-inherent/Cargo.toml index 2135802592b..ff7bfa8ae44 100644 --- a/primitives/parachain-inherent/Cargo.toml +++ b/primitives/parachain-inherent/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] async-trait = { version = "0.1.68", optional = true } codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = [ "derive" ] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } tracing = { version = "0.1.37", optional = true } # Substrate diff --git a/scripts/bridges_rococo_wococo.sh b/scripts/bridges_rococo_wococo.sh index 7cbed504f11..fa79ab884ab 100755 --- a/scripts/bridges_rococo_wococo.sh +++ b/scripts/bridges_rococo_wococo.sh @@ -233,7 +233,7 @@ function allow_assets_transfer_send() { ] } }, - "targetLocationFee": { + "maxTargetLocationFee": { "id": { "Concrete": { "parents": 1, @@ -597,7 +597,7 @@ case "$1" in "ws://127.0.0.1:9010" \ "//Alice" \ "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" \ - $((1000000000 + 50000000000 * 20)) # ExistentialDeposit + targetLocationFee * 20 + $((1000000000 + 50000000000 * 20)) # ExistentialDeposit + maxTargetLocationFee * 20 # create foreign assets for native Statemine token (yes, Kusama, because we are using Statemine runtime on rococo) force_create_foreign_asset \ "ws://127.0.0.1:9945" \ @@ -651,13 +651,6 @@ case "$1" in "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" \ $((1000000000 + 50000000000 * 20)) ;; - drip) - transfer_balance \ - "ws://127.0.0.1:9010" \ - "//Alice" \ - "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" \ - $((1000000000 + 50000000000 * 20)) - ;; stop) pkill -f polkadot pkill -f parachain diff --git a/scripts/ci/gitlab/pipeline/publish.yml b/scripts/ci/gitlab/pipeline/publish.yml index 84f0a576e3b..e59ff167698 100644 --- a/scripts/ci/gitlab/pipeline/publish.yml +++ b/scripts/ci/gitlab/pipeline/publish.yml @@ -2,7 +2,7 @@ # Here are all jobs that are executed during "publish" stage .build-push-image: - image: quay.io/buildah/stable:v1.27 + image: $BUILDAH_IMAGE variables: DOCKERFILE: "" # docker/path-to.Dockerfile IMAGE_NAME: "" # docker.io/paritypr/image_name @@ -10,7 +10,7 @@ script: - test "$PARITYPR_USER" -a "$PARITYPR_PASS" || ( echo "no docker credentials provided"; exit 1 ) - - buildah bud + - $BUILDAH_COMMAND build --format=docker --build-arg VCS_REF="${CI_COMMIT_SHA}" --build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')" @@ -19,8 +19,8 @@ --file ${DOCKERFILE} . - echo "$PARITYPR_PASS" | buildah login --username "$PARITYPR_USER" --password-stdin docker.io - - buildah info - - buildah push --format=v2s2 "$IMAGE_NAME:$VERSION" + - $BUILDAH_COMMAND info + - $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:$VERSION" after_script: - buildah logout --all diff --git a/test/relay-validation-worker-provider/Cargo.toml b/test/relay-validation-worker-provider/Cargo.toml index a363d3b7d61..e8cc1f16b9f 100644 --- a/test/relay-validation-worker-provider/Cargo.toml +++ b/test/relay-validation-worker-provider/Cargo.toml @@ -8,7 +8,7 @@ build = "build.rs" [dependencies] # Polkadot -polkadot-node-core-pvf = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-node-core-pvf-worker = { git = "https://github.com/paritytech/polkadot", branch = "master" } [build-dependencies] toml = "0.7.3" diff --git a/test/relay-validation-worker-provider/build.rs b/test/relay-validation-worker-provider/build.rs index 9b5247bcbe5..d2c894ac89d 100644 --- a/test/relay-validation-worker-provider/build.rs +++ b/test/relay-validation-worker-provider/build.rs @@ -97,7 +97,7 @@ fn create_project(out_dir: &Path) -> PathBuf { fs::write( project_dir.join("src").join("main.rs"), r#" - cumulus_test_relay_validation_worker_provider::polkadot_node_core_pvf::decl_puppet_worker_main!(); + cumulus_test_relay_validation_worker_provider::polkadot_node_core_pvf_worker::decl_puppet_worker_main!(); "#, ) .expect("Writes `main.rs`"); diff --git a/test/relay-validation-worker-provider/src/lib.rs b/test/relay-validation-worker-provider/src/lib.rs index 840214eb3c0..ccb896a276e 100644 --- a/test/relay-validation-worker-provider/src/lib.rs +++ b/test/relay-validation-worker-provider/src/lib.rs @@ -21,7 +21,7 @@ //! //! !!This should only be used for tests!! -pub use polkadot_node_core_pvf; +pub use polkadot_node_core_pvf_worker; /// The path to the validation worker. pub const VALIDATION_WORKER: &str = concat!(env!("OUT_DIR"), "/validation-worker"); diff --git a/test/runtime/Cargo.toml b/test/runtime/Cargo.toml index 619d01fce8d..cbba13e1a93 100644 --- a/test/runtime/Cargo.toml +++ b/test/runtime/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] } -scale-info = { version = "2.5.0", default-features = false, features = ["derive"] } +scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } # Substrate frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } diff --git a/test/service/Cargo.toml b/test/service/Cargo.toml index 062dbc834c3..f04632b3c20 100644 --- a/test/service/Cargo.toml +++ b/test/service/Cargo.toml @@ -10,7 +10,7 @@ path = "src/main.rs" [dependencies] async-trait = "0.1.68" -clap = { version = "4.1.14", features = ["derive"] } +clap = { version = "4.2.3", features = ["derive"] } codec = { package = "parity-scale-codec", version = "3.0.0" } criterion = { version = "0.4.0", features = [ "async_tokio" ] } jsonrpsee = { version = "0.16.2", features = ["server"] } diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index 5b38a53afb4..84d5636f9b1 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -433,6 +433,7 @@ where import_queue: import_queue_service, relay_chain_slot_duration: Duration::from_secs(6), recovery_handle, + sync_service, }; start_collator(params).await?; @@ -446,6 +447,7 @@ where import_queue: import_queue_service, relay_chain_slot_duration: Duration::from_secs(6), recovery_handle, + sync_service, }; start_full_node(params)?; From 0af0cc65b432b3d8c37b40e1133c709c67f69bf2 Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Wed, 3 May 2023 22:49:51 +0200 Subject: [PATCH 2/6] fixes from refactoring --- .../runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 82eb4b1bb49..2ebd4350ec3 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -650,15 +650,6 @@ parameter_types! { impl snowbridge_ethereum_beacon_client::Config for Runtime { type RuntimeEvent = RuntimeEvent; type TimeProvider = pallet_timestamp::Pallet; - type MaxSyncCommitteeSize = MaxSyncCommitteeSize; - type MaxProofBranchSize = MaxProofBranchSize; - type MaxExtraDataSize = MaxExtraDataSize; - type MaxLogsBloomSize = MaxLogsBloomSize; - type MaxFeeRecipientSize = MaxFeeRecipientSize; - type MaxPublicKeySize = MaxPublicKeySize; - type MaxSignatureSize = MaxSignatureSize; - type MaxSlotsPerHistoricalRoot = MaxSlotsPerHistoricalRoot; - type MaxFinalizedHeaderSlotArray = MaxFinalizedHeaderSlotArray; type ForkVersions = ChainForkVersions; type WeakSubjectivityPeriodSeconds = WeakSubjectivityPeriodSeconds; type WeightInfo = weights::snowbridge_ethereum_beacon_client::WeightInfo; @@ -719,7 +710,7 @@ construct_runtime!( // Ethereum Bridge EthereumInboundQueue: snowbridge_inbound_queue::{Pallet, Call, Config, Storage, Event} = 48, EthereumOutboundQueue: snowbridge_outbound_queue::{Pallet, Config, Storage, Event} = 49, - EthereumBeaconClient: snowbridge_ethereum_beacon_client::{Pallet, Call, Config, Storage, Event} = 50, + EthereumBeaconClient: snowbridge_ethereum_beacon_client::{Pallet, Call, Config, Storage, Event} = 50, } ); From 6d972b15ae408102e4c8428dc57e6834225fed0c Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Wed, 3 May 2023 23:09:17 +0200 Subject: [PATCH 3/6] updated lock file --- Cargo.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26590b81925..f49a7e85c40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6545,7 +6545,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -6566,7 +6566,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6584,7 +6584,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -6599,7 +6599,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -6914,7 +6914,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "bitflags", "environmental", @@ -6944,7 +6944,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "bitflags", "parity-scale-codec", @@ -6957,7 +6957,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro2", "quote", @@ -7150,7 +7150,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "frame-system", @@ -7214,7 +7214,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7232,7 +7232,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-support", "pallet-nfts", @@ -7696,7 +7696,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "frame-benchmarking", "frame-support", @@ -11043,7 +11043,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "async-trait", "futures", @@ -13183,7 +13183,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "serde", "serde_json", @@ -13817,7 +13817,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "futures", "substrate-test-utils-derive", @@ -13827,7 +13827,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#d5d63e9b7f624de321032a033675387a73a66646" +source = "git+https://github.com/paritytech/substrate?branch=master#74b2c92066ec3abcb612faa9272f246ae339fab3" dependencies = [ "proc-macro-crate", "proc-macro2", From b73fecb2ab93315b1c80dee33a64b94f59b3fa28 Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Wed, 3 May 2023 23:34:18 +0200 Subject: [PATCH 4/6] removed uneeded test --- .../src/refund_relayer_extension.rs | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/bridges/bin/runtime-common/src/refund_relayer_extension.rs b/bridges/bin/runtime-common/src/refund_relayer_extension.rs index c0e6d9bbc6c..9966f24f4e7 100644 --- a/bridges/bin/runtime-common/src/refund_relayer_extension.rs +++ b/bridges/bin/runtime-common/src/refund_relayer_extension.rs @@ -1459,30 +1459,6 @@ mod tests { }); } - #[test] - fn post_dispatch_ignores_transaction_that_has_not_delivered_all_messages() { - run_test(|| { - initialize_environment(200, 200, Default::default(), 150); - - assert_storage_noop!(run_post_dispatch(Some(all_finality_pre_dispatch_data()), Ok(()))); - assert_storage_noop!(run_post_dispatch( - Some(parachain_finality_pre_dispatch_data()), - Ok(()) - )); - assert_storage_noop!(run_post_dispatch(Some(delivery_pre_dispatch_data()), Ok(()))); - - assert_storage_noop!(run_post_dispatch( - Some(all_finality_confirmation_pre_dispatch_data()), - Ok(()) - )); - assert_storage_noop!(run_post_dispatch( - Some(parachain_finality_confirmation_pre_dispatch_data()), - Ok(()) - )); - assert_storage_noop!(run_post_dispatch(Some(confirmation_pre_dispatch_data()), Ok(()))); - }); - } - #[test] fn post_dispatch_refunds_relayer_in_all_finality_batch_with_extra_weight() { run_test(|| { From b0b503e9162d0faf92264ecd5c15e1546680c0fc Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Wed, 3 May 2023 23:36:05 +0200 Subject: [PATCH 5/6] removed code owners --- bridges/CODEOWNERS | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 bridges/CODEOWNERS diff --git a/bridges/CODEOWNERS b/bridges/CODEOWNERS deleted file mode 100644 index 3941ba8451a..00000000000 --- a/bridges/CODEOWNERS +++ /dev/null @@ -1,21 +0,0 @@ -# Lists some code owners. -# -# A codeowner just oversees some part of the codebase. If an owned file is changed then the -# corresponding codeowner receives a review request. An approval of the codeowner might be -# required for merging a PR (depends on repository settings). -# -# For details about syntax, see: -# https://help.github.com/en/articles/about-code-owners -# But here are some important notes: -# -# - Glob syntax is git-like, e.g. `/core` means the core directory in the root, unlike `core` -# which can be everywhere. -# - Multiple owners are supported. -# - Either handle (e.g, @github_user or @github_org/team) or email can be used. Keep in mind, -# that handles might work better because they are more recognizable on GitHub, -# eyou can use them for mentioning unlike an email. -# - The latest matching rule, if multiple, takes precedence. - -# CI -/.github/ @paritytech/ci -/.gitlab-ci.yml @paritytech/ci From ac7c8d86a78f49ae4b71ac04081217959172867a Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Wed, 3 May 2023 23:38:04 +0200 Subject: [PATCH 6/6] fixed commit --- bridges/bin/runtime-common/src/refund_relayer_extension.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/bin/runtime-common/src/refund_relayer_extension.rs b/bridges/bin/runtime-common/src/refund_relayer_extension.rs index 9966f24f4e7..00ea70aa04e 100644 --- a/bridges/bin/runtime-common/src/refund_relayer_extension.rs +++ b/bridges/bin/runtime-common/src/refund_relayer_extension.rs @@ -423,7 +423,7 @@ where } } - // Check if the `ReceiveMessagesProof` call delivered all the messages that + // Check if the `ReceiveMessagesProof` call delivered at least some of the messages that // it contained. If this happens, we consider the transaction "helpful" and refund it. let msgs_call_info = call_info.messages_call_info(); if !MessagesCallHelper::::was_successful(msgs_call_info) {