diff --git a/Cargo.lock b/Cargo.lock index 390402ce..e8e2fab6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -384,6 +384,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", @@ -758,6 +759,44 @@ dependencies = [ "thiserror", ] +[[package]] +name = "bp-bridge-hub-cumulus" +version = "0.1.0" +dependencies = [ + "bp-messages", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "frame-system", + "polkadot-primitives", + "sp-api", + "sp-std", +] + +[[package]] +name = "bp-bridge-hub-rococo" +version = "0.1.0" +dependencies = [ + "bp-bridge-hub-cumulus", + "bp-messages", + "bp-runtime", + "frame-support", + "sp-api", + "sp-std", +] + +[[package]] +name = "bp-bridge-hub-wococo" +version = "0.1.0" +dependencies = [ + "bp-bridge-hub-cumulus", + "bp-messages", + "bp-runtime", + "frame-support", + "sp-api", + "sp-std", +] + [[package]] name = "bp-header-chain" version = "0.1.0" @@ -841,6 +880,17 @@ dependencies = [ "sp-std", ] +[[package]] +name = "bp-rococo" +version = "0.1.0" +dependencies = [ + "bp-header-chain", + "bp-polkadot-core", + "bp-runtime", + "frame-support", + "sp-api", +] + [[package]] name = "bp-runtime" version = "0.1.0" @@ -877,6 +927,18 @@ dependencies = [ "sp-std", ] +[[package]] +name = "bp-wococo" +version = "0.1.0" +dependencies = [ + "bp-header-chain", + "bp-polkadot-core", + "bp-rococo", + "bp-runtime", + "frame-support", + "sp-api", +] + [[package]] name = "bridge-hub-kusama-runtime" version = "0.1.0" @@ -1007,7 +1069,17 @@ dependencies = [ name = "bridge-hub-rococo-runtime" version = "0.1.0" dependencies = [ + "bp-bridge-hub-rococo", + "bp-bridge-hub-wococo", + "bp-messages", + "bp-parachains", + "bp-polkadot-core", + "bp-relayers", + "bp-rococo", + "bp-runtime", + "bp-wococo", "bridge-hub-test-utils", + "bridge-runtime-common", "cumulus-pallet-aura-ext", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", @@ -1029,6 +1101,10 @@ dependencies = [ "pallet-aura", "pallet-authorship", "pallet-balances", + "pallet-bridge-grandpa", + "pallet-bridge-messages", + "pallet-bridge-parachains", + "pallet-bridge-relayers", "pallet-collator-selection", "pallet-multisig", "pallet-session", @@ -1060,6 +1136,7 @@ dependencies = [ "sp-std", "sp-transaction-pool", "sp-version", + "static_assertions", "substrate-wasm-builder", "xcm", "xcm-builder", @@ -1071,6 +1148,32 @@ 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-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", + "parity-scale-codec", + "sp-io", + "sp-runtime", + "xcm", + "xcm-builder", + "xcm-executor", ] [[package]] @@ -4318,6 +4421,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.1" @@ -6229,11 +6341,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi 0.1.19", + "hermit-abi 0.2.6", "libc", ] diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index ac3b8648..40253689 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -1042,6 +1042,30 @@ impl Pallet { pub fn set_custom_validation_head_data(head_data: Vec) { CustomValidationHeadData::::put(head_data); } + + /// Open HRMP channel for using it in benchmarks. + /// + /// The caller assumes that the pallet will accept regular outbound message to the sibling + /// `target_parachain` after this call. No other assumptions are made. + #[cfg(feature = "runtime-benchmarks")] + pub fn open_outbound_hrmp_channel_for_benchmarks(target_parachain: ParaId) { + RelevantMessagingState::::put(MessagingStateSnapshot { + dmq_mqc_head: Default::default(), + relay_dispatch_queue_size: Default::default(), + ingress_channels: Default::default(), + egress_channels: vec![( + target_parachain, + cumulus_primitives_core::AbridgedHrmpChannel { + max_capacity: 10, + max_total_size: 10_000_000_u32, + max_message_size: 10_000_000_u32, + msg_count: 5, + total_size: 5_000_000_u32, + mqc_head: None, + }, + )], + }) + } } pub struct ParachainSetCode(sp_std::marker::PhantomData); diff --git a/parachains/chain-specs/bridge-hub-rococo.json b/parachains/chain-specs/bridge-hub-rococo.json index 999837a5..ff20d8fb 100644 --- a/parachains/chain-specs/bridge-hub-rococo.json +++ b/parachains/chain-specs/bridge-hub-rococo.json @@ -82,4 +82,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/chain-specs/bridge-hub-wococo.json b/parachains/chain-specs/bridge-hub-wococo.json index 06837cc0..7024789b 100644 --- a/parachains/chain-specs/bridge-hub-wococo.json +++ b/parachains/chain-specs/bridge-hub-wococo.json @@ -86,4 +86,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} diff --git a/parachains/runtimes/assets/test-utils/Cargo.toml b/parachains/runtimes/assets/test-utils/Cargo.toml index 2a9e70ce..8a1ce0e6 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 06d6282e..1e0b31f1 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 3fd27940..954ff0d7 100644 --- a/parachains/runtimes/assets/test-utils/src/test_cases.rs +++ b/parachains/runtimes/assets/test-utils/src/test_cases.rs @@ -1096,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, @@ -1106,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, @@ -1116,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, diff --git a/parachains/runtimes/bridge-hubs/README.md b/parachains/runtimes/bridge-hubs/README.md index 79e82f34..9b024769 100644 --- a/parachains/runtimes/bridge-hubs/README.md +++ b/parachains/runtimes/bridge-hubs/README.md @@ -1,32 +1,228 @@ -# Bridge-hubs Parachain +- [Bridge-hub Parachains](#bridge-hub-parachains) + * [How to test locally Rococo <-> Wococo](#how-to-test-locally-rococo-----wococo) + + [Prepare/Build/Deploy](#prepare-build-deploy) + + [Run chains (Rococo + BridgeHub, Wococo + BridgeHub) with zombienet](#run-chains--rococo---bridgehub--wococo---bridgehub--with-zombienet) + + [Run relayers (Rococo, Wococo)](#run-relayers--rococo--wococo-) + - [Run with script (alternative 1)](#run-with-script--alternative-1-) + - [Run with binary (alternative 2)](#run-with-binary--alternative-2-) + + [Send messages](#send-messages) + - [Local zombienet run](#local-zombienet-run) + - [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) -Implementation of _BridgeHub_, a blockchain to support message passing between Substrate based chains like Polkadot and Kusama networks. +# Bridge-hub Parachains -_BridgeHub_ allows users to: - -- Passing arbitrary messages between different Substrate chains (Polkadot <-> Kusama). - -- Message passing is - -_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 ![](./docs/bridge-hub-parachain-design.jpg "Basic deployment setup") -## How to try locally +## How to test locally Rococo <-> Wococo + +### Prepare/Build/Deploy +``` +# Prepare empty directory for testing +mkdir -p ~/local_bridge_testing/bin +mkdir -p ~/local_bridge_testing/logs + +# 1. Install zombienet +Go to: https://github.com/paritytech/zombienet/releases +Copy the apropriate binary (zombienet-linux) from the latest release to ~/local_bridge_testing/bin + +# 2. Build polkadot binary +git clone https://github.com/paritytech/polkadot.git +cd polkadot +cargo build --release +cp target/release/polkadot ~/local_bridge_testing/bin/polkadot + +# 3. Build cumulus polkadot-parachain binary +cd +# 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 + +# 4. Build substrate-relay binary +git clone https://github.com/paritytech/parity-bridges-common.git +cd parity-bridges-common +cargo build --release -p substrate-relay +cp target/release/substrate-relay ~/local_bridge_testing/bin/substrate-relay + +# (Optional) 5. Build polkadot-parachain-mint binary with statemine/westmint for moving assets +cd +git checkout -b bko-transfer-asset-via-bridge --track origin/bko-transfer-asset-via-bridge +cargo build --release --locked -p polkadot-parachain-bin +cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-parachain-mint +``` + +### Run chains (Rococo + BridgeHub, Wococo + BridgeHub) with zombienet + +``` +# Rococo + BridgeHubRococo + Rockmine (mirroring Kusama) +POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \ +POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \ +POLKADOT_PARACHAIN_BINARY_PATH_FOR_ROCKMINE=~/local_bridge_testing/bin/polkadot-parachain-mint \ + ~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml +``` + +``` +# Wococo + BridgeHubWococo + Wockmint (mirroring Polkadot) +POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \ +POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \ +POLKADOT_PARACHAIN_BINARY_PATH_FOR_WOCKMINT=~/local_bridge_testing/bin/polkadot-parachain-mint \ + ~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml +``` + +### Run relayers (Rococo, Wococo) + +**Accounts of BridgeHub parachains:** +- `Bob` is pallet owner of all bridge pallets + +#### Run with script (alternative 1) +``` +cd +./scripts/bridges_rococo_wococo.sh run-relay +``` + +#### Run with binary (alternative 2) +Need to wait for parachain activation (start producing blocks), then run: + +``` +# 1. Init bridges: + +# Rococo -> Wococo +RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + ~/local_bridge_testing/bin/substrate-relay init-bridge rococo-to-bridge-hub-wococo \ + --source-host localhost \ + --source-port 9942 \ + --source-version-mode Auto \ + --target-host localhost \ + --target-port 8945 \ + --target-version-mode Auto \ + --target-signer //Bob + +# Wococo -> Rococo +RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + ~/local_bridge_testing/bin/substrate-relay init-bridge wococo-to-bridge-hub-rococo \ + --source-host localhost \ + --source-port 9945 \ + --source-version-mode Auto \ + --target-host localhost \ + --target-port 8943 \ + --target-version-mode Auto \ + --target-signer //Bob + +# 2. Relay relay-chain headers, parachain headers and messages** +RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + ~/local_bridge_testing/bin/substrate-relay relay-headers-and-messages bridge-hub-rococo-bridge-hub-wococo \ + --rococo-host localhost \ + --rococo-port 9942 \ + --rococo-version-mode Auto \ + --bridge-hub-rococo-host localhost \ + --bridge-hub-rococo-port 8943 \ + --bridge-hub-rococo-version-mode Auto \ + --bridge-hub-rococo-signer //Charlie \ + --wococo-headers-to-bridge-hub-rococo-signer //Bob \ + --wococo-parachains-to-bridge-hub-rococo-signer //Bob \ + --bridge-hub-rococo-transactions-mortality 4 \ + --wococo-host localhost \ + --wococo-port 9945 \ + --wococo-version-mode Auto \ + --bridge-hub-wococo-host localhost \ + --bridge-hub-wococo-port 8945 \ + --bridge-hub-wococo-version-mode Auto \ + --bridge-hub-wococo-signer //Charlie \ + --rococo-headers-to-bridge-hub-wococo-signer //Bob \ + --rococo-parachains-to-bridge-hub-wococo-signer //Bob \ + --bridge-hub-wococo-transactions-mortality 4 \ + --lane 00000001 +``` + +**Check relay-chain headers relaying:** +- Rococo parachain: + - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8943#/chainstate + - Pallet: **bridgeWococoGrandpa** + - Keys: **bestFinalized()** +- Wococo parachain: + - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8945#/chainstate + - Pallet: **bridgeRococoGrandpa** + - Keys: **bestFinalized()** + +**Check parachain headers relaying:** +- Rococo parachain: + - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8943#/chainstate + - Pallet: **bridgeWococoParachain** + - Keys: **bestParaHeads()** +- Wococo parachain: + - https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A8945#/chainstate + - Pallet: **bridgeRococoParachain** + - Keys: **bestParaHeads()** + +### Send messages + +#### Local zombienet run + +1. allow bridge transfer on statemine/westmint (governance-like): + ``` + ./scripts/bridges_rococo_wococo.sh allow-transfers-local + ``` + +2. do (asset) transfer from statemine to westmint + ``` + ./scripts/bridges_rococo_wococo.sh transfer-asset-from-statemine-local + ``` + +3. do (ping) transfer from statemine to westmint + ``` + ./scripts/bridges_rococo_wococo.sh ping-via-bridge-from-statemine-local + ``` + +- open explorers: (see zombienets) + - Statemine (see events `xcmpQueue.XcmpMessageSent`, `bridgeTransfer.ReserveAssetsDeposited`, `bridgeTransfer.TransferInitiated`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9910#/explorer + - BridgeHubRococo (see `bridgeWococoMessages.MessageAccepted`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer + - BridgeHubWococo (see `bridgeRococoMessages.MessagesReceived`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8945#/explorer + - Westmint (see `xcmpQueue.Success` for `transfer-asset` and `xcmpQueue.Fail` for `ping-via-bridge`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:9010#/explorer + - BridgeHubRococo (see `bridgeWococoMessages.MessagesDelivered`) https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:8943#/explorer + +#### Live Rockmine2 to Wockmint +- uses account seed on Live Rococo:Rockmine2 + ``` + cd + + ./scripts/bridges_rococo_wococo.sh transfer-asset-from-statemine-rococo + or + ./scripts/bridges_rococo_wococo.sh ping-via-bridge-from-statemine-rococo + ``` + +- open explorers: + - Rockmine2 (see events `xcmpQueue.XcmpMessageSent`, `bridgeTransfer.ReserveAssetsDeposited`, `bridgeTransfer.TransferInitiated`) https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io#/explorer + - BridgeHubRococo (see `bridgeWococoMessages.MessageAccepted`) https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frococo-bridge-hub-rpc.polkadot.io#/explorer + - BridgeHubWococo (see `bridgeRococoMessages.MessagesReceived`) https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fwococo-bridge-hub-rpc.polkadot.io#/explorer + - Wockmint (see `xcmpQueue.Success` for `transfer-asset` and `xcmpQueue.Fail` for `ping-via-bridge`) https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fws-wococo-wockmint-collator-node-0.parity-testnet.parity.io#/explorer + - BridgeHubRococo (see `bridgeWococoMessages.MessagesDelivered`) + +## How to test local BridgeHubKusama ``` cd -cargo build --release -p polkadot-parachain@0.9.320 +cargo build --release -p polkadot-parachain-bin # script expect to have pre-built polkadot binary on the path: ../polkadot/target/release/polkadot # if using `kusama-local` / `polkadot-local`, build polkadot with `--features fast-runtime` -# BridgeHubRococo -zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_rococo_local_network.toml - -# or - # BridgeHubKusama zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_kusama_local_network.toml @@ -35,3 +231,6 @@ or # BridgeHubPolkadot zombienet-linux --provider native spawn ./zombienet/examples/bridge_hub_polkadot_local_network.toml ``` + +## How to test local BridgeHubPolkadot +TODO: from master diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index d758e002..5722136a 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -71,14 +71,42 @@ 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 } +# Bridges +bp-bridge-hub-rococo = { path = "../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false } +bp-bridge-hub-wococo = { path = "../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false } +bp-messages = { path = "../../../../bridges/primitives/messages", default-features = false } +bp-parachains = { path = "../../../../bridges/primitives/parachains", default-features = false } +bp-polkadot-core = { path = "../../../../bridges/primitives/polkadot-core", default-features = false } +bp-relayers = { path = "../../../../bridges/primitives/relayers", default-features = false } +bp-runtime = { path = "../../../../bridges/primitives/runtime", default-features = false } +bp-rococo = { path = "../../../../bridges/primitives/chain-rococo", default-features = false } +bp-wococo = { path = "../../../../bridges/primitives/chain-wococo", default-features = false } +pallet-bridge-grandpa = { path = "../../../../bridges/modules/grandpa", default-features = false } +pallet-bridge-messages = { path = "../../../../bridges/modules/messages", default-features = false } +pallet-bridge-parachains = { path = "../../../../bridges/modules/parachains", default-features = false } +pallet-bridge-relayers = { path = "../../../../bridges/modules/relayers", default-features = false } +bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", default-features = false } + [dev-dependencies] +static_assertions = "1.1" bridge-hub-test-utils = { path = "../test-utils"} +bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", features = ["integrity-test"] } [features] default = [ "std", ] std = [ + "bp-bridge-hub-rococo/std", + "bp-bridge-hub-wococo/std", + "bp-messages/std", + "bp-parachains/std", + "bp-polkadot-core/std", + "bp-relayers/std", + "bp-runtime/std", + "bp-rococo/std", + "bp-wococo/std", + "bridge-runtime-common/std", "codec/std", "log/std", "scale-info/std", @@ -98,6 +126,10 @@ std = [ "pallet-aura/std", "pallet-authorship/std", "pallet-balances/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", + "pallet-bridge-parachains/std", + "pallet-bridge-relayers/std", "pallet-collator-selection/std", "pallet-multisig/std", "pallet-session/std", @@ -131,24 +163,34 @@ std = [ ] runtime-benchmarks = [ + "bridge-runtime-common/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", + "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-parachains/runtime-benchmarks", + "pallet-bridge-relayers/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", + "cumulus-pallet-parachain-system/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-utility/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", "cumulus-pallet-session-benchmarking/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", "cumulus-pallet-xcmp-queue/runtime-benchmarks", "pallet-xcm-benchmarks/runtime-benchmarks", ] try-runtime = [ + "pallet-bridge-grandpa/try-runtime", + "pallet-bridge-messages/try-runtime", + "pallet-bridge-parachains/try-runtime", + "pallet-bridge-relayers/try-runtime", "cumulus-pallet-aura-ext/try-runtime", "cumulus-pallet-dmp-queue/try-runtime", "cumulus-pallet-parachain-system/try-runtime", 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 new file mode 100644 index 00000000..bfa6f98e --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs @@ -0,0 +1,217 @@ +// Copyright 2022 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 . + +//! Bridge definitions that are used on Rococo to bridge with Wococo. + +use crate::{ + BridgeParachainWococoInstance, ParachainInfo, Runtime, WithBridgeHubWococoMessagesInstance, + XcmRouter, +}; +use bp_messages::LaneId; +use bridge_runtime_common::{ + messages, + messages::{ + source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof, + MessageBridge, ThisChainWithMessages, UnderlyingChainProvider, + }, + messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter}, + refund_relayer_extension::{ + ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane, + RefundableParachain, + }, +}; +use frame_support::{parameter_types, RuntimeDebug}; +use xcm::{ + latest::prelude::*, + prelude::{InteriorMultiLocation, NetworkId}, +}; +use xcm_builder::{BridgeBlobDispatcher, HaulBlobExporter}; + +parameter_types! { + pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = + bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; + pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce = + bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + pub const BridgeHubWococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID; + pub BridgeHubRococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Rococo), Parachain(ParachainInfo::parachain_id().into())); + pub WococoGlobalConsensusNetwork: NetworkId = NetworkId::Wococo; + pub ActiveOutboundLanesToBridgeHubWococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO]; + pub PriorityBoostPerMessage: u64 = 921_900_294; +} + +/// Proof of messages, coming from Wococo. +pub type FromWococoBridgeHubMessagesProof = + FromBridgedChainMessagesProof; +/// Messages delivery proof for Rococo Bridge Hub -> Wococo Bridge Hub messages. +pub type ToWococoBridgeHubMessagesDeliveryProof = + FromBridgedChainMessagesDeliveryProof; + +/// Dispatches received XCM messages from other bridge +pub type OnBridgeHubRococoBlobDispatcher = + BridgeBlobDispatcher; + +/// Export XCM messages to be relayed to the otherside +pub type ToBridgeHubWococoHaulBlobExporter = HaulBlobExporter< + XcmBlobHaulerAdapter, + WococoGlobalConsensusNetwork, + (), +>; +pub struct ToBridgeHubWococoXcmBlobHauler; +impl XcmBlobHauler for ToBridgeHubWococoXcmBlobHauler { + type MessageSender = + pallet_bridge_messages::Pallet; + + type MessageSenderOrigin = super::RuntimeOrigin; + + fn message_sender_origin() -> Self::MessageSenderOrigin { + pallet_xcm::Origin::from(MultiLocation::new(1, crate::xcm_config::UniversalLocation::get())) + .into() + } + + fn xcm_lane() -> LaneId { + DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO + } +} +pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO: LaneId = LaneId([0, 0, 0, 1]); + +/// Messaging Bridge configuration for BridgeHubRococo -> BridgeHubWococo +pub struct WithBridgeHubWococoMessageBridge; +impl MessageBridge for WithBridgeHubWococoMessageBridge { + const BRIDGED_MESSAGES_PALLET_NAME: &'static str = + bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME; + type ThisChain = BridgeHubRococo; + type BridgedChain = BridgeHubWococo; + type BridgedHeaderChain = pallet_bridge_parachains::ParachainHeaders< + Runtime, + BridgeParachainWococoInstance, + bp_bridge_hub_wococo::BridgeHubWococo, + >; +} + +/// Message verifier for BridgeHubWococo messages sent from BridgeHubRococo +pub type ToBridgeHubWococoMessageVerifier = + messages::source::FromThisChainMessageVerifier; + +/// Maximal outbound payload size of BridgeHubRococo -> BridgeHubWococo messages. +pub type ToBridgeHubWococoMaximalOutboundPayloadSize = + messages::source::FromThisChainMaximalOutboundPayloadSize; + +/// BridgeHubWococo chain from message lane point of view. +#[derive(RuntimeDebug, Clone, Copy)] +pub struct BridgeHubWococo; + +impl UnderlyingChainProvider for BridgeHubWococo { + type Chain = bp_bridge_hub_wococo::BridgeHubWococo; +} + +impl messages::BridgedChainWithMessages for BridgeHubWococo {} + +/// BridgeHubRococo chain from message lane point of view. +#[derive(RuntimeDebug, Clone, Copy)] +pub struct BridgeHubRococo; + +impl UnderlyingChainProvider for BridgeHubRococo { + type Chain = bp_bridge_hub_rococo::BridgeHubRococo; +} + +impl ThisChainWithMessages for BridgeHubRococo { + type RuntimeOrigin = crate::RuntimeOrigin; +} + +/// Signed extension that refunds relayers that are delivering messages from the Wococo parachain. +pub type BridgeRefundBridgeHubWococoMessages = RefundBridgedParachainMessages< + Runtime, + RefundableParachain, + RefundableMessagesLane, + ActualFeeRefund, + PriorityBoostPerMessage, + StrBridgeRefundBridgeHubWococoMessages, +>; +bp_runtime::generate_static_str_provider!(BridgeRefundBridgeHubWococoMessages); + +parameter_types! { + pub const BridgeHubWococoMessagesLane: bp_messages::LaneId = DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO; + pub const BridgeHubWococoParachainId: u32 = { + use bp_runtime::Parachain; + BridgeHubWococo::PARACHAIN_ID + }; +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::BridgeGrandpaWococoInstance; + use bridge_runtime_common::{ + assert_complete_bridge_types, + integrity::{ + assert_complete_bridge_constants, check_message_lane_weights, + AssertBridgeMessagesPalletConstants, AssertBridgePalletNames, AssertChainConstants, + AssertCompleteBridgeConstants, + }, + }; + + #[test] + fn ensure_bridge_hub_rococo_message_lane_weights_are_correct() { + 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, + ); + } + + #[test] + fn ensure_bridge_integrity() { + assert_complete_bridge_types!( + runtime: Runtime, + with_bridged_chain_grandpa_instance: BridgeGrandpaWococoInstance, + with_bridged_chain_messages_instance: WithBridgeHubWococoMessagesInstance, + bridge: WithBridgeHubWococoMessageBridge, + this_chain: bp_rococo::Rococo, + bridged_chain: bp_wococo::Wococo, + ); + + assert_complete_bridge_constants::< + Runtime, + BridgeGrandpaWococoInstance, + WithBridgeHubWococoMessagesInstance, + WithBridgeHubWococoMessageBridge, + >(AssertCompleteBridgeConstants { + this_chain_constants: AssertChainConstants { + block_length: bp_bridge_hub_rococo::BlockLength::get(), + block_weights: bp_bridge_hub_rococo::BlockWeights::get(), + }, + messages_pallet_constants: AssertBridgeMessagesPalletConstants { + max_unrewarded_relayers_in_bridged_confirmation_tx: + bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, + max_unconfirmed_messages_in_bridged_confirmation_tx: + bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, + bridged_chain_id: bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID, + }, + pallet_names: AssertBridgePalletNames { + with_this_chain_messages_pallet_name: + bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME, + with_bridged_chain_grandpa_pallet_name: bp_wococo::WITH_WOCOCO_GRANDPA_PALLET_NAME, + with_bridged_chain_messages_pallet_name: + bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME, + }, + }); + } +} 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 new file mode 100644 index 00000000..2c9ec3c8 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs @@ -0,0 +1,217 @@ +// Copyright 2022 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 . + +//! Bridge definitions that are used on Wococo to bridge with Rococo. + +use crate::{ + BridgeParachainRococoInstance, ParachainInfo, Runtime, WithBridgeHubRococoMessagesInstance, + XcmRouter, +}; +use bp_messages::LaneId; +use bridge_runtime_common::{ + messages, + messages::{ + source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof, + MessageBridge, ThisChainWithMessages, UnderlyingChainProvider, + }, + messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter}, + refund_relayer_extension::{ + ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane, + RefundableParachain, + }, +}; +use frame_support::{parameter_types, RuntimeDebug}; +use xcm::{ + latest::prelude::*, + prelude::{InteriorMultiLocation, NetworkId}, +}; +use xcm_builder::{BridgeBlobDispatcher, HaulBlobExporter}; + +parameter_types! { + pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce = + bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX; + pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce = + bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX; + pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID; + pub BridgeHubWococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Wococo), Parachain(ParachainInfo::parachain_id().into())); + pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo; + pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO]; + pub PriorityBoostPerMessage: u64 = 921_900_294; +} + +/// Proof of messages, coming from Rococo. +pub type FromRococoBridgeHubMessagesProof = + FromBridgedChainMessagesProof; +/// Messages delivery proof for Rococo Bridge Hub -> Wococo Bridge Hub messages. +pub type ToRococoBridgeHubMessagesDeliveryProof = + FromBridgedChainMessagesDeliveryProof; + +/// Dispatches received XCM messages from other bridge +pub type OnBridgeHubWococoBlobDispatcher = + BridgeBlobDispatcher; + +/// Export XCM messages to be relayed to the otherside +pub type ToBridgeHubRococoHaulBlobExporter = HaulBlobExporter< + XcmBlobHaulerAdapter, + RococoGlobalConsensusNetwork, + (), +>; +pub struct ToBridgeHubRococoXcmBlobHauler; +impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler { + type MessageSender = + pallet_bridge_messages::Pallet; + + type MessageSenderOrigin = super::RuntimeOrigin; + + fn message_sender_origin() -> super::RuntimeOrigin { + pallet_xcm::Origin::from(MultiLocation::new(1, crate::xcm_config::UniversalLocation::get())) + .into() + } + + fn xcm_lane() -> LaneId { + DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO + } +} +pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 1]); + +/// Messaging Bridge configuration for BridgeHubWococo -> BridgeHubRococo +pub struct WithBridgeHubRococoMessageBridge; +impl MessageBridge for WithBridgeHubRococoMessageBridge { + const BRIDGED_MESSAGES_PALLET_NAME: &'static str = + bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME; + type ThisChain = BridgeHubWococo; + type BridgedChain = BridgeHubRococo; + type BridgedHeaderChain = pallet_bridge_parachains::ParachainHeaders< + Runtime, + BridgeParachainRococoInstance, + bp_bridge_hub_rococo::BridgeHubRococo, + >; +} + +/// Message verifier for BridgeHubRococo messages sent from BridgeHubWococo +pub type ToBridgeHubRococoMessageVerifier = + messages::source::FromThisChainMessageVerifier; + +/// Maximal outbound payload size of BridgeHubWococo -> BridgeHubRococo messages. +pub type ToBridgeHubRococoMaximalOutboundPayloadSize = + messages::source::FromThisChainMaximalOutboundPayloadSize; + +/// BridgeHubRococo chain from message lane point of view. +#[derive(RuntimeDebug, Clone, Copy)] +pub struct BridgeHubRococo; + +impl UnderlyingChainProvider for BridgeHubRococo { + type Chain = bp_bridge_hub_rococo::BridgeHubRococo; +} + +impl messages::BridgedChainWithMessages for BridgeHubRococo {} + +/// BridgeHubWococo chain from message lane point of view. +#[derive(RuntimeDebug, Clone, Copy)] +pub struct BridgeHubWococo; + +impl UnderlyingChainProvider for BridgeHubWococo { + type Chain = bp_bridge_hub_wococo::BridgeHubWococo; +} + +impl ThisChainWithMessages for BridgeHubWococo { + type RuntimeOrigin = crate::RuntimeOrigin; +} + +/// Signed extension that refunds relayers that are delivering messages from the Rococo parachain. +pub type BridgeRefundBridgeHubRococoMessages = RefundBridgedParachainMessages< + Runtime, + RefundableParachain, + RefundableMessagesLane, + ActualFeeRefund, + PriorityBoostPerMessage, + StrBridgeRefundBridgeHubRococoMessages, +>; +bp_runtime::generate_static_str_provider!(BridgeRefundBridgeHubRococoMessages); + +parameter_types! { + pub const BridgeHubRococoMessagesLane: bp_messages::LaneId = DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO; + pub const BridgeHubRococoParachainId: u32 = { + use bp_runtime::Parachain; + BridgeHubRococo::PARACHAIN_ID + }; +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::BridgeGrandpaRococoInstance; + use bridge_runtime_common::{ + assert_complete_bridge_types, + integrity::{ + assert_complete_bridge_constants, check_message_lane_weights, + AssertBridgeMessagesPalletConstants, AssertBridgePalletNames, AssertChainConstants, + AssertCompleteBridgeConstants, + }, + }; + + #[test] + fn ensure_bridge_hub_wococo_message_lane_weights_are_correct() { + 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, + ); + } + + #[test] + fn ensure_bridge_integrity() { + assert_complete_bridge_types!( + runtime: Runtime, + with_bridged_chain_grandpa_instance: BridgeGrandpaRococoInstance, + with_bridged_chain_messages_instance: WithBridgeHubRococoMessagesInstance, + bridge: WithBridgeHubRococoMessageBridge, + this_chain: bp_wococo::Wococo, + bridged_chain: bp_rococo::Rococo, + ); + + assert_complete_bridge_constants::< + Runtime, + BridgeGrandpaRococoInstance, + WithBridgeHubRococoMessagesInstance, + WithBridgeHubRococoMessageBridge, + >(AssertCompleteBridgeConstants { + this_chain_constants: AssertChainConstants { + block_length: bp_bridge_hub_wococo::BlockLength::get(), + block_weights: bp_bridge_hub_wococo::BlockWeights::get(), + }, + messages_pallet_constants: AssertBridgeMessagesPalletConstants { + max_unrewarded_relayers_in_bridged_confirmation_tx: + bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX, + max_unconfirmed_messages_in_bridged_confirmation_tx: + bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX, + bridged_chain_id: bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID, + }, + pallet_names: AssertBridgePalletNames { + with_this_chain_messages_pallet_name: + bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME, + with_bridged_chain_grandpa_pallet_name: bp_rococo::WITH_ROCOCO_GRANDPA_PALLET_NAME, + with_bridged_chain_messages_pallet_name: + bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME, + }, + }); + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/constants.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/constants.rs index 86cf8d6f..ba80cd2b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/constants.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/constants.rs @@ -22,6 +22,7 @@ pub mod currency { pub const UNITS: Balance = constants::currency::UNITS; pub const CENTS: Balance = constants::currency::CENTS; + pub const MILLICENTS: Balance = constants::currency::MILLICENTS; pub const fn deposit(items: u32, bytes: u32) -> Balance { // map to 1/100 of what the rococo relay chain charges 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 2e985546..21f02ce4 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -22,12 +22,14 @@ #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +pub mod bridge_hub_rococo_config; +pub mod bridge_hub_wococo_config; pub mod constants; mod weights; pub mod xcm_config; +use constants::currency::*; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -use smallvec::smallvec; use sp_api::impl_runtime_apis; use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_runtime::{ @@ -42,17 +44,12 @@ use sp_std::prelude::*; use sp_version::NativeVersion; use sp_version::RuntimeVersion; -use constants::currency::*; use frame_support::{ construct_runtime, dispatch::DispatchClass, - pallet_prelude::Weight, parameter_types, traits::{ConstU32, ConstU64, ConstU8, Everything}, - weights::{ - ConstantMultiplier, FeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, - WeightToFeePolynomial, - }, + weights::{ConstantMultiplier, Weight}, PalletId, }; use frame_system::{ @@ -63,21 +60,40 @@ pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; pub use sp_runtime::{MultiAddress, Perbill, Permill}; use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin}; +use bp_parachains::SingleParaStoredHeaderDataBuilder; +use bp_runtime::HeaderId; + #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -// Polkadot imports use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; -// XCM Imports +use crate::{ + bridge_hub_rococo_config::{ + BridgeRefundBridgeHubWococoMessages, OnBridgeHubRococoBlobDispatcher, + WithBridgeHubWococoMessageBridge, + }, + bridge_hub_wococo_config::{ + BridgeRefundBridgeHubRococoMessages, OnBridgeHubWococoBlobDispatcher, + WithBridgeHubRococoMessageBridge, + }, + constants::fee::WeightToFee, + xcm_config::XcmRouter, +}; +use bridge_runtime_common::{ + messages::{source::TargetHeaderChainAdapter, target::SourceHeaderChainAdapter}, + messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch}, +}; use parachains_common::{ 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; +pub const LOG_TARGET: &str = "runtime::bridge-hub"; + /// The address format for describing accounts. pub type Address = MultiAddress; @@ -100,6 +116,8 @@ pub type SignedExtra = ( frame_system::CheckNonce, frame_system::CheckWeight, pallet_transaction_payment::ChargeTransactionPayment, + BridgeRejectObsoleteHeadersAndMessages, + (BridgeRefundBridgeHubRococoMessages, BridgeRefundBridgeHubWococoMessages), ); /// Unchecked extrinsic type as expected by this runtime. @@ -118,64 +136,6 @@ pub type Executive = frame_executive::Executive< AllPalletsWithSystem, >; -/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the -/// node's balance type. -/// -/// This should typically create a mapping between the following ranges: -/// - `[0, MAXIMUM_BLOCK_WEIGHT]` -/// - `[Balance::min, Balance::max]` -/// -/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: -/// - Setting it to `0` will essentially disable the weight fee. -/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. -pub struct WeightToFee; -impl frame_support::weights::WeightToFee for WeightToFee { - type Balance = Balance; - - fn weight_to_fee(weight: &Weight) -> Self::Balance { - let time_poly: FeePolynomial = RefTimeToFee::polynomial().into(); - let proof_poly: FeePolynomial = ProofSizeToFee::polynomial().into(); - - // Take the maximum instead of the sum to charge by the more scarce resource. - time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size())) - } -} - -/// Maps the reference time component of `Weight` to a fee. -pub struct RefTimeToFee; -impl WeightToFeePolynomial for RefTimeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - let p = MILLIUNIT / 10; - let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); - - smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, - }] - } -} - -/// Maps the proof size component of `Weight` to a fee. -pub struct ProofSizeToFee; -impl WeightToFeePolynomial for ProofSizeToFee { - type Balance = Balance; - fn polynomial() -> WeightToFeeCoefficients { - // Map 10kb proof to 1/10 MILLIUNIT. - let p = MILLIUNIT / 10; - let q = 10_000; - - smallvec![WeightToFeeCoefficient { - degree: 1, - negative: false, - coeff_frac: Perbill::from_rational(p % q, q), - coeff_integer: p / q, - }] - } -} - impl_opaque_keys! { pub struct SessionKeys { pub aura: Aura, @@ -194,13 +154,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { state_version: 1, }; -// Unit = the base number of indivisible units for balances -pub const MILLIUNIT: Balance = 1_000_000_000; -pub const MICROUNIT: Balance = 1_000_000; - -/// The existential deposit. Set to 1/10 of the Connected Relay Chain. -pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; - /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { @@ -281,7 +234,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; /// The action to take on a Runtime Upgrade type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = ConstU32<16>; + type MaxConsumers = frame_support::traits::ConstU32<16>; } impl pallet_timestamp::Config for Runtime { @@ -321,7 +274,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 10 * MICROUNIT; + pub const TransactionByteFee: Balance = 1 * MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -443,6 +396,153 @@ impl pallet_utility::Config for Runtime { type WeightInfo = weights::pallet_utility::WeightInfo; } +// Add bridge pallets (GPA) + +/// 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; + type BridgedChain = bp_wococo::Wococo; + type MaxFreeMandatoryHeadersPerBlock = ConstU32<4>; + type HeadersToKeep = RelayChainHeadersToKeep; + type WeightInfo = weights::pallet_bridge_grandpa_bridge_wococo_grandpa::WeightInfo; +} + +/// 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; + type BridgedChain = bp_rococo::Rococo; + type MaxFreeMandatoryHeadersPerBlock = ConstU32<4>; + type HeadersToKeep = RelayChainHeadersToKeep; + type WeightInfo = weights::pallet_bridge_grandpa_bridge_rococo_grandpa::WeightInfo; +} + +parameter_types! { + pub const RelayChainHeadersToKeep: u32 = 1024; + pub const ParachainHeadsToKeep: 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; + + 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 +pub type BridgeParachainWococoInstance = pallet_bridge_parachains::Instance1; +impl pallet_bridge_parachains::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance::WeightInfo; + type BridgesGrandpaPalletInstance = BridgeGrandpaWococoInstance; + type ParasPalletName = WococoBridgeParachainPalletName; + type ParaStoredHeaderDataBuilder = + SingleParaStoredHeaderDataBuilder; + type HeadsToKeep = ParachainHeadsToKeep; + type MaxParaHeadDataSize = MaxWococoParaHeadDataSize; +} + +/// Add parachain bridge pallet to track Rococo bridge hub parachain +pub type BridgeParachainRococoInstance = pallet_bridge_parachains::Instance2; +impl pallet_bridge_parachains::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type WeightInfo = weights::pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance::WeightInfo; + type BridgesGrandpaPalletInstance = BridgeGrandpaRococoInstance; + type ParasPalletName = RococoBridgeParachainPalletName; + type ParaStoredHeaderDataBuilder = + SingleParaStoredHeaderDataBuilder; + type HeadsToKeep = ParachainHeadsToKeep; + type MaxParaHeadDataSize = MaxRococoParaHeadDataSize; +} + +/// 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; + type WeightInfo = weights::pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance::WeightInfo; + type BridgedChainId = bridge_hub_rococo_config::BridgeHubWococoChainId; + type ActiveOutboundLanes = bridge_hub_rococo_config::ActiveOutboundLanesToBridgeHubWococo; + type MaxUnrewardedRelayerEntriesAtInboundLane = + bridge_hub_rococo_config::MaxUnrewardedRelayerEntriesAtInboundLane; + type MaxUnconfirmedMessagesAtInboundLane = + bridge_hub_rococo_config::MaxUnconfirmedMessagesAtInboundLane; + + type MaximalOutboundPayloadSize = + bridge_hub_rococo_config::ToBridgeHubWococoMaximalOutboundPayloadSize; + type OutboundPayload = XcmAsPlainPayload; + + type InboundPayload = XcmAsPlainPayload; + type InboundRelayer = AccountId; + type DeliveryPayments = (); + + type TargetHeaderChain = TargetHeaderChainAdapter; + type LaneMessageVerifier = bridge_hub_rococo_config::ToBridgeHubWococoMessageVerifier; + type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter< + Runtime, + WithBridgeHubWococoMessagesInstance, + DeliveryRewardInBalance, + >; + + type SourceHeaderChain = SourceHeaderChainAdapter; + type MessageDispatch = + XcmBlobMessageDispatch; +} + +/// 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; + type WeightInfo = weights::pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance::WeightInfo; + type BridgedChainId = bridge_hub_wococo_config::BridgeHubRococoChainId; + type ActiveOutboundLanes = bridge_hub_wococo_config::ActiveOutboundLanesToBridgeHubRococo; + type MaxUnrewardedRelayerEntriesAtInboundLane = + bridge_hub_wococo_config::MaxUnrewardedRelayerEntriesAtInboundLane; + type MaxUnconfirmedMessagesAtInboundLane = + bridge_hub_wococo_config::MaxUnconfirmedMessagesAtInboundLane; + + type MaximalOutboundPayloadSize = + bridge_hub_wococo_config::ToBridgeHubRococoMaximalOutboundPayloadSize; + type OutboundPayload = XcmAsPlainPayload; + + type InboundPayload = XcmAsPlainPayload; + type InboundRelayer = AccountId; + type DeliveryPayments = (); + + type TargetHeaderChain = TargetHeaderChainAdapter; + type LaneMessageVerifier = bridge_hub_wococo_config::ToBridgeHubRococoMessageVerifier; + type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter< + Runtime, + WithBridgeHubRococoMessagesInstance, + DeliveryRewardInBalance, + >; + + type SourceHeaderChain = SourceHeaderChainAdapter; + type MessageDispatch = + XcmBlobMessageDispatch; +} + +/// Allows collect and claim rewards for relayers +impl pallet_bridge_relayers::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + 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; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime where @@ -477,10 +577,36 @@ construct_runtime!( // Handy utilities. Utility: pallet_utility::{Pallet, Call, Event} = 40, - Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 41, + Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 36, + + // Rococo and Wococo Bridge Hubs are sharing the runtime, so this runtime has two sets of + // bridge pallets. Both are deployed at both runtimes, but only one set is actually used + // at particular runtime. + + // With-Wococo bridge modules that are active (used) at Rococo Bridge Hub runtime. + BridgeWococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage, Event, Config} = 41, + BridgeWococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage, Event} = 42, + BridgeWococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 46, + + // With-Rococo bridge modules that are active (used) at Wococo Bridge Hub runtime. + BridgeRococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage, Event, Config} = 43, + BridgeRococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage, Event} = 44, + BridgeRococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 45, + + BridgeRelayers: pallet_bridge_relayers::{Pallet, Call, Storage, Event} = 47, } ); +bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! { + RuntimeCall, AccountId, + // Grandpa + BridgeRococoGrandpa, BridgeWococoGrandpa, + // Parachains + BridgeRococoParachain, BridgeWococoParachain, + // Messages + BridgeRococoMessages, BridgeWococoMessages +} + #[cfg(feature = "runtime-benchmarks")] #[macro_use] extern crate frame_benchmarking; @@ -501,6 +627,16 @@ mod benches { // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + // Bridge pallets at Rococo + [pallet_bridge_grandpa, BridgeWococoGrandpa] + [pallet_bridge_parachains, BridgeParachainsBench::] + [pallet_bridge_messages, BridgeMessagesBench::] + // Bridge pallets at Wococo + [pallet_bridge_grandpa, BridgeRococoGrandpa] + [pallet_bridge_parachains, BridgeParachainsBench::] + [pallet_bridge_messages, BridgeMessagesBench::] + // Bridge relayer pallets + [pallet_bridge_relayers, BridgeRelayersBench::] ); } @@ -625,6 +761,89 @@ impl_runtime_apis! { } } + impl bp_rococo::RococoFinalityApi for Runtime { + fn best_finalized() -> Option> { + BridgeRococoGrandpa::best_finalized() + } + } + + impl bp_wococo::WococoFinalityApi for Runtime { + fn best_finalized() -> Option> { + BridgeWococoGrandpa::best_finalized() + } + } + + + impl bp_bridge_hub_rococo::BridgeHubRococoFinalityApi for Runtime { + fn best_finalized() -> Option> { + BridgeRococoParachain::best_parachain_head_id::< + bp_bridge_hub_rococo::BridgeHubRococo + >().unwrap_or(None) + } + } + + impl bp_bridge_hub_wococo::BridgeHubWococoFinalityApi for Runtime { + fn best_finalized() -> Option> { + BridgeWococoParachain::best_parachain_head_id::< + bp_bridge_hub_wococo::BridgeHubWococo + >().unwrap_or(None) + } + } + + // This exposed by BridgeHubRococo + impl bp_bridge_hub_wococo::FromBridgeHubWococoInboundLaneApi for Runtime { + fn message_details( + lane: bp_messages::LaneId, + messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>, + ) -> Vec { + bridge_runtime_common::messages_api::inbound_message_details::< + Runtime, + WithBridgeHubWococoMessagesInstance, + >(lane, messages) + } + } + + // This exposed by BridgeHubRococo + impl bp_bridge_hub_wococo::ToBridgeHubWococoOutboundLaneApi for Runtime { + fn message_details( + lane: bp_messages::LaneId, + begin: bp_messages::MessageNonce, + end: bp_messages::MessageNonce, + ) -> Vec { + bridge_runtime_common::messages_api::outbound_message_details::< + Runtime, + WithBridgeHubWococoMessagesInstance, + >(lane, begin, end) + } + } + + // This is exposed by BridgeHubWococo + impl bp_bridge_hub_rococo::FromBridgeHubRococoInboundLaneApi for Runtime { + fn message_details( + lane: bp_messages::LaneId, + messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>, + ) -> Vec { + bridge_runtime_common::messages_api::inbound_message_details::< + Runtime, + WithBridgeHubRococoMessagesInstance, + >(lane, messages) + } + } + + // This is exposed by BridgeHubWococo + impl bp_bridge_hub_rococo::ToBridgeHubRococoOutboundLaneApi for Runtime { + fn message_details( + lane: bp_messages::LaneId, + begin: bp_messages::MessageNonce, + end: bp_messages::MessageNonce, + ) -> Vec { + bridge_runtime_common::messages_api::outbound_message_details::< + Runtime, + WithBridgeHubRococoMessagesInstance, + >(lane, begin, end) + } + } + #[cfg(feature = "try-runtime")] impl frame_try_runtime::TryRuntime for Runtime { fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) { @@ -661,6 +880,10 @@ impl_runtime_apis! { type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::; + use pallet_bridge_parachains::benchmarking::Pallet as BridgeParachainsBench; + use pallet_bridge_messages::benchmarking::Pallet as BridgeMessagesBench; + use pallet_bridge_relayers::benchmarking::Pallet as BridgeRelayersBench; + let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -758,13 +981,183 @@ impl_runtime_apis! { fn export_message_origin_and_destination( ) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> { - Err(BenchmarkError::Skip) + Ok((RelayLocation::get(), NetworkId::Wococo, X1(Parachain(100)))) } } type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::; + use bridge_runtime_common::messages_benchmarking::{prepare_message_delivery_proof_from_parachain, prepare_message_proof_from_parachain}; + use pallet_bridge_messages::benchmarking::{ + Config as BridgeMessagesConfig, + Pallet as BridgeMessagesBench, + MessageDeliveryProofParams, + MessageProofParams, + }; + + impl BridgeMessagesConfig for Runtime { + fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool { + let bench_lane_id = >::bench_lane_id(); + let bridged_chain_id = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID; + pallet_bridge_relayers::Pallet::::relayer_reward( + relayer, + bp_relayers::RewardsAccountParams::new( + bench_lane_id, + bridged_chain_id, + bp_relayers::RewardsAccountOwner::BridgedChain + ) + ).is_some() + } + + fn prepare_message_proof( + params: MessageProofParams, + ) -> (bridge_hub_rococo_config::FromWococoBridgeHubMessagesProof, Weight) { + use cumulus_primitives_core::XcmpMessageSource; + assert!(XcmpQueue::take_outbound_messages(usize::MAX).is_empty()); + ParachainSystem::open_outbound_hrmp_channel_for_benchmarks(42.into()); + prepare_message_proof_from_parachain::< + Runtime, + BridgeGrandpaWococoInstance, + bridge_hub_rococo_config::WithBridgeHubWococoMessageBridge, + >(params, X2(GlobalConsensus(Rococo), Parachain(42))) + } + + fn prepare_message_delivery_proof( + params: MessageDeliveryProofParams, + ) -> bridge_hub_rococo_config::ToWococoBridgeHubMessagesDeliveryProof { + prepare_message_delivery_proof_from_parachain::< + Runtime, + BridgeGrandpaWococoInstance, + bridge_hub_rococo_config::WithBridgeHubWococoMessageBridge, + >(params) + } + + fn is_message_successfully_dispatched(_nonce: bp_messages::MessageNonce) -> bool { + use cumulus_primitives_core::XcmpMessageSource; + !XcmpQueue::take_outbound_messages(usize::MAX).is_empty() + } + } + + impl BridgeMessagesConfig for Runtime { + fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool { + let bench_lane_id = >::bench_lane_id(); + let bridged_chain_id = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID; + pallet_bridge_relayers::Pallet::::relayer_reward( + relayer, + bp_relayers::RewardsAccountParams::new( + bench_lane_id, + bridged_chain_id, + bp_relayers::RewardsAccountOwner::BridgedChain + ) + ).is_some() + } + + fn prepare_message_proof( + params: MessageProofParams, + ) -> (bridge_hub_wococo_config::FromRococoBridgeHubMessagesProof, Weight) { + use cumulus_primitives_core::XcmpMessageSource; + assert!(XcmpQueue::take_outbound_messages(usize::MAX).is_empty()); + ParachainSystem::open_outbound_hrmp_channel_for_benchmarks(42.into()); + prepare_message_proof_from_parachain::< + Runtime, + BridgeGrandpaRococoInstance, + bridge_hub_wococo_config::WithBridgeHubRococoMessageBridge, + >(params, X2(GlobalConsensus(Wococo), Parachain(42))) + } + + fn prepare_message_delivery_proof( + params: MessageDeliveryProofParams, + ) -> bridge_hub_wococo_config::ToRococoBridgeHubMessagesDeliveryProof { + prepare_message_delivery_proof_from_parachain::< + Runtime, + BridgeGrandpaRococoInstance, + bridge_hub_wococo_config::WithBridgeHubRococoMessageBridge, + >(params) + } + + fn is_message_successfully_dispatched(_nonce: bp_messages::MessageNonce) -> bool { + use cumulus_primitives_core::XcmpMessageSource; + !XcmpQueue::take_outbound_messages(usize::MAX).is_empty() + } + } + + use bridge_runtime_common::parachains_benchmarking::prepare_parachain_heads_proof; + use pallet_bridge_parachains::benchmarking::{ + Config as BridgeParachainsConfig, + Pallet as BridgeParachainsBench, + }; + use pallet_bridge_relayers::benchmarking::{ + Pallet as BridgeRelayersBench, + Config as BridgeRelayersConfig, + }; + + impl BridgeParachainsConfig for Runtime { + fn parachains() -> Vec { + use bp_runtime::Parachain; + vec![bp_polkadot_core::parachains::ParaId(bp_bridge_hub_wococo::BridgeHubWococo::PARACHAIN_ID)] + } + + fn prepare_parachain_heads_proof( + parachains: &[bp_polkadot_core::parachains::ParaId], + parachain_head_size: u32, + proof_size: bp_runtime::StorageProofSize, + ) -> ( + pallet_bridge_parachains::RelayBlockNumber, + pallet_bridge_parachains::RelayBlockHash, + bp_polkadot_core::parachains::ParaHeadsProof, + Vec<(bp_polkadot_core::parachains::ParaId, bp_polkadot_core::parachains::ParaHash)>, + ) { + prepare_parachain_heads_proof::( + parachains, + parachain_head_size, + proof_size, + ) + } + } + + impl BridgeParachainsConfig for Runtime { + fn parachains() -> Vec { + use bp_runtime::Parachain; + vec![bp_polkadot_core::parachains::ParaId(bp_bridge_hub_rococo::BridgeHubRococo::PARACHAIN_ID)] + } + + fn prepare_parachain_heads_proof( + parachains: &[bp_polkadot_core::parachains::ParaId], + parachain_head_size: u32, + proof_size: bp_runtime::StorageProofSize, + ) -> ( + pallet_bridge_parachains::RelayBlockNumber, + pallet_bridge_parachains::RelayBlockHash, + bp_polkadot_core::parachains::ParaHeadsProof, + Vec<(bp_polkadot_core::parachains::ParaId, bp_polkadot_core::parachains::ParaHash)>, + ) { + prepare_parachain_heads_proof::( + parachains, + parachain_head_size, + proof_size, + ) + } + } + + impl BridgeRelayersConfig for Runtime { + fn prepare_rewards_account( + account_params: bp_relayers::RewardsAccountParams, + reward: Balance, + ) { + let rewards_account = bp_relayers::PayRewardFromAccount::< + Balances, + AccountId + >::rewards_account(account_params); + 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(); + } + } + let whitelist: Vec = vec![ // Block Number hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), @@ -815,3 +1208,59 @@ cumulus_pallet_parachain_system::register_validate_block! { BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, CheckInherents = CheckInherents, } + +#[cfg(test)] +mod tests { + use super::*; + use bp_runtime::TransactionEra; + 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 = ( + frame_system::CheckNonZeroSender::new(), + frame_system::CheckSpecVersion::new(), + frame_system::CheckTxVersion::new(), + frame_system::CheckGenesis::new(), + frame_system::CheckEra::from(sp_runtime::generic::Era::Immortal), + frame_system::CheckNonce::from(10), + frame_system::CheckWeight::new(), + pallet_transaction_payment::ChargeTransactionPayment::from(10), + BridgeRejectObsoleteHeadersAndMessages {}, + ( + BridgeRefundBridgeHubRococoMessages::default(), + BridgeRefundBridgeHubWococoMessages::default(), + ), + ); + + { + use bp_bridge_hub_rococo::BridgeHubSignedExtension; + let bhr_indirect_payload = bp_bridge_hub_rococo::SignedExtension::from_params( + 10, + 10, + TransactionEra::Immortal, + test_header::(1).hash(), + 10, + 10, + ); + assert_eq!(payload.encode(), bhr_indirect_payload.encode()); + } + + { + use bp_bridge_hub_wococo::BridgeHubSignedExtension; + let bhw_indirect_payload = bp_bridge_hub_wococo::SignedExtension::from_params( + 10, + 10, + TransactionEra::Immortal, + test_header::(1).hash(), + 10, + 10, + ); + assert_eq!(payload.encode(), bhw_indirect_payload.encode()); + } + } +} 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 d5722374..286c8010 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 @@ -22,6 +22,13 @@ pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; pub mod pallet_balances; +pub mod pallet_bridge_grandpa_bridge_rococo_grandpa; +pub mod pallet_bridge_grandpa_bridge_wococo_grandpa; +pub mod pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance; +pub mod pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance; +pub mod pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance; +pub mod pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance; +pub mod pallet_bridge_relayers; pub mod pallet_collator_selection; pub mod pallet_multisig; pub mod pallet_session; @@ -36,3 +43,49 @@ pub use block_weights::constants::BlockExecutionWeight; 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 { + fn expected_extra_storage_proof_size() -> u32 { + bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE + } +} + +impl pallet_bridge_parachains::WeightInfoExt for pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance::WeightInfo { + fn expected_extra_storage_proof_size() -> u32 { + bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE + } +} 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 new file mode 100644 index 00000000..68e540ad --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs @@ -0,0 +1,80 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_bridge_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --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_grandpa +// --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 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 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) + /// Proof: BridgeRococoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(50250), added: 50745, mode: MaxEncodedLen) + /// Storage: BridgeRococoGrandpa ImportedHashesPointer (r:1 w:1) + /// Proof: BridgeRococoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BridgeRococoGrandpa ImportedHashes (r:1 w:1) + /// Proof: BridgeRococoGrandpa ImportedHashes (max_values: Some(1024), max_size: Some(36), added: 1521, mode: MaxEncodedLen) + /// Storage: BridgeRococoGrandpa ImportedHeaders (r:0 w:2) + /// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// The range of component `p` is `[1, 838]`. + /// The range of component `v` is `[50, 100]`. + /// The range of component `p` is `[1, 838]`. + /// The range of component `v` is `[50, 100]`. + fn submit_finality_proof(p: u32, _v: u32, ) -> Weight { + // Proof Size summary in bytes: + // 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 new file mode 100644 index 00000000..1c3bfb2f --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs @@ -0,0 +1,80 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_bridge_grandpa` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --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_grandpa +// --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 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 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) + /// Proof: BridgeWococoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(50250), added: 50745, mode: MaxEncodedLen) + /// Storage: BridgeWococoGrandpa ImportedHashesPointer (r:1 w:1) + /// Proof: BridgeWococoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: BridgeWococoGrandpa ImportedHashes (r:1 w:1) + /// Proof: BridgeWococoGrandpa ImportedHashes (max_values: Some(1024), max_size: Some(36), added: 1521, mode: MaxEncodedLen) + /// Storage: BridgeWococoGrandpa ImportedHeaders (r:0 w:2) + /// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// The range of component `p` is `[1, 838]`. + /// The range of component `v` is `[50, 100]`. + /// The range of component `p` is `[1, 838]`. + /// The range of component `v` is `[50, 100]`. + fn submit_finality_proof(p: u32, _v: u32, ) -> Weight { + // Proof Size summary in bytes: + // 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 new file mode 100644 index 00000000..47d1ec8d --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs @@ -0,0 +1,232 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_bridge_messages` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --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/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_bridge_messages`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_messages::WeightInfo for WeightInfo { + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn receive_single_message_proof() -> Weight { + // Proof Size summary in bytes: + // Measured: `367` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn receive_two_messages_proof() -> Weight { + // Proof Size summary in bytes: + // Measured: `367` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn receive_single_message_proof_with_outbound_lane_state() -> Weight { + // Proof Size summary in bytes: + // Measured: `367` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + fn receive_single_message_proof_1_kb() -> Weight { + // Proof Size summary in bytes: + // Measured: `335` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + fn receive_single_message_proof_16_kb() -> Weight { + // Proof Size summary in bytes: + // Measured: `335` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages OutboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen) + /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn receive_delivery_proof_for_single_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `339` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages OutboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen) + /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { + // Proof Size summary in bytes: + // Measured: `339` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages OutboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen) + /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Storage: BridgeRelayers RelayerRewards (r:2 w:2) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { + // Proof Size summary in bytes: + // Measured: `339` + // 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)) + } + /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem RelevantMessagingState (r:1 w:0) + /// Proof Skipped: ParachainSystem RelevantMessagingState (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpStatus (r:1 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpStatus (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpMessages (r:0 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured) + /// The range of component `i` is `[128, 2048]`. + /// The range of component `i` is `[128, 2048]`. + fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `635` + // 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 new file mode 100644 index 00000000..0b2aceb4 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs @@ -0,0 +1,232 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_bridge_messages` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --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/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_bridge_messages`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_messages::WeightInfo for WeightInfo { + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn receive_single_message_proof() -> Weight { + // Proof Size summary in bytes: + // Measured: `404` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn receive_two_messages_proof() -> Weight { + // Proof Size summary in bytes: + // Measured: `404` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + fn receive_single_message_proof_with_outbound_lane_state() -> Weight { + // Proof Size summary in bytes: + // Measured: `404` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + fn receive_single_message_proof_1_kb() -> Weight { + // Proof Size summary in bytes: + // Measured: `372` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + fn receive_single_message_proof_16_kb() -> Weight { + // Proof Size summary in bytes: + // Measured: `372` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages OutboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen) + /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn receive_delivery_proof_for_single_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `376` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages OutboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen) + /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { + // Proof Size summary in bytes: + // Measured: `376` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages OutboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen) + /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0) + /// Storage: BridgeRelayers RelayerRewards (r:2 w:2) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { + // Proof Size summary in bytes: + // Measured: `376` + // 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)) + } + /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen) + /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen) + /// Storage: ParachainInfo ParachainId (r:1 w:0) + /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + /// Storage: PolkadotXcm SupportedVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured) + /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1) + /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0) + /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: ParachainSystem RelevantMessagingState (r:1 w:0) + /// Proof Skipped: ParachainSystem RelevantMessagingState (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpStatus (r:1 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpStatus (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: XcmpQueue OutboundXcmpMessages (r:0 w:1) + /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured) + /// The range of component `i` is `[128, 2048]`. + /// The range of component `i` is `[128, 2048]`. + fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `672` + // 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 new file mode 100644 index 00000000..9e88bd08 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs @@ -0,0 +1,114 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_bridge_parachains` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --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_parachains +// --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 core::marker::PhantomData; + +/// Weight functions for `pallet_bridge_parachains`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_parachains::WeightInfo for WeightInfo { + /// Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0) + /// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ParasInfo (r:1 w:1) + /// Proof: BridgeRococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1) + /// Proof: BridgeRococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1) + /// 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 { + // Proof Size summary in bytes: + // 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)) + } + /// Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0) + /// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ParasInfo (r:1 w:1) + /// Proof: BridgeRococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1) + /// Proof: BridgeRococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1) + /// 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: `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)) + } + /// Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0) + /// Proof: BridgeRococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0) + /// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ParasInfo (r:1 w:1) + /// Proof: BridgeRococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1) + /// Proof: BridgeRococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen) + /// Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1) + /// 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: `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 new file mode 100644 index 00000000..238fa872 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs @@ -0,0 +1,114 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_bridge_parachains` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --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_parachains +// --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 core::marker::PhantomData; + +/// Weight functions for `pallet_bridge_parachains`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_parachains::WeightInfo for WeightInfo { + /// Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0) + /// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ParasInfo (r:1 w:1) + /// Proof: BridgeWococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1) + /// Proof: BridgeWococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1) + /// 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 { + // Proof Size summary in bytes: + // 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)) + } + /// Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0) + /// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ParasInfo (r:1 w:1) + /// Proof: BridgeWococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1) + /// Proof: BridgeWococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1) + /// 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: `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)) + } + /// Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0) + /// Proof: BridgeWococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) + /// Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0) + /// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ParasInfo (r:1 w:1) + /// Proof: BridgeWococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1) + /// Proof: BridgeWococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen) + /// Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1) + /// 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: `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 new file mode 100644 index 00000000..418f1326 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs @@ -0,0 +1,124 @@ +// Copyright 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 . + +//! Autogenerated weights for `pallet_bridge_relayers` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --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_relayers +// --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 core::marker::PhantomData; + +/// Weight functions for `pallet_bridge_relayers`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_relayers::WeightInfo for WeightInfo { + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn claim_rewards() -> Weight { + // Proof Size summary in bytes: + // Measured: `207` + // Estimated: `3593` + // Minimum execution time: 53_286_000 picoseconds. + Weight::from_parts(53_905_000, 0) + .saturating_add(Weight::from_parts(0, 3593)) + .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(68), added: 2543, mode: MaxEncodedLen) + /// Storage: unknown `0x1e8445dc201eeb8560e5579a5dd54655` (r:1 w:0) + /// Proof Skipped: unknown `0x1e8445dc201eeb8560e5579a5dd54655` (r:1 w:0) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + fn register() -> Weight { + // Proof Size summary in bytes: + // Measured: `61` + // Estimated: `4714` + // Minimum execution time: 29_145_000 picoseconds. + Weight::from_parts(29_698_000, 0) + .saturating_add(Weight::from_parts(0, 4714)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1) + /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + fn deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `160` + // Estimated: `4714` + // Minimum execution time: 30_298_000 picoseconds. + Weight::from_parts(30_754_000, 0) + .saturating_add(Weight::from_parts(0, 4714)) + .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(68), added: 2543, mode: MaxEncodedLen) + /// Storage: Balances Reserves (r:1 w:1) + /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn slash_and_deregister() -> Weight { + // Proof Size summary in bytes: + // Measured: `263` + // Estimated: `4714` + // Minimum execution time: 30_109_000 picoseconds. + Weight::from_parts(30_330_000, 0) + .saturating_add(Weight::from_parts(0, 4714)) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: BridgeRelayers RelayerRewards (r:1 w:1) + /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen) + fn register_relayer_reward() -> Weight { + // Proof Size summary in bytes: + // Measured: `6` + // Estimated: `3538` + // Minimum execution time: 3_016_000 picoseconds. + Weight::from_parts(3_130_000, 0) + .saturating_add(Weight::from_parts(0, 3538)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs index b05c5545..a0aaac56 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs @@ -18,6 +18,7 @@ mod pallet_xcm_benchmarks_fungible; mod pallet_xcm_benchmarks_generic; use crate::{xcm_config::MaxAssetsIntoHolding, Runtime}; +use codec::Encode; use frame_support::weights::Weight; use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight; use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric; @@ -217,8 +218,9 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { fn universal_origin(_: &Junction) -> Weight { Weight::MAX } - fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight { - Weight::MAX + fn export_message(_: &NetworkId, _: &Junctions, inner: &Xcm<()>) -> Weight { + let inner_encoded_len = inner.encode().len() as u32; + XcmGeneric::::export_message(inner_encoded_len) } fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight { Weight::MAX diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 8572163a..0773dca2 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -338,6 +338,21 @@ impl WeightInfo { // Minimum execution time: 3_710_000 picoseconds. Weight::from_parts(3_820_000, 0) } + // Storage: ParachainInfo ParachainId (r:1 w:0) + // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen) + // Storage: BridgeWococoMessages OutboundLanes (r:1 w:1) + // Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen) + // Storage: BridgeWococoMessages OutboundMessages (r:0 w:1) + // Proof: BridgeWococoMessages OutboundMessages (max_values: None, max_size: Some(2621472), added: 2623947, mode: MaxEncodedLen) + pub(crate) fn export_message(x: u32, ) -> Weight { + Weight::from_parts(31_677_716 as u64, 0) + // Standard Error: 4_158 + .saturating_add(Weight::from_parts(123_901, 0).saturating_mul(x as u64)) + .saturating_add(T::DbWeight::get().reads(3 as u64)) + .saturating_add(T::DbWeight::get().writes(2 as u64)) + } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` 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 c629c18e..91fd1513 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 @@ -15,8 +15,13 @@ // along with Cumulus. If not, see . use super::{ - AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, - Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Balances, BridgeGrandpaRococoInstance, + BridgeGrandpaWococoInstance, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, + RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue, +}; +use crate::{ + bridge_hub_rococo_config::ToBridgeHubWococoHaulBlobExporter, + bridge_hub_wococo_config::ToBridgeHubRococoHaulBlobExporter, }; use frame_support::{ match_types, parameter_types, @@ -29,27 +34,46 @@ use parachains_common::{ xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry}, }; use polkadot_parachain::primitives::Sibling; +use sp_core::Get; use xcm::latest::prelude::*; use xcm_builder::{ AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses, - AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds, - WithComputedOrigin, + AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, + CurrencyAdapter, EnsureXcmOrigin, IsConcrete, ParentAsSuperuser, ParentIsPreset, + RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia, + SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, + UsingComponents, WeightInfoBounds, WithComputedOrigin, +}; +use xcm_executor::{ + traits::{ExportXcm, WithOriginFilter}, + XcmExecutor, }; -use xcm_executor::{traits::WithOriginFilter, XcmExecutor}; parameter_types! { pub const RelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: Option = Some(NetworkId::Rococo); pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); pub UniversalLocation: InteriorMultiLocation = - X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into())); + X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; } +pub struct RelayNetwork; +impl Get> for RelayNetwork { + fn get() -> Option { + Some(Self::get()) + } +} +impl Get for RelayNetwork { + fn get() -> NetworkId { + match u32::from(ParachainInfo::parachain_id()) { + bp_bridge_hub_rococo::BRIDGE_HUB_ROCOCO_PARACHAIN_ID => NetworkId::Rococo, + bp_bridge_hub_wococo::BRIDGE_HUB_WOCOCO_PARACHAIN_ID => NetworkId::Wococo, + para_id => unreachable!("Not supported for para_id: {}", para_id), + } + } +} + /// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used /// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `Transact` in order to determine the dispatch Origin. @@ -84,7 +108,7 @@ pub type XcmOriginToTransactDispatchOrigin = ( // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // foreign chains who want to have a local sovereign account on this chain which they control. SovereignSignedViaLocation, - // Native converter for Relay-chain (Parent) location; will converts to a `Relay` origin when + // Native converter for Relay-chain (Parent) location; will convert to a `Relay` origin when // recognized. RelayChainAsNative, // Native converter for sibling Parachains; will convert to a `SiblingPara` origin when @@ -148,7 +172,19 @@ impl Contains for SafeCallFilter { RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::XcmpQueue(..) | RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::BridgeRococoGrandpa(pallet_bridge_grandpa::Call::< + Runtime, + BridgeGrandpaRococoInstance, + >::initialize { + .. + }) | + RuntimeCall::BridgeWococoGrandpa(pallet_bridge_grandpa::Call::< + Runtime, + BridgeGrandpaWococoInstance, + >::initialize { + .. + }) => true, _ => false, } } @@ -173,6 +209,9 @@ pub type Barrier = DenyThenTry< UniversalLocation, ConstU32<8>, >, + // 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, ), >; @@ -205,7 +244,7 @@ impl xcm_executor::Config for XcmConfig { type AssetLocker = (); type AssetExchanger = (); type FeeManager = (); - type MessageExporter = (); + type MessageExporter = BridgeHubRococoOrBridgeHubWococoSwitchExporter; type UniversalAliases = Nothing; type CallDispatcher = WithOriginFilter; type SafeCallFilter = SafeCallFilter; @@ -231,12 +270,11 @@ parameter_types! { impl pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; + type XcmRouter = XcmRouter; // We want to disallow users sending (arbitrary) XCMs from this chain. type SendXcmOrigin = EnsureXcmOrigin; - type XcmRouter = XcmRouter; // We support local origins dispatching XCM executions in principle... type ExecuteXcmOrigin = EnsureXcmOrigin; - // ... but disallow generic XCM execution. As a result only teleports are allowed. type XcmExecuteFilter = Nothing; type XcmExecutor = XcmExecutor; type XcmTeleportFilter = Everything; @@ -266,3 +304,46 @@ impl cumulus_pallet_xcm::Config for Runtime { type RuntimeEvent = RuntimeEvent; type XcmExecutor = XcmExecutor; } + +/// Hacky switch implementation, because we have just one runtime for Rococo and Wococo BridgeHub, so it means we have just one XcmConfig +pub struct BridgeHubRococoOrBridgeHubWococoSwitchExporter; +impl ExportXcm for BridgeHubRococoOrBridgeHubWococoSwitchExporter { + type Ticket = (NetworkId, (sp_std::prelude::Vec, XcmHash)); + + fn validate( + network: NetworkId, + channel: u32, + universal_source: &mut Option, + destination: &mut Option, + message: &mut Option>, + ) -> SendResult { + match network { + Rococo => ToBridgeHubRococoHaulBlobExporter::validate( + network, + channel, + universal_source, + destination, + message, + ) + .map(|result| ((Rococo, result.0), result.1)), + Wococo => ToBridgeHubWococoHaulBlobExporter::validate( + network, + channel, + universal_source, + destination, + message, + ) + .map(|result| ((Wococo, result.0), result.1)), + _ => unimplemented!("Unsupported network: {:?}", network), + } + } + + fn deliver(ticket: Self::Ticket) -> Result { + let (network, ticket) = ticket; + match network { + Rococo => ToBridgeHubRococoHaulBlobExporter::deliver(ticket), + Wococo => ToBridgeHubWococoHaulBlobExporter::deliver(ticket), + _ => unimplemented!("Unsupported network: {:?}", network), + } + } +} 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 bf899b56..a31171ba 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/tests/tests.rs @@ -15,10 +15,20 @@ // along with Cumulus. If not, see . pub use bridge_hub_rococo_runtime::{ - constants::fee::WeightToFee, xcm_config::XcmConfig, Balances, ExistentialDeposit, - ParachainSystem, PolkadotXcm, Runtime, RuntimeEvent, SessionKeys, + constants::fee::WeightToFee, + xcm_config::{RelayNetwork, XcmConfig, XcmRouter}, + Balances, BridgeGrandpaRococoInstance, BridgeGrandpaWococoInstance, BridgeWococoMessages, + ExistentialDeposit, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, + SessionKeys, }; -use codec::Decode; +use codec::{Decode, Encode}; +use xcm::latest::prelude::*; + +use bridge_hub_rococo_runtime::{ + bridge_hub_rococo_config, bridge_hub_wococo_config, WithBridgeHubRococoMessagesInstance, + WithBridgeHubWococoMessagesInstance, +}; + use frame_support::parameter_types; use parachains_common::{AccountId, AuraId}; @@ -28,29 +38,188 @@ 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, - } - }), - 1013 -); +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 + ); +} + +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 + ); +} diff --git a/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml b/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml index ccee28f8..096c7779 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/test-utils/Cargo.toml @@ -6,12 +6,68 @@ 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 +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-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 +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" } +xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } +xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" } + +# Bridges +bp-header-chain = { path = "../../../../bridges/primitives/header-chain", default-features = false } +bp-messages = { path = "../../../../bridges/primitives/messages", default-features = false } +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", + "bp-polkadot-core/std", + "bp-header-chain/std", + "bp-runtime/std", + "bp-test-utils/std", + "bridge-runtime-common/std", + "pallet-bridge-grandpa/std", + "pallet-bridge-messages/std", + "parachain-info/std", + "cumulus-pallet-parachain-system/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 882910b5..b65b25c5 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/lib.rs @@ -14,5 +14,6 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . +pub use bp_test_utils::test_header; 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 index cdbeb65f..5cdc2af9 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs @@ -16,5 +16,476 @@ //! 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}; +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/polkadot-parachain/src/chain_spec/bridge_hubs.rs b/polkadot-parachain/src/chain_spec/bridge_hubs.rs index ab3e4422..e11f7f6e 100644 --- a/polkadot-parachain/src/chain_spec/bridge_hubs.rs +++ b/polkadot-parachain/src/chain_spec/bridge_hubs.rs @@ -1,4 +1,4 @@ -// Copyright 2019-2021 Parity Technologies (UK) Ltd. +// Copyright 2022 Parity Technologies (UK) Ltd. // This file is part of Cumulus. // Cumulus is free software: you can redistribute it and/or modify @@ -14,10 +14,12 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . +use crate::chain_spec::{get_account_id_from_seed, get_collator_keys_from_seed}; use cumulus_primitives_core::ParaId; use parachains_common::Balance as BridgeHubBalance; use sc_chain_spec::ChainSpec; use sc_cli::RuntimeVersion; +use sp_core::sr25519; use std::{path::PathBuf, str::FromStr}; /// Collects all supported BridgeHub configurations @@ -139,6 +141,7 @@ impl BridgeHubRuntimeType { "Rococo BridgeHub Local", "rococo-local", ParaId::new(1013), + Some("Bob".to_string()), |_| (), ))), BridgeHubRuntimeType::RococoDevelopment => Ok(Box::new(rococo::local_config( @@ -146,6 +149,7 @@ impl BridgeHubRuntimeType { "Rococo BridgeHub Development", "rococo-dev", ParaId::new(1013), + Some("Bob".to_string()), |_| (), ))), BridgeHubRuntimeType::Wococo => @@ -157,6 +161,7 @@ impl BridgeHubRuntimeType { "Wococo BridgeHub Local", "wococo-local", ParaId::new(1014), + Some("Bob".to_string()), ))), } } @@ -197,13 +202,12 @@ fn ensure_id(id: &str) -> Result<&str, String> { /// Sub-module for Rococo setup pub mod rococo { - use super::{BridgeHubBalance, ParaId}; - use crate::chain_spec::{ - get_account_id_from_seed, get_collator_keys_from_seed, Extensions, SAFE_XCM_VERSION, - }; + use super::{get_account_id_from_seed, get_collator_keys_from_seed, sr25519, ParaId}; + use crate::chain_spec::{Extensions, SAFE_XCM_VERSION}; use parachains_common::{AccountId, AuraId}; use sc_chain_spec::ChainType; - use sp_core::sr25519; + + use super::BridgeHubBalance; pub(crate) const BRIDGE_HUB_ROCOCO: &str = "bridge-hub-rococo"; pub(crate) const BRIDGE_HUB_ROCOCO_LOCAL: &str = "bridge-hub-rococo-local"; @@ -222,6 +226,7 @@ pub mod rococo { chain_name: &str, relay_chain: &str, para_id: ParaId, + bridges_pallet_owner_seed: Option, modify_props: ModifyProperties, ) -> BridgeHubChainSpec { // Rococo defaults @@ -265,6 +270,9 @@ pub mod rococo { get_account_id_from_seed::("Ferdie//stash"), ], para_id, + bridges_pallet_owner_seed + .as_ref() + .map(|seed| get_account_id_from_seed::(&seed)), ) }, Vec::new(), @@ -280,6 +288,7 @@ pub mod rococo { invulnerables: Vec<(AccountId, AuraId)>, endowed_accounts: Vec, id: ParaId, + bridges_pallet_owner: Option, ) -> bridge_hub_rococo_runtime::GenesisConfig { bridge_hub_rococo_runtime::GenesisConfig { system: bridge_hub_rococo_runtime::SystemConfig { @@ -314,6 +323,22 @@ pub mod rococo { polkadot_xcm: bridge_hub_rococo_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, + bridge_wococo_grandpa: bridge_hub_rococo_runtime::BridgeWococoGrandpaConfig { + owner: bridges_pallet_owner.clone(), + ..Default::default() + }, + bridge_rococo_grandpa: bridge_hub_rococo_runtime::BridgeRococoGrandpaConfig { + owner: bridges_pallet_owner.clone(), + ..Default::default() + }, + bridge_rococo_messages: bridge_hub_rococo_runtime::BridgeRococoMessagesConfig { + owner: bridges_pallet_owner.clone(), + ..Default::default() + }, + bridge_wococo_messages: bridge_hub_rococo_runtime::BridgeWococoMessagesConfig { + owner: bridges_pallet_owner, + ..Default::default() + }, } } } @@ -334,10 +359,18 @@ pub mod wococo { chain_name: &str, relay_chain: &str, para_id: ParaId, + bridges_pallet_owner_seed: Option, ) -> BridgeHubChainSpec { - rococo::local_config(id, chain_name, relay_chain, para_id, |properties| { - properties.insert("tokenSymbol".into(), "WOOK".into()); - }) + rococo::local_config( + id, + chain_name, + relay_chain, + para_id, + bridges_pallet_owner_seed, + |properties| { + properties.insert("tokenSymbol".into(), "WOOK".into()); + }, + ) } } diff --git a/scripts/bridges_rococo_wococo.sh b/scripts/bridges_rococo_wococo.sh new file mode 100755 index 00000000..fa79ab88 --- /dev/null +++ b/scripts/bridges_rococo_wococo.sh @@ -0,0 +1,673 @@ +#!/bin/bash + +# Address: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY +# AccountId: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] +STATEMINE_ACCOUNT_SEED_FOR_LOCAL="//Alice" +# Address: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY +# AccountId: [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] +WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" + +# Address: GegTpZJMyzkntLN7NJhRfHDk4GWukLbGSsag6PHrLSrCK4h +ROCKMINE2_ACCOUNT_SEED_FOR_ROCOCO="scatter feed race company oxygen trip extra elbow slot bundle auto canoe" + +# Adress: 5Ge7YcbctWCP1CccugzxWDn9hFnTxvTh3bL6PNy4ubNJmp7Y / H9jCvwVWsDJkrS4gPp1QB99qr4hmbGsVyAqn3F2PPaoWyU3 +# AccountId: [202, 107, 198, 135, 15, 25, 193, 165, 172, 73, 137, 218, 115, 177, 204, 0, 5, 155, 215, 86, 208, 51, 50, 130, 190, 110, 184, 143, 124, 50, 160, 20] +WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO="5Ge7YcbctWCP1CccugzxWDn9hFnTxvTh3bL6PNy4ubNJmp7Y" +WOCKMINT_ACCOUNT_SEED_FOR_WOCOCO="tone spirit magnet sunset cannon poverty forget lock river east blouse random" + +function address_to_account_id_bytes() { + local address=$1 + local output=$2 + echo "address_to_account_id_bytes - address: $address, output: $output" + if [ $address == "$WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL" ]; then + jq --null-input '[212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125]' > $output + elif [ $address == "$WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO" ]; then + jq --null-input '[202, 107, 198, 135, 15, 25, 193, 165, 172, 73, 137, 218, 115, 177, 204, 0, 5, 155, 215, 86, 208, 51, 50, 130, 190, 110, 184, 143, 124, 50, 160, 20]' > $output + else + echo -n "Sorry, unknown address: $address - please, add bytes here or function for that!" + exit 1 + fi +} + +function ensure_binaries() { + if [[ ! -f ~/local_bridge_testing/bin/polkadot ]]; then + echo " Required polkadot binary '~/local_bridge_testing/bin/polkadot' does not exist!" + echo " You need to build it and copy to this location!" + echo " Please, check ./parachains/runtimes/bridge-hubs/README.md (Prepare/Build/Deploy)" + exit 1 + fi + if [[ ! -f ~/local_bridge_testing/bin/polkadot-parachain ]]; then + echo " Required polkadot-parachain binary '~/local_bridge_testing/bin/polkadot-parachain' does not exist!" + echo " You need to build it and copy to this location!" + echo " Please, check ./parachains/runtimes/bridge-hubs/README.md (Prepare/Build/Deploy)" + exit 1 + fi +} + +function ensure_relayer() { + if [[ ! -f ~/local_bridge_testing/bin/substrate-relay ]]; then + echo " Required substrate-relay binary '~/local_bridge_testing/bin/substrate-relay' does not exist!" + echo " You need to build it and copy to this location!" + echo " Please, check ./parachains/runtimes/bridge-hubs/README.md (Prepare/Build/Deploy)" + exit 1 + fi +} + +function ensure_polkadot_js_api() { + if ! which polkadot-js-api &> /dev/null; then + echo '' + echo 'Required command `polkadot-js-api` not in PATH, please, install, e.g.:' + echo "npm install -g @polkadot/api-cli@beta" + echo " or" + echo "yarn global add @polkadot/api-cli" + echo '' + exit 1 + fi + if ! which jq &> /dev/null; then + echo '' + echo 'Required command `jq` not in PATH, please, install, e.g.:' + echo "apt install -y jq" + echo '' + exit 1 + fi + generate_hex_encoded_call_data "check" "--" + local retVal=$? + if [ $retVal -ne 0 ]; then + echo "" + echo "" + echo "-------------------" + echo "Installing (nodejs) sub module: ./scripts/generate_hex_encoded_call" + pushd ./scripts/generate_hex_encoded_call + npm install + popd + fi +} + +function generate_hex_encoded_call_data() { + local type=$1 + local endpoint=$2 + local output=$3 + shift + shift + shift + echo "Input params: $@" + + node ./scripts/generate_hex_encoded_call "$type" "$endpoint" "$output" "$@" + local retVal=$? + + if [ $type != "check" ]; then + local hex_encoded_data=$(cat $output) + echo "Generated hex-encoded bytes to file '$output': $hex_encoded_data" + fi + + return $retVal +} + +function transfer_balance() { + local runtime_para_endpoint=$1 + local seed=$2 + local target_account=$3 + local amount=$4 + echo " calling transfer_balance:" + echo " runtime_para_endpoint: ${runtime_para_endpoint}" + echo " seed: ${seed}" + echo " target_account: ${target_account}" + echo " amount: ${amount}" + echo "--------------------------------------------------" + + polkadot-js-api \ + --ws "${runtime_para_endpoint}" \ + --seed "${seed?}" \ + tx.balances.transfer \ + "${target_account}" \ + "${amount}" +} + +function send_governance_transact() { + local relay_url=$1 + local relay_chain_seed=$2 + local para_id=$3 + local hex_encoded_data=$4 + local require_weight_at_most_ref_time=$5 + local require_weight_at_most_proof_size=$6 + echo " calling send_governance_transact:" + echo " relay_url: ${relay_url}" + echo " relay_chain_seed: ${relay_chain_seed}" + echo " para_id: ${para_id}" + echo " hex_encoded_data: ${hex_encoded_data}" + echo " require_weight_at_most_ref_time: ${require_weight_at_most_ref_time}" + echo " require_weight_at_most_proof_size: ${require_weight_at_most_proof_size}" + echo " params:" + + local dest=$(jq --null-input \ + --arg para_id "$para_id" \ + '{ "V3": { "parents": 0, "interior": { "X1": { "Parachain": $para_id } } } }') + + local message=$(jq --null-input \ + --argjson hex_encoded_data $hex_encoded_data \ + --arg require_weight_at_most_ref_time "$require_weight_at_most_ref_time" \ + --arg require_weight_at_most_proof_size "$require_weight_at_most_proof_size" \ + ' + { + "V3": [ + { + "UnpaidExecution": { + "weight_limit": "Unlimited" + } + }, + { + "Transact": { + "origin_kind": "Superuser", + "require_weight_at_most": { + "ref_time": $require_weight_at_most_ref_time, + "proof_size": $require_weight_at_most_proof_size, + }, + "call": { + "encoded": $hex_encoded_data + } + } + } + ] + } + ') + + echo "" + echo " dest:" + echo "${dest}" + echo "" + echo " message:" + echo "${message}" + echo "" + echo "--------------------------------------------------" + + polkadot-js-api \ + --ws "${relay_url?}" \ + --seed "${relay_chain_seed?}" \ + --sudo \ + tx.xcmPallet.send \ + "${dest}" \ + "${message}" +} + +function allow_assets_transfer_send() { + local relay_url=$1 + local relay_chain_seed=$2 + local runtime_para_id=$3 + local runtime_para_endpoint=$4 + local bridge_hub_para_id=$5 + local bridged_para_network=$6 + local bridged_para_para_id=$7 + echo " calling allow_assets_transfer_send:" + echo " relay_url: ${relay_url}" + echo " relay_chain_seed: ${relay_chain_seed}" + echo " runtime_para_id: ${runtime_para_id}" + echo " runtime_para_endpoint: ${runtime_para_endpoint}" + echo " bridge_hub_para_id: ${bridge_hub_para_id}" + echo " bridged_para_network: ${bridged_para_network}" + echo " bridged_para_para_id: ${bridged_para_para_id}" + echo " params:" + + # 1. generate data for Transact (add_exporter_config) + local bridge_config=$(jq --null-input \ + --arg bridge_hub_para_id "$bridge_hub_para_id" \ + --arg bridged_para_network "$bridged_para_network" \ + --arg bridged_para_para_id "$bridged_para_para_id" \ + ' + { + "bridgeLocation": { + "parents": 1, + "interior": { + "X1": { "Parachain": $bridge_hub_para_id } + } + }, + "allowedTargetLocation": { + "parents": 2, + "interior": { + "X2": [ + { + "GlobalConsensus": $bridged_para_network, + }, + { + "Parachain": $bridged_para_para_id + } + ] + } + }, + "maxTargetLocationFee": { + "id": { + "Concrete": { + "parents": 1, + "interior": "Here" + } + }, + "fun": { + "Fungible": 50000000000 + } + } + } + ' + ) + local tmp_output_file=$(mktemp) + generate_hex_encoded_call_data "add-exporter-config" "${runtime_para_endpoint}" "${tmp_output_file}" $bridged_para_network "$bridge_config" + local hex_encoded_data=$(cat $tmp_output_file) + + send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000 +} + +function force_create_foreign_asset() { + local relay_url=$1 + local relay_chain_seed=$2 + local runtime_para_id=$3 + local runtime_para_endpoint=$4 + local global_consensus=$5 + local asset_owner_account_id=$6 + echo " calling force_create_foreign_asset:" + echo " relay_url: ${relay_url}" + echo " relay_chain_seed: ${relay_chain_seed}" + echo " runtime_para_id: ${runtime_para_id}" + echo " runtime_para_endpoint: ${runtime_para_endpoint}" + echo " global_consensus: ${global_consensus}" + echo " asset_owner_account_id: ${asset_owner_account_id}" + echo " params:" + + # 1. generate data for Transact (ForeignAssets::force_create) + local asset_id=$(jq --null-input \ + --arg global_consensus "$global_consensus" \ + ' + { + "parents": 2, + "interior": { + "X1": { + "GlobalConsensus": $global_consensus, + } + } + } + ' + ) + local tmp_output_file=$(mktemp) + generate_hex_encoded_call_data "force-create-asset" "${runtime_para_endpoint}" "${tmp_output_file}" "$asset_id" "$asset_owner_account_id" false "1000" + local hex_encoded_data=$(cat $tmp_output_file) + + send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000 +} + +function allow_assets_transfer_receive() { + local relay_url=$1 + local relay_chain_seed=$2 + local runtime_para_id=$3 + local runtime_para_endpoint=$4 + local bridge_hub_para_id=$5 + local bridged_network=$6 + local bridged_para_id=$7 + echo " calling allow_assets_transfer_receive:" + echo " relay_url: ${relay_url}" + echo " relay_chain_seed: ${relay_chain_seed}" + echo " runtime_para_id: ${runtime_para_id}" + echo " runtime_para_endpoint: ${runtime_para_endpoint}" + echo " bridge_hub_para_id: ${bridge_hub_para_id}" + echo " bridged_network: ${bridged_network}" + echo " bridged_para_id: ${bridged_para_id}" + echo " params:" + + # 1. generate data for Transact (add_universal_alias) + local location=$(jq --null-input \ + --arg bridge_hub_para_id "$bridge_hub_para_id" \ + '{ "V3": { "parents": 1, "interior": { "X1": { "Parachain": $bridge_hub_para_id } } } }') + + local junction=$(jq --null-input \ + --arg bridged_network "$bridged_network" \ + '{ "GlobalConsensus": $bridged_network } ') + + local tmp_output_file=$(mktemp) + generate_hex_encoded_call_data "add-universal-alias" "${runtime_para_endpoint}" "${tmp_output_file}" "$location" "$junction" + local hex_encoded_data=$(cat $tmp_output_file) + + send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000 + + # 2. generate data for Transact (add_reserve_location) + local reserve_location=$(jq --null-input \ + --arg bridged_network "$bridged_network" \ + --arg bridged_para_id "$bridged_para_id" \ + '{ "V3": { + "parents": 2, + "interior": { + "X2": [ + { + "GlobalConsensus": $bridged_network, + }, + { + "Parachain": $bridged_para_id + } + ] + } + } }') + + local tmp_output_file=$(mktemp) + generate_hex_encoded_call_data "add-reserve-location" "${runtime_para_endpoint}" "${tmp_output_file}" "$reserve_location" + local hex_encoded_data=$(cat $tmp_output_file) + + send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000 +} + +function remove_assets_transfer_send() { + local relay_url=$1 + local relay_chain_seed=$2 + local runtime_para_id=$3 + local runtime_para_endpoint=$4 + local bridged_network=$5 + echo " calling remove_assets_transfer_send:" + echo " relay_url: ${relay_url}" + echo " relay_chain_seed: ${relay_chain_seed}" + echo " runtime_para_id: ${runtime_para_id}" + echo " runtime_para_endpoint: ${runtime_para_endpoint}" + echo " bridged_network: ${bridged_network}" + echo " params:" + + local tmp_output_file=$(mktemp) + generate_hex_encoded_call_data "remove-exporter-config" "${runtime_para_endpoint}" "${tmp_output_file}" $bridged_network + local hex_encoded_data=$(cat $tmp_output_file) + + send_governance_transact "${relay_url}" "${relay_chain_seed}" "${runtime_para_id}" "${hex_encoded_data}" 200000000 12000 +} + +# TODO: we need to fill sovereign account for bridge-hub, because, small ammouts does not match ExistentialDeposit, so no reserve pass +# SA for BH: MultiLocation { parents: 1, interior: X1(Parachain(1013)) } - 5Eg2fntRRwLinojmk3sh5xscp7F3S6Zzm5oDVtoLTALKiypR on Statemine + +function transfer_asset_via_bridge() { + local url=$1 + local seed=$2 + local target_account=$3 + echo " calling transfer_asset_via_bridge:" + echo " url: ${url}" + echo " seed: ${seed}" + echo " target_account: ${target_account}" + echo " params:" + + local assets=$(jq --null-input \ + ' + { + "V3": [ + { + "id": { + "Concrete": { + "parents": 1, + "interior": "Here" + } + }, + "fun": { + "Fungible": 100000000 + } + } + ] + } + ' + ) + + local tmp_output_file=$(mktemp) + address_to_account_id_bytes "$target_account" "${tmp_output_file}" + local hex_encoded_data=$(cat $tmp_output_file) + + local destination=$(jq --null-input \ + --argjson hex_encoded_data "$hex_encoded_data" \ + ' + { + "V3": { + "parents": 2, + "interior": { + "X3": [ + { + "GlobalConsensus": "Wococo" + }, + { + "Parachain": 1000 + }, + { + "AccountId32": { + "id": $hex_encoded_data + } + } + ] + } + } + } + ' + ) + + echo "" + echo " assets:" + echo "${assets}" + echo "" + echo " destination:" + echo "${destination}" + echo "" + echo "--------------------------------------------------" + + polkadot-js-api \ + --ws "${url?}" \ + --seed "${seed?}" \ + tx.bridgeTransfer.transferAssetViaBridge \ + "${assets}" \ + "${destination}" +} + +function ping_via_bridge() { + local url=$1 + local seed=$2 + local target_account=$3 + echo " calling ping_via_bridge:" + echo " url: ${url}" + echo " seed: ${seed}" + echo " target_account: ${target_account}" + echo " params:" + + local tmp_output_file=$(mktemp) + address_to_account_id_bytes "$target_account" "${tmp_output_file}" + local hex_encoded_data=$(cat $tmp_output_file) + + local destination=$(jq --null-input \ + --argjson hex_encoded_data "$hex_encoded_data" \ + ' + { + "V3": { + "parents": 2, + "interior": { + "X3": [ + { + "GlobalConsensus": "Wococo" + }, + { + "Parachain": 1000 + }, + { + "AccountId32": { + "id": $hex_encoded_data + } + } + ] + } + } + } + ' + ) + + echo "" + echo " destination:" + echo "${destination}" + echo "" + echo "--------------------------------------------------" + + polkadot-js-api \ + --ws "${url?}" \ + --seed "${seed?}" \ + tx.bridgeTransfer.pingViaBridge \ + "${destination}" +} + +function init_ro_wo() { + ensure_relayer + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + ~/local_bridge_testing/bin/substrate-relay init-bridge rococo-to-bridge-hub-wococo \ + --source-host localhost \ + --source-port 9942 \ + --source-version-mode Auto \ + --target-host localhost \ + --target-port 8945 \ + --target-version-mode Auto \ + --target-signer //Bob +} + +function init_wo_ro() { + ensure_relayer + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + ~/local_bridge_testing/bin/substrate-relay init-bridge wococo-to-bridge-hub-rococo \ + --source-host localhost \ + --source-port 9945 \ + --source-version-mode Auto \ + --target-host localhost \ + --target-port 8943 \ + --target-version-mode Auto \ + --target-signer //Bob +} + +function run_relay() { + ensure_relayer + + RUST_LOG=runtime=trace,rpc=trace,bridge=trace \ + ~/local_bridge_testing/bin/substrate-relay relay-headers-and-messages bridge-hub-rococo-bridge-hub-wococo \ + --rococo-host localhost \ + --rococo-port 9942 \ + --rococo-version-mode Auto \ + --bridge-hub-rococo-host localhost \ + --bridge-hub-rococo-port 8943 \ + --bridge-hub-rococo-version-mode Auto \ + --bridge-hub-rococo-signer //Charlie \ + --wococo-headers-to-bridge-hub-rococo-signer //Bob \ + --wococo-parachains-to-bridge-hub-rococo-signer //Bob \ + --bridge-hub-rococo-transactions-mortality 4 \ + --wococo-host localhost \ + --wococo-port 9945 \ + --wococo-version-mode Auto \ + --bridge-hub-wococo-host localhost \ + --bridge-hub-wococo-port 8945 \ + --bridge-hub-wococo-version-mode Auto \ + --bridge-hub-wococo-signer //Charlie \ + --rococo-headers-to-bridge-hub-wococo-signer //Bob \ + --rococo-parachains-to-bridge-hub-wococo-signer //Bob \ + --bridge-hub-wococo-transactions-mortality 4 \ + --lane 00000001 +} + +case "$1" in + run-relay) + init_ro_wo + init_wo_ro + run_relay + ;; + allow-transfers-local) + # this allows send transfers on statemine (by governance-like) + ./$0 "allow-transfer-on-statemine-local" + # this allows receive transfers on westmint (by governance-like) + ./$0 "allow-transfer-on-westmint-local" + ;; + allow-transfer-on-statemine-local) + ensure_polkadot_js_api + allow_assets_transfer_send \ + "ws://127.0.0.1:9942" \ + "//Alice" \ + 1000 \ + "ws://127.0.0.1:9910" \ + 1013 \ + "Wococo" 1000 + ;; + allow-transfer-on-westmint-local) + ensure_polkadot_js_api + allow_assets_transfer_receive \ + "ws://127.0.0.1:9945" \ + "//Alice" \ + 1000 \ + "ws://127.0.0.1:9010" \ + 1014 \ + "Rococo" \ + 1000 + # drip SovereignAccount for `MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1000)) }` => 5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG + # drip SovereignAccount for `MultiLocation { parents: 2, interior: X2(GlobalConsensus(Rococo), Parachain(1015)) }` => 5FS75NFUdEYhWHuV3y3ncjSG4PFdHfC5X7V6SEzc3rnCciwb + transfer_balance \ + "ws://127.0.0.1:9010" \ + "//Alice" \ + "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" \ + $((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" \ + "//Alice" \ + 1000 \ + "ws://127.0.0.1:9010" \ + "Kusama" \ + "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" + ;; + remove-assets-transfer-from-statemine-local) + ensure_polkadot_js_api + remove_assets_transfer_send \ + "ws://127.0.0.1:9942" \ + "//Alice" \ + 1000 \ + "ws://127.0.0.1:9910" \ + "Wococo" + ;; + transfer-asset-from-statemine-local) + ensure_polkadot_js_api + transfer_asset_via_bridge \ + "ws://127.0.0.1:9910" \ + "$STATEMINE_ACCOUNT_SEED_FOR_LOCAL" \ + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL" + ;; + transfer-asset-from-statemine-rococo) + ensure_polkadot_js_api + transfer_asset_via_bridge \ + "wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \ + "$ROCKMINE2_ACCOUNT_SEED_FOR_ROCOCO" \ + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO" + ;; + ping-via-bridge-from-statemine-local) + ensure_polkadot_js_api + ping_via_bridge \ + "ws://127.0.0.1:9910" \ + "$STATEMINE_ACCOUNT_SEED_FOR_LOCAL" \ + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_LOCAL" + ;; + ping-via-bridge-from-statemine-rococo) + ensure_polkadot_js_api + ping_via_bridge \ + "wss://ws-rococo-rockmine2-collator-node-0.parity-testnet.parity.io" \ + "${ROCKMINE2_ACCOUNT_SEED_FOR_ROCOCO}" \ + "$WOCKMINT_ACCOUNT_ADDRESS_FOR_ROCOCO" + ;; + drip) + transfer_balance \ + "ws://127.0.0.1:9010" \ + "//Alice" \ + "5DHZvp523gmJWxg9UcLVbofyu5nZkPvATeP1ciYncpFpXtiG" \ + $((1000000000 + 50000000000 * 20)) + ;; + stop) + pkill -f polkadot + pkill -f parachain + ;; + *) + echo "A command is require. Supported commands for: + Local (zombienet) run: + - run-relay + - allow-transfers-local + - allow-transfer-on-statemine-local + - allow-transfer-on-westmint-local + - remove-assets-transfer-from-statemine-local + - transfer-asset-from-statemine-local + - ping-via-bridge-from-statemine-local + Live Rococo/Wococo run: + - transfer-asset-from-statemine-rococo + - ping-via-bridge-from-statemine-rococo"; + exit 1 + ;; +esac diff --git a/scripts/bridges_update_subtree.sh b/scripts/bridges_update_subtree.sh index bd9161b6..3928dc23 100755 --- a/scripts/bridges_update_subtree.sh +++ b/scripts/bridges_update_subtree.sh @@ -82,4 +82,4 @@ case "$1" in fetch patch ;; -esac \ No newline at end of file +esac diff --git a/scripts/generate_hex_encoded_call/index.js b/scripts/generate_hex_encoded_call/index.js new file mode 100644 index 00000000..b135622c --- /dev/null +++ b/scripts/generate_hex_encoded_call/index.js @@ -0,0 +1,146 @@ +const fs = require("fs"); +const { exit } = require("process"); +const { WsProvider, ApiPromise } = require("@polkadot/api"); +const util = require("@polkadot/util"); + +// connect to a substrate chain and return the api object +async function connect(endpoint, types = {}) { + const provider = new WsProvider(endpoint); + const api = await ApiPromise.create({ + provider, + types, + throwOnConnect: false, + }); + return api; +} + +function writeHexEncodedBytesToOutput(method, outputFile) { + console.log("Payload (hex): ", method.toHex()); + console.log("Payload (bytes): ", Array.from(method.toU8a())); + fs.writeFileSync(outputFile, JSON.stringify(Array.from(method.toU8a()))); +} + +function remarkWithEvent(endpoint, outputFile) { + console.log(`Generating remarkWithEvent from RPC endpoint: ${endpoint} to outputFile: ${outputFile}`); + connect(endpoint) + .then((api) => { + const call = api.tx.system.remarkWithEvent("Hello"); + writeHexEncodedBytesToOutput(call.method, outputFile); + exit(0); + }) + .catch((e) => { + console.error(e); + exit(1); + }); +} + +function addExporterConfig(endpoint, outputFile, bridgedNetwork, bridgeConfig) { + console.log(`Generating addExporterConfig from RPC endpoint: ${endpoint} to outputFile: ${outputFile} based on bridgedNetwork: ${bridgedNetwork}, bridgeConfig: ${bridgeConfig}`); + connect(endpoint) + .then((api) => { + const call = api.tx.bridgeTransfer.addExporterConfig(bridgedNetwork, JSON.parse(bridgeConfig)); + writeHexEncodedBytesToOutput(call.method, outputFile); + exit(0); + }) + .catch((e) => { + console.error(e); + exit(1); + }); +} + +function addUniversalAlias(endpoint, outputFile, location, junction) { + console.log(`Generating addUniversalAlias from RPC endpoint: ${endpoint} to outputFile: ${outputFile} based on location: ${location}, junction: ${junction}`); + connect(endpoint) + .then((api) => { + const call = api.tx.bridgeTransfer.addUniversalAlias(JSON.parse(location), JSON.parse(junction)); + writeHexEncodedBytesToOutput(call.method, outputFile); + exit(0); + }) + .catch((e) => { + console.error(e); + exit(1); + }); +} + +function addReserveLocation(endpoint, outputFile, reserve_location) { + console.log(`Generating addReserveLocation from RPC endpoint: ${endpoint} to outputFile: ${outputFile} based on reserve_location: ${reserve_location}`); + connect(endpoint) + .then((api) => { + const call = api.tx.bridgeTransfer.addReserveLocation(JSON.parse(reserve_location)); + writeHexEncodedBytesToOutput(call.method, outputFile); + exit(0); + }) + .catch((e) => { + console.error(e); + exit(1); + }); +} + +function removeExporterConfig(endpoint, outputFile, bridgedNetwork) { + console.log(`Generating removeExporterConfig from RPC endpoint: ${endpoint} to outputFile: ${outputFile} based on bridgedNetwork: ${bridgedNetwork}`); + connect(endpoint) + .then((api) => { + const call = api.tx.bridgeTransfer.removeExporterConfig(bridgedNetwork); + writeHexEncodedBytesToOutput(call.method, outputFile); + exit(0); + }) + .catch((e) => { + console.error(e); + exit(1); + }); +} + +function forceCreateAsset(endpoint, outputFile, assetId, assetOwnerAccountId, isSufficient, minBalance) { + console.log(`Generating forceCreateAsset from RPC endpoint: ${endpoint} to outputFile: ${outputFile} based on assetId: ${assetId}, assetOwnerAccountId: ${assetOwnerAccountId}, isSufficient: ${isSufficient}, minBalance: ${minBalance}`); + connect(endpoint) + .then((api) => { + const call = api.tx.foreignAssets.forceCreate(JSON.parse(assetId), assetOwnerAccountId, isSufficient, minBalance); + writeHexEncodedBytesToOutput(call.method, outputFile); + exit(0); + }) + .catch((e) => { + console.error(e); + exit(1); + }); +} + +if (!process.argv[2] || !process.argv[3]) { + console.log("usage: node ./script/generate_hex_encoded_call "); + exit(1); +} + +const type = process.argv[2]; +const rpcEnpoint = process.argv[3]; +const output = process.argv[4]; +const inputArgs = process.argv.slice(5, process.argv.length); +console.log(`Generating hex-encoded call data for:`); +console.log(` type: ${type}`); +console.log(` rpcEnpoint: ${rpcEnpoint}`); +console.log(` output: ${output}`); +console.log(` inputArgs: ${inputArgs}`); + +switch (type) { + case 'remark-with-event': + remarkWithEvent(rpcEnpoint, output); + break; + case 'add-exporter-config': + addExporterConfig(rpcEnpoint, output, inputArgs[0], inputArgs[1]); + break; + case 'remove-exporter-config': + removeExporterConfig(rpcEnpoint, output, inputArgs[0], inputArgs[1]); + break; + case 'add-universal-alias': + addUniversalAlias(rpcEnpoint, output, inputArgs[0], inputArgs[1]); + break; + case 'add-reserve-location': + addReserveLocation(rpcEnpoint, output, inputArgs[0]); + break; + case 'force-create-asset': + forceCreateAsset(rpcEnpoint, output, inputArgs[0], inputArgs[1], inputArgs[2], inputArgs[3]); + break; + case 'check': + console.log(`Checking nodejs installation, if you see this everything is ready!`); + break; + default: + console.log(`Sorry, we are out of ${type} - not yet supported!`); +} diff --git a/scripts/generate_hex_encoded_call/package-lock.json b/scripts/generate_hex_encoded_call/package-lock.json new file mode 100644 index 00000000..3383265e --- /dev/null +++ b/scripts/generate_hex_encoded_call/package-lock.json @@ -0,0 +1,1213 @@ +{ + "name": "y", + "version": "y", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "y", + "version": "y", + "license": "MIT", + "dependencies": { + "@polkadot/api": "^6.5.2", + "@polkadot/util": "^7.6.1" + } + }, + "node_modules/@babel/runtime": { + "version": "7.20.13", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.13.tgz", + "integrity": "sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==", + "dependencies": { + "regenerator-runtime": "^0.13.11" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@noble/hashes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.0.0.tgz", + "integrity": "sha512-DZVbtY62kc3kkBtMHqwCOfXrT/hnoORy5BJ4+HU1IR59X0KWAOqsfzQPcUl/lQLlG7qXbe/fZ3r/emxtAl+sqg==" + }, + "node_modules/@noble/secp256k1": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.5.5.tgz", + "integrity": "sha512-sZ1W6gQzYnu45wPrWx8D3kwI2/U29VYTx9OjbDAd7jwRItJ0cSTMPRL/C8AWZFn9kWFLQGqEXVEE86w4Z8LpIQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@polkadot/api": { + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/@polkadot/api/-/api-6.12.1.tgz", + "integrity": "sha512-RVdTiA2WaEvproM3i6E9TKS1bfXpPd9Ly9lUG/kVLaspjKoIot9DJUDTl97TJ+7xr8LXGbXqm448Ud0hsEBV8Q==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/api-derive": "6.12.1", + "@polkadot/keyring": "^8.1.2", + "@polkadot/rpc-core": "6.12.1", + "@polkadot/rpc-provider": "6.12.1", + "@polkadot/types": "6.12.1", + "@polkadot/types-known": "6.12.1", + "@polkadot/util": "^8.1.2", + "@polkadot/util-crypto": "^8.1.2", + "eventemitter3": "^4.0.7", + "rxjs": "^7.4.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api-derive": { + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/@polkadot/api-derive/-/api-derive-6.12.1.tgz", + "integrity": "sha512-5LOVlG5EBCT+ytY6aHmQ4RdEWZovZQqRoc6DLd5BLhkR7BFTHKSkLQW+89so8jd0zEtmSXBVPPnsrXS8joM35Q==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/api": "6.12.1", + "@polkadot/rpc-core": "6.12.1", + "@polkadot/types": "6.12.1", + "@polkadot/util": "^8.1.2", + "@polkadot/util-crypto": "^8.1.2", + "rxjs": "^7.4.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api-derive/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api-derive/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api-derive/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api-derive/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/api-derive/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/api/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/api/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/api/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/keyring": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/keyring/-/keyring-8.7.1.tgz", + "integrity": "sha512-t6ZgQVC+nQT7XwbWtEhkDpiAzxKVJw8Xd/gWdww6xIrawHu7jo3SGB4QNdPgkf8TvDHYAAJiupzVQYAlOIq3GA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/util": "8.7.1", + "@polkadot/util-crypto": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@polkadot/util": "8.7.1", + "@polkadot/util-crypto": "8.7.1" + } + }, + "node_modules/@polkadot/keyring/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/keyring/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/keyring/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/keyring/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/keyring/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/networks": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/networks/-/networks-8.7.1.tgz", + "integrity": "sha512-8xAmhDW0ry5EKcEjp6VTuwoTm0DdDo/zHsmx88P6sVL87gupuFsL+B6TrsYLl8GcaqxujwrOlKB+CKTUg7qFKg==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/util": "8.7.1", + "@substrate/ss58-registry": "^1.17.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/networks/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/networks/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/networks/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/networks/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/networks/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/rpc-core": { + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-core/-/rpc-core-6.12.1.tgz", + "integrity": "sha512-Hb08D9zho3SB1UNlUCmG5q0gdgbOx25JKGLDfSYpD/wtD0Y1Sf2X5cfgtMoSYE3USWiRdCu4BxQkXTiRjPjzJg==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/rpc-provider": "6.12.1", + "@polkadot/types": "6.12.1", + "@polkadot/util": "^8.1.2", + "rxjs": "^7.4.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-core/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-core/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-core/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-core/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/rpc-core/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/rpc-provider": { + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/@polkadot/rpc-provider/-/rpc-provider-6.12.1.tgz", + "integrity": "sha512-uUHD3fLTOeZYWJoc6DQlhz+MJR33rVelasV+OxFY2nSD9MSNXRwQh+9UKDQBnyxw5B4BZ2QaEGfucDeavXmVDw==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/types": "6.12.1", + "@polkadot/util": "^8.1.2", + "@polkadot/util-crypto": "^8.1.2", + "@polkadot/x-fetch": "^8.1.2", + "@polkadot/x-global": "^8.1.2", + "@polkadot/x-ws": "^8.1.2", + "eventemitter3": "^4.0.7" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-provider/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-provider/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-provider/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/rpc-provider/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/rpc-provider/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/types": { + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/@polkadot/types/-/types-6.12.1.tgz", + "integrity": "sha512-O37cAGUL0xiXTuO3ySweVh0OuFUD6asrd0TfuzGsEp3jAISWdElEHV5QDiftWq8J9Vf8BMgTcP2QLFbmSusxqA==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/types-known": "6.12.1", + "@polkadot/util": "^8.1.2", + "@polkadot/util-crypto": "^8.1.2", + "rxjs": "^7.4.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types-known": { + "version": "6.12.1", + "resolved": "https://registry.npmjs.org/@polkadot/types-known/-/types-known-6.12.1.tgz", + "integrity": "sha512-Z8bHpPQy+mqUm0uR1tai6ra0bQIoPmgRcGFYUM+rJtW1kx/6kZLh10HAICjLpPeA1cwLRzaxHRDqH5MCU6OgXw==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/networks": "^8.1.2", + "@polkadot/types": "6.12.1", + "@polkadot/util": "^8.1.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types-known/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types-known/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types-known/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types-known/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/types-known/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/types/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/types/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/types/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/util": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-7.9.2.tgz", + "integrity": "sha512-6ABY6ErgkCsM4C6+X+AJSY4pBGwbKlHZmUtHftaiTvbaj4XuA4nTo3GU28jw8wY0Jh2cJZJvt6/BJ5GVkm5tBA==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-textdecoder": "7.9.2", + "@polkadot/x-textencoder": "7.9.2", + "@types/bn.js": "^4.11.6", + "bn.js": "^4.12.0", + "camelcase": "^6.2.1", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/util-crypto": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util-crypto/-/util-crypto-8.7.1.tgz", + "integrity": "sha512-TaSuJ2aNrB5sYK7YXszkEv24nYJKRFqjF2OrggoMg6uYxUAECvTkldFnhtgeizMweRMxJIBu6bMHlSIutbWgjw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@noble/hashes": "1.0.0", + "@noble/secp256k1": "1.5.5", + "@polkadot/networks": "8.7.1", + "@polkadot/util": "8.7.1", + "@polkadot/wasm-crypto": "^5.1.1", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-randomvalues": "8.7.1", + "@scure/base": "1.0.0", + "ed2curve": "^0.3.0", + "tweetnacl": "^1.0.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@polkadot/util": "8.7.1" + } + }, + "node_modules/@polkadot/util-crypto/node_modules/@polkadot/util": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/util/-/util-8.7.1.tgz", + "integrity": "sha512-XjY1bTo7V6OvOCe4yn8H2vifeuBciCy0gq0k5P1tlGUQLI/Yt0hvDmxcA0FEPtqg8CL+rYRG7WXGPVNjkrNvyQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-bigint": "8.7.1", + "@polkadot/x-global": "8.7.1", + "@polkadot/x-textdecoder": "8.7.1", + "@polkadot/x-textencoder": "8.7.1", + "@types/bn.js": "^5.1.0", + "bn.js": "^5.2.0", + "ip-regex": "^4.3.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/util-crypto/node_modules/@polkadot/x-textdecoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-8.7.1.tgz", + "integrity": "sha512-ia0Ie2zi4VdQdNVD2GE2FZzBMfX//hEL4w546RMJfZM2LqDS674LofHmcyrsv5zscLnnRyCxZC1+J2dt+6MDIA==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/util-crypto/node_modules/@polkadot/x-textencoder": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-8.7.1.tgz", + "integrity": "sha512-XDO0A27Xy+eJCKSxENroB8Dcnl+UclGG4ZBei+P/BqZ9rsjskUyd2Vsl6peMXAcsxwOE7g0uTvujoGM8jpKOXw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/util-crypto/node_modules/@types/bn.js": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", + "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@polkadot/util-crypto/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/@polkadot/wasm-crypto": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto/-/wasm-crypto-5.1.1.tgz", + "integrity": "sha512-JCcAVfH8DhYuEyd4oX1ouByxhou0TvpErKn8kHjtzt7+tRoFi0nzWlmK4z49vszsV3JJgXxV81i10C0BYlwTcQ==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/wasm-crypto-asmjs": "^5.1.1", + "@polkadot/wasm-crypto-wasm": "^5.1.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@polkadot/util": "*", + "@polkadot/x-randomvalues": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-asmjs": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-asmjs/-/wasm-crypto-asmjs-5.1.1.tgz", + "integrity": "sha512-1WBwc2G3pZMKW1T01uXzKE30Sg22MXmF3RbbZiWWk3H2d/Er4jZQRpjumxO5YGWan+xOb7HQQdwnrUnrPgbDhg==", + "dependencies": { + "@babel/runtime": "^7.17.8" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/wasm-crypto-wasm": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@polkadot/wasm-crypto-wasm/-/wasm-crypto-wasm-5.1.1.tgz", + "integrity": "sha512-F9PZ30J2S8vUNl2oY7Myow5Xsx5z5uNVpnNlJwlmY8IXBvyucvyQ4HSdhJsrbs4W1BfFc0mHghxgp0FbBCnf/Q==", + "dependencies": { + "@babel/runtime": "^7.17.8" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "@polkadot/util": "*" + } + }, + "node_modules/@polkadot/x-bigint": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-bigint/-/x-bigint-8.7.1.tgz", + "integrity": "sha512-ClkhgdB/KqcAKk3zA6Qw8wBL6Wz67pYTPkrAtImpvoPJmR+l4RARauv+MH34JXMUNlNb3aUwqN6lq2Z1zN+mJg==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-fetch": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-fetch/-/x-fetch-8.7.1.tgz", + "integrity": "sha512-ygNparcalYFGbspXtdtZOHvNXZBkNgmNO+um9C0JYq74K5OY9/be93uyfJKJ8JcRJtOqBfVDsJpbiRkuJ1PRfg==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1", + "@types/node-fetch": "^2.6.1", + "node-fetch": "^2.6.7" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-global": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-8.7.1.tgz", + "integrity": "sha512-WOgUor16IihgNVdiTVGAWksYLUAlqjmODmIK1cuWrLOZtV1VBomWcb3obkO9sh5P6iWziAvCB/i+L0vnTN9ZCA==", + "dependencies": { + "@babel/runtime": "^7.17.8" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-randomvalues": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-randomvalues/-/x-randomvalues-8.7.1.tgz", + "integrity": "sha512-njt17MlfN6yNyNEti7fL12lr5qM6A1aSGkWKVuqzc7XwSBesifJuW4km5u6r2gwhXjH2eHDv9SoQ7WXu8vrrkg==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-textdecoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textdecoder/-/x-textdecoder-7.9.2.tgz", + "integrity": "sha512-wfwbSHXPhrOAl12QvlIOGNkMH/N/h8PId2ytIjvM/8zPPFB5Il6DWSFLtVapOGEpIFjEWbd5t8Td4pHBVXIEbg==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-textdecoder/node_modules/@polkadot/x-global": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", + "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "dependencies": { + "@babel/runtime": "^7.16.3" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-textencoder": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-textencoder/-/x-textencoder-7.9.2.tgz", + "integrity": "sha512-A19wwYINuZwU2dUyQ/mMzB0ISjyfc4cISfL4zCMUAVgj7xVoXMYV2GfjNdMpA8Wsjch3su6pxLbtJ2wU03sRTQ==", + "dependencies": { + "@babel/runtime": "^7.16.3", + "@polkadot/x-global": "7.9.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-textencoder/node_modules/@polkadot/x-global": { + "version": "7.9.2", + "resolved": "https://registry.npmjs.org/@polkadot/x-global/-/x-global-7.9.2.tgz", + "integrity": "sha512-JX5CrGWckHf1P9xKXq4vQCAuMUbL81l2hOWX7xeP8nv4caHEpmf5T1wD1iMdQBL5PFifo6Pg0V6/oZBB+bts7A==", + "dependencies": { + "@babel/runtime": "^7.16.3" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@polkadot/x-ws": { + "version": "8.7.1", + "resolved": "https://registry.npmjs.org/@polkadot/x-ws/-/x-ws-8.7.1.tgz", + "integrity": "sha512-Mt0tcNzGXyKnN3DQ06alkv+JLtTfXWu6zSypFrrKHSQe3u79xMQ1nSicmpT3gWLhIa8YF+8CYJXMrqaXgCnDhw==", + "dependencies": { + "@babel/runtime": "^7.17.8", + "@polkadot/x-global": "8.7.1", + "@types/websocket": "^1.0.5", + "websocket": "^1.0.34" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@scure/base": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.0.0.tgz", + "integrity": "sha512-gIVaYhUsy+9s58m/ETjSJVKHhKTBMmcRb9cEV5/5dwvfDlfORjKrFsDeDHWRrm6RjcPvCLZFwGJjAjLj1gg4HA==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ] + }, + "node_modules/@substrate/ss58-registry": { + "version": "1.38.0", + "resolved": "https://registry.npmjs.org/@substrate/ss58-registry/-/ss58-registry-1.38.0.tgz", + "integrity": "sha512-sHiVRWekGMRZAjPukN9/W166NM6D5wtHcK6RVyLy66kg3CHNZ1BXfpXcjOiXSwhbd7guQFDEwnOVaDrbk1XL1g==" + }, + "node_modules/@types/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==" + }, + "node_modules/@types/node-fetch": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.2.tgz", + "integrity": "sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==", + "dependencies": { + "@types/node": "*", + "form-data": "^3.0.0" + } + }, + "node_modules/@types/websocket": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/websocket/-/websocket-1.0.5.tgz", + "integrity": "sha512-NbsqiNX9CnEfC1Z0Vf4mE1SgAJ07JnRYcNex7AJ9zAVzmiGHmjKFEk7O4TJIsgv2B1sLEb6owKFZrACwdYngsQ==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dependencies": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/ed2curve": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/ed2curve/-/ed2curve-0.3.0.tgz", + "integrity": "sha512-8w2fmmq3hv9rCrcI7g9hms2pMunQr1JINfcjwR9tAyZqhtyaMN991lF/ZfHfr5tzZQ8c7y7aBgZbjfbd0fjFwQ==", + "dependencies": { + "tweetnacl": "1.x.x" + } + }, + "node_modules/es5-ext": { + "version": "0.10.62", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.62.tgz", + "integrity": "sha512-BHLqn0klhEpnOKSrzn/Xsz2UIW8j+cGmo9JLzr8BiUapV8hPL9+FliFqjwr9ngW7jWdnxv6eO+/LqyhJVqgrjA==", + "hasInstallScript": true, + "dependencies": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/es6-iterator": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", + "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "dependencies": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, + "node_modules/ext": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", + "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", + "dependencies": { + "type": "^2.7.2" + } + }, + "node_modules/ext/node_modules/type": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/type/-/type-2.7.2.tgz", + "integrity": "sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==" + }, + "node_modules/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ip-regex": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-4.3.0.tgz", + "integrity": "sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==" + }, + "node_modules/node-fetch": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", + "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-gyp-build": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", + "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" + }, + "node_modules/rxjs": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.0.tgz", + "integrity": "sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/tslib": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", + "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" + }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "node_modules/type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/websocket": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz", + "integrity": "sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==", + "dependencies": { + "bufferutil": "^4.0.1", + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + "yaeti": "^0.0.6" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha512-MvQa//+KcZCUkBTIC9blM+CU9J2GzuTytsOUwf2lidtvkx/6gnEp1QvJv34t9vdjhFmha/mUiNDbN0D0mJWdug==", + "engines": { + "node": ">=0.10.32" + } + } + } +} diff --git a/scripts/generate_hex_encoded_call/package.json b/scripts/generate_hex_encoded_call/package.json new file mode 100644 index 00000000..1c68924d --- /dev/null +++ b/scripts/generate_hex_encoded_call/package.json @@ -0,0 +1,11 @@ +{ + "name": "y", + "version": "y", + "description": "create a scale hex-encoded call values from given message", + "main": "index.js", + "license": "MIT", + "dependencies": { + "@polkadot/api": "^6.5.2", + "@polkadot/util": "^7.6.1" + } +} diff --git a/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml b/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml new file mode 100644 index 00000000..e5a8459a --- /dev/null +++ b/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml @@ -0,0 +1,104 @@ +[settings] +node_spawn_timeout = 240 + +[relaychain] +default_command = "{{POLKADOT_BINARY_PATH}}" +default_args = [ "-lparachain=debug,xcm=trace" ] +chain = "rococo-local" + + [[relaychain.nodes]] + name = "alice-validator" + validator = true + rpc_port = 9932 + ws_port = 9942 + extra_args = ["--no-mdns --bootnodes {{'bob-validator'|zombie('multiAddress')}}"] + + [[relaychain.nodes]] + name = "bob-validator" + validator = true + rpc_port = 9933 + ws_port = 9943 + extra_args = ["--no-mdns --bootnodes {{'alice-validator'|zombie('multiAddress')}}"] + + [[relaychain.nodes]] + name = "charlie-validator" + validator = true + rpc_port = 9934 + ws_port = 9944 + extra_args = ["--no-mdns --bootnodes {{'alice-validator'|zombie('multiAddress')}}"] + +[[parachains]] +id = 1013 +chain = "bridge-hub-rococo-local" +cumulus_based = true + + # run alice as parachain collator + [[parachains.collators]] + name = "alice-collator" + validator = true + command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}" + rpc_port = 8933 + ws_port = 8943 + args = [ + "-lparachain=debug,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace", + ] + extra_args = [ + "--force-authoring", "--no-mdns", "--bootnodes {{'bob-collator'|zombie('multiAddress')}}", + "-- --port 41333 --rpc-port 48933 --ws-port 48943 --no-mdns", "--bootnodes {{'alice-validator'|zombie('multiAddress')}}" + ] + + # run bob as parachain collator + [[parachains.collators]] + name = "bob-collator" + validator = true + command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}" + rpc_port = 8934 + ws_port = 8944 + args = [ + "-lparachain=trace,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace", + ] + extra_args = [ + "--force-authoring", "--no-mdns", "--bootnodes {{'alice-collator'|zombie('multiAddress')}}", + "-- --port 41334 --rpc-port 48934 --ws-port 48944 --no-mdns", "--bootnodes {{'bob-validator'|zombie('multiAddress')}}" + ] + +[[parachains]] +id = 1000 +chain = "statemine-local" +cumulus_based = true + + [[parachains.collators]] + name = "rockmine-collator1" + rpc_port = 9911 + ws_port = 9910 + command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ROCKMINE}}" + args = [ + "-lparachain=debug,xcm=trace", + ] + extra_args = [ + "--no-mdns", "--bootnodes {{'rockmine-collator2'|zombie('multiAddress')}}", + "-- --port 51333 --rpc-port 58933 --ws-port 58943 --no-mdns", "--bootnodes {{'alice-validator'|zombie('multiAddress')}}" + ] + + [[parachains.collators]] + name = "rockmine-collator2" + command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_ROCKMINE}}" + args = [ + "-lparachain=debug,xcm=trace", + ] + extra_args = [ + "--no-mdns", "--bootnodes {{'rockmine-collator1'|zombie('multiAddress')}}", + "-- --port 51433 --rpc-port 58833 --ws-port 58843 --no-mdns", "--bootnodes {{'alice-validator'|zombie('multiAddress')}}" + ] + +[[hrmp_channels]] +sender = 1000 +recipient = 1013 +max_capacity = 4 +max_message_size = 524288 + +[[hrmp_channels]] +sender = 1013 +recipient = 1000 +max_capacity = 4 +max_message_size = 524288 diff --git a/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml b/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml new file mode 100644 index 00000000..55a95eb8 --- /dev/null +++ b/zombienet/bridge-hubs/bridge_hub_wococo_local_network.toml @@ -0,0 +1,104 @@ +[settings] +node_spawn_timeout = 240 + +[relaychain] +default_command = "{{POLKADOT_BINARY_PATH}}" +default_args = [ "-lparachain=debug,xcm=trace" ] +chain = "wococo-local" + + [[relaychain.nodes]] + name = "alice-validator-wo" + validator = true + rpc_port = 9935 + ws_port = 9945 + extra_args = ["--no-mdns --bootnodes {{'bob-validator-wo'|zombie('multiAddress')}}"] + + [[relaychain.nodes]] + name = "bob-validator-wo" + validator = true + rpc_port = 9936 + ws_port = 9946 + extra_args = ["--no-mdns --bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}"] + + [[relaychain.nodes]] + name = "charlie-validator-wo" + validator = true + rpc_port = 9937 + ws_port = 9947 + extra_args = ["--no-mdns --bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}"] + +[[parachains]] +id = 1014 +chain = "bridge-hub-wococo-local" +cumulus_based = true + + # run alice as parachain collator + [[parachains.collators]] + name = "alice-collator-wo" + validator = true + command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}" + rpc_port = 8935 + ws_port = 8945 + args = [ + "-lparachain=debug,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace", + ] + extra_args = [ + "--force-authoring", "--no-mdns", "--bootnodes {{'bob-collator-wo'|zombie('multiAddress')}}", + "-- --port 41335 --rpc-port 48935 --ws-port 48945 --no-mdns", "--bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}" + ] + + # run bob as parachain collator + [[parachains.collators]] + name = "bob-collator-wo" + validator = true + command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}" + rpc_port = 8936 + ws_port = 8946 + args = [ + "-lparachain=trace,runtime::mmr=info,substrate=info,runtime=info,runtime::bridge-hub=trace,runtime::bridge=trace,runtime::bridge-dispatch=trace,bridge=trace,runtime::bridge-messages=trace,xcm=trace", + ] + extra_args = [ + "--force-authoring", "--no-mdns", "--bootnodes {{'alice-collator-wo'|zombie('multiAddress')}}", + "-- --port 41336 --rpc-port 48936 --ws-port 48946 --no-mdns", "--bootnodes {{'bob-validator-wo'|zombie('multiAddress')}}" + ] + +[[parachains]] +id = 1000 +chain = "westmint-local" +cumulus_based = true + + [[parachains.collators]] + name = "wockmint-collator1" + rpc_port = 9011 + ws_port = 9010 + command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_WOCKMINT}}" + args = [ + "-lparachain=debug,xcm=trace", + ] + extra_args = [ + "--no-mdns", "--bootnodes {{'wockmint-collator2'|zombie('multiAddress')}}", + "-- --port 31333 --rpc-port 38933 --ws-port 38943 --no-mdns", "--bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}" + ] + + [[parachains.collators]] + name = "wockmint-collator2" + command = "{{POLKADOT_PARACHAIN_BINARY_PATH_FOR_WOCKMINT}}" + args = [ + "-lparachain=debug,xcm=trace", + ] + extra_args = [ + "--no-mdns", "--bootnodes {{'wockmint-collator1'|zombie('multiAddress')}}", + "-- --port 31433 --rpc-port 38833 --ws-port 38843 --no-mdns", "--bootnodes {{'alice-validator-wo'|zombie('multiAddress')}}" + ] + +[[hrmp_channels]] +sender = 1000 +recipient = 1014 +max_capacity = 4 +max_message_size = 524288 + +[[hrmp_channels]] +sender = 1014 +recipient = 1000 +max_capacity = 4 +max_message_size = 524288