From 6f28e704d1029688670db8acfd4a13c50acfe862 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 24 Apr 2023 11:16:06 +0200 Subject: [PATCH 01/60] folder restructutre --- Cargo.lock | 50 +++ Cargo.toml | 3 +- .../assets/statemine/0_xcm}/0_init.yml | 0 .../assets/statemine/0_xcm}/1_dmp.yml | 0 .../assets/statemine/0_xcm}/2_ump.yml | 0 .../statemine/0_xcm}/3_hrmp-open-channels.yml | 0 .../assets/statemine/0_xcm}/4_hrmp.yml | 0 .../{ => e2e/assets}/statemine/config.toml | 0 .../assets/statemint/0_xcm}/0_init.yml | 0 .../assets/statemint/0_xcm}/1_dmp.yml | 0 .../assets/statemint/0_xcm}/2_ump.yml | 0 .../statemint/0_xcm}/3_hrmp-open-channels.yml | 0 .../assets/statemint/0_xcm}/4_hrmp.yml | 0 .../{ => e2e/assets}/statemint/config.toml | 0 .../collectives_polkadot}/0_xcm/0_init.yml | 0 .../0_xcm/1_teleport.yml | 0 .../collectives_polkadot}/0_xcm/2_reserve.yml | 0 .../1_alliance/0_join_alliance_fails.yml | 0 .../1_alliance/1_init_alliance.yml | 0 .../1_alliance/2_join_alliance_fails.yml | 0 .../1_alliance/3_kick_member.yml | 0 .../collectives_polkadot}/config.toml | 0 .../xcm-emulator/assets/common.rs | 0 .../xcm-emulator/assets/statemine/Cargo.toml | 35 ++ .../xcm-emulator/assets/statemine/src/lib.rs | 2 + .../assets/statemine/tests/statemine.rs | 372 ++++++++++++++++++ .../xcm-emulator/assets/statemint/Cargo.toml | 35 ++ .../xcm-emulator/assets/statemint/src/lib.rs | 2 + .../assets/statemint/tests/statemint.rs | 372 ++++++++++++++++++ .../integration-tests/xcm-emulator/common.rs | 0 30 files changed, 870 insertions(+), 1 deletion(-) rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemine/0_xcm}/0_init.yml (100%) rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemine/0_xcm}/1_dmp.yml (100%) rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemine/0_xcm}/2_ump.yml (100%) rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemine/0_xcm}/3_hrmp-open-channels.yml (100%) rename parachains/integration-tests/{statemine/xcm => e2e/assets/statemine/0_xcm}/4_hrmp.yml (100%) rename parachains/integration-tests/{ => e2e/assets}/statemine/config.toml (100%) rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemint/0_xcm}/0_init.yml (100%) rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemint/0_xcm}/1_dmp.yml (100%) rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemint/0_xcm}/2_ump.yml (100%) rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemint/0_xcm}/3_hrmp-open-channels.yml (100%) rename parachains/integration-tests/{statemint/xcm => e2e/assets/statemint/0_xcm}/4_hrmp.yml (100%) rename parachains/integration-tests/{ => e2e/assets}/statemint/config.toml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/0_xcm/0_init.yml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/0_xcm/1_teleport.yml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/0_xcm/2_reserve.yml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/1_alliance/0_join_alliance_fails.yml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/1_alliance/1_init_alliance.yml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/1_alliance/2_join_alliance_fails.yml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/1_alliance/3_kick_member.yml (100%) rename parachains/integration-tests/{collectives => e2e/collectives/collectives_polkadot}/config.toml (100%) create mode 100644 parachains/integration-tests/xcm-emulator/assets/common.rs create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs create mode 100644 parachains/integration-tests/xcm-emulator/common.rs diff --git a/Cargo.lock b/Cargo.lock index 8a964b459af..1babecad7e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12670,6 +12670,31 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "statemine-it" +version = "1.0.0" +dependencies = [ + "frame-support", + "frame-system", + "kusama-runtime", + "pallet-assets", + "pallet-balances", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "statemine-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "statemine-runtime" version = "2.0.0" @@ -12740,6 +12765,31 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "statemint-it" +version = "1.0.0" +dependencies = [ + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "statemint-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "statemint-runtime" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index 1bc3fc0d236..8b0bd5596cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,8 @@ members = [ "parachains/runtimes/collectives/collectives-polkadot", "parachains/runtimes/contracts/contracts-rococo", "parachains/runtimes/testing/penpal", + "parachains/integration-tests/xcm-emulator/assets/statemine", + "parachains/integration-tests/xcm-emulator/assets/statemint", "test/client", "test/relay-sproof-builder", "test/relay-validation-worker-provider", @@ -63,4 +65,3 @@ opt-level = 3 inherits = "release" lto = true codegen-units = 1 - diff --git a/parachains/integration-tests/statemine/xcm/0_init.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/0_init.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/0_init.yml diff --git a/parachains/integration-tests/statemine/xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/1_dmp.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/1_dmp.yml diff --git a/parachains/integration-tests/statemine/xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/2_ump.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/2_ump.yml diff --git a/parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/3_hrmp-open-channels.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/3_hrmp-open-channels.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/3_hrmp-open-channels.yml diff --git a/parachains/integration-tests/statemine/xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml similarity index 100% rename from parachains/integration-tests/statemine/xcm/4_hrmp.yml rename to parachains/integration-tests/e2e/assets/statemine/0_xcm/4_hrmp.yml diff --git a/parachains/integration-tests/statemine/config.toml b/parachains/integration-tests/e2e/assets/statemine/config.toml similarity index 100% rename from parachains/integration-tests/statemine/config.toml rename to parachains/integration-tests/e2e/assets/statemine/config.toml diff --git a/parachains/integration-tests/statemint/xcm/0_init.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/0_init.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/0_init.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/0_init.yml diff --git a/parachains/integration-tests/statemint/xcm/1_dmp.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/1_dmp.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/1_dmp.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/1_dmp.yml diff --git a/parachains/integration-tests/statemint/xcm/2_ump.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/2_ump.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/2_ump.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/2_ump.yml diff --git a/parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/3_hrmp-open-channels.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/3_hrmp-open-channels.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/3_hrmp-open-channels.yml diff --git a/parachains/integration-tests/statemint/xcm/4_hrmp.yml b/parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml similarity index 100% rename from parachains/integration-tests/statemint/xcm/4_hrmp.yml rename to parachains/integration-tests/e2e/assets/statemint/0_xcm/4_hrmp.yml diff --git a/parachains/integration-tests/statemint/config.toml b/parachains/integration-tests/e2e/assets/statemint/config.toml similarity index 100% rename from parachains/integration-tests/statemint/config.toml rename to parachains/integration-tests/e2e/assets/statemint/config.toml diff --git a/parachains/integration-tests/collectives/0_xcm/0_init.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/0_init.yml similarity index 100% rename from parachains/integration-tests/collectives/0_xcm/0_init.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/0_init.yml diff --git a/parachains/integration-tests/collectives/0_xcm/1_teleport.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/1_teleport.yml similarity index 100% rename from parachains/integration-tests/collectives/0_xcm/1_teleport.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/1_teleport.yml diff --git a/parachains/integration-tests/collectives/0_xcm/2_reserve.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/2_reserve.yml similarity index 100% rename from parachains/integration-tests/collectives/0_xcm/2_reserve.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/0_xcm/2_reserve.yml diff --git a/parachains/integration-tests/collectives/1_alliance/0_join_alliance_fails.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/0_join_alliance_fails.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/0_join_alliance_fails.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/0_join_alliance_fails.yml diff --git a/parachains/integration-tests/collectives/1_alliance/1_init_alliance.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/1_init_alliance.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/1_init_alliance.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/1_init_alliance.yml diff --git a/parachains/integration-tests/collectives/1_alliance/2_join_alliance_fails.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/2_join_alliance_fails.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/2_join_alliance_fails.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/2_join_alliance_fails.yml diff --git a/parachains/integration-tests/collectives/1_alliance/3_kick_member.yml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/3_kick_member.yml similarity index 100% rename from parachains/integration-tests/collectives/1_alliance/3_kick_member.yml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/1_alliance/3_kick_member.yml diff --git a/parachains/integration-tests/collectives/config.toml b/parachains/integration-tests/e2e/collectives/collectives_polkadot/config.toml similarity index 100% rename from parachains/integration-tests/collectives/config.toml rename to parachains/integration-tests/e2e/collectives/collectives_polkadot/config.toml diff --git a/parachains/integration-tests/xcm-emulator/assets/common.rs b/parachains/integration-tests/xcm-emulator/assets/common.rs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml b/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml new file mode 100644 index 00000000000..0f30cdf245e --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "statemine-it" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Statemine parachain runtime integration tests with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + +# Polkadot +polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } +kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } + +# Cumulus +parachains-common = { path = "../../../../common" } +penpal-runtime = { path = "../../../../runtimes/testing/penpal" } +statemine-runtime = { path = "../../../../runtimes/assets/statemine" } + +# Local +xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs new file mode 100644 index 00000000000..5c6016f6a14 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs @@ -0,0 +1,2 @@ +#[cfg(test)] +mod tests {} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs b/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs new file mode 100644 index 00000000000..62831c417e5 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs @@ -0,0 +1,372 @@ +use frame_support::{ + assert_ok, + instances::Instance1, + pallet_prelude::Hooks, + sp_io, sp_tracing, + traits::{fungibles::Inspect, GenesisBuild}, +}; + +use codec::Encode; +use polkadot_runtime_parachains::configuration::HostConfiguration; +use sp_core::parameter_types; +use statemine_runtime::constants::currency::GRAND; +use xcm::prelude::*; +use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; + +use xcm_executor::traits::Convert; + +use parachains_common::Balance; +use polkadot_core_primitives::InboundDownwardMessage; +use polkadot_parachain::primitives::DmpMessageHandler; +use sp_weights::Weight; +use xcm::{ + latest::{Ancestor, MultiLocation}, + prelude::{AccountId32, Here, Parachain}, + v3::Outcome, + VersionedMultiAssets, +}; + +pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); +pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); +pub const INITIAL_BALANCE: u128 = 1000 * GRAND; + +decl_test_parachain! { + pub struct Statemine { + Runtime = statemine_runtime::Runtime, + RuntimeOrigin = statemine_runtime::RuntimeOrigin, + XcmpMessageHandler = statemine_runtime::XcmpQueue, + DmpMessageHandler = statemine_runtime::DmpQueue, + new_ext = statemine_ext(), + } +} + +decl_test_parachain! { + pub struct Penpal { + Runtime = penpal_runtime::Runtime, + RuntimeOrigin = penpal_runtime::RuntimeOrigin, + XcmpMessageHandler = penpal_runtime::XcmpQueue, + DmpMessageHandler = penpal_runtime::DmpQueue, + new_ext = penpal_ext(), + } +} + +decl_test_relay_chain! { + pub struct Relay { + Runtime = kusama_runtime::Runtime, + XcmConfig = kusama_runtime::xcm_config::XcmConfig, + new_ext = relay_ext(), + } +} + +decl_test_network! { + pub struct MockNet { + relay_chain = Relay, + parachains = vec![ + (1000, Statemine), + (2000, Penpal), + ], + } +} + +// Define Statemine TestExternalities. +pub fn statemine_ext() -> sp_io::TestExternalities { + use statemine_runtime::{Runtime, System}; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + System::set_block_number(1); + }); + ext +} + +// Define Penpal TestExternalities. +pub fn penpal_ext() -> sp_io::TestExternalities { + use penpal_runtime::{Runtime, System}; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + System::set_block_number(1); + }); + ext +} + +// Define Kusama TestExternalities. +pub fn relay_ext() -> sp_io::TestExternalities { + use kusama_runtime::{Runtime, RuntimeOrigin, System}; + + // ::XcmSender = RelayChainXcmRouter; + // ::XcmRouter = RelayChainXcmRouter; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + polkadot_runtime_parachains::configuration::GenesisConfig:: { + config: HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + ..Default::default() + }, + } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![ + (ALICE, INITIAL_BALANCE), + (child_account_id(1000), INITIAL_BALANCE), + (child_account_id(2000), INITIAL_BALANCE), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + System::set_block_number(1); + }); + ext +} + +pub fn parent_account_id() -> parachains_common::AccountId { + let location = (Parent,); + statemine_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() +} + +pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { + let location = (Parachain(para),); + kusama_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() +} + +pub type RelayChainPalletXcm = pallet_xcm::Pallet; +pub type StateminePalletXcm = pallet_xcm::Pallet; +pub type PenpalPalletXcm = pallet_xcm::Pallet; + +parameter_types! { + pub StatemineLocation: MultiLocation = (Ancestor(0), Parachain(1000)).into(); +} + +#[test] +// NOTE: This needs to be run before every other test to ensure that chains can communicate with one +// another. +fn force_xcm_version() { + let xcm_version = 3; + Relay::execute_with(|| { + use kusama_runtime::{RuntimeEvent, System}; + + let statemine_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); + let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); + + // Check that we can force xcm version for Statemine and Penpal from Kusama. + for location in [statemine_location, penpal_location] { + assert_ok!(RelayChainPalletXcm::force_xcm_version( + kusama_runtime::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + } + }); + + // Penpal forces Kusama xcm version. + Penpal::execute_with(|| { + use penpal_runtime::{RuntimeEvent, System}; + + let location: MultiLocation = (Parent).into(); + + assert_ok!(PenpalPalletXcm::force_xcm_version( + penpal_runtime::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + }); +} + +// Direct message passing tests. +mod dmp { + use super::*; + use xcm::latest::Error; + use xcm_emulator::cumulus_pallet_dmp_queue; + + fn get_balances() -> (Balance, Balance) { + let mut relay_balance = Default::default(); + Relay::execute_with(|| { + relay_balance = + kusama_runtime::System::account::(ALICE.into()) + .data + .free; + }); + let mut assets_para_balance = Default::default(); + + Statemine::execute_with(|| { + assets_para_balance = + statemine_runtime::System::account::(ALICE.into()) + .data + .free; + }); + + (relay_balance, assets_para_balance) + } + + fn get_benf() -> Junction { + AccountId32 { network: None, id: ALICE.into() } + } + + const AP_DEST: (Ancestor, Junction) = (Ancestor(0), Parachain(1000)); + + #[test] + fn teleport_native_assets_relay_to_assets_para() { + force_xcm_version(); + let amount = 1000_000_000; + let assets: VersionedMultiAssets = (Here, amount).into(); + + let mut messages: Vec = Vec::new(); + + let (relay_balance, ap_balance) = get_balances(); + + Relay::execute_with(|| { + use kusama_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + assert_ok!(RelayChainPalletXcm::limited_teleport_assets( + RuntimeOrigin::signed(ALICE.into()), + Box::new(AP_DEST.into()), + Box::new(get_benf().into()), + Box::new(assets), + 0, + WeightLimit::Unlimited, + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) + ))); + }); + + Statemine::execute_with(|| { + use statemine_runtime::{Runtime, RuntimeEvent, System}; + assert!(System::events().iter().any(|r| matches!( + &r.event, + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) + if *who == ALICE.into() + ))); + }); + + let (relay_balance_after, ap_balance_after) = get_balances(); + assert_eq!(relay_balance - amount, relay_balance_after); + assert!(ap_balance_after > ap_balance); + } + + #[test] + fn transact_sudo_relay_to_assets_para_works() { + force_xcm_version(); + + Relay::execute_with(|| { + use kusama_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + let call = statemine_runtime::RuntimeCall::Assets(pallet_assets::Call::< + statemine_runtime::Runtime, + Instance1, + >::force_create { + id: 1.into(), + is_sufficient: true, + min_balance: 1000, + owner: ALICE.into(), + }); + let xcm = Xcm(vec![ + UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, + Transact { + require_weight_at_most: Weight::from_parts(1000000000, 200000), + origin_kind: OriginKind::Superuser, + call: call.encode().into(), + }, + ]); + assert_ok!(RelayChainPalletXcm::send( + RuntimeOrigin::root(), + Box::new(AP_DEST.into()), + Box::new(VersionedXcm::from(xcm)), + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) + ))); + }); + + Statemine::execute_with(|| { + assert!(statemine_runtime::Assets::asset_exists(1)); + }); + } + + #[test] + fn reserved_transfer_native_relay_to_assets_para_fails() { + force_xcm_version(); + let (relay_balance, ap_balance) = get_balances(); + let amount = 1000_000_000; + let assets: VersionedMultiAssets = (Here, amount).into(); + + Relay::execute_with(|| { + use kusama_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( + RuntimeOrigin::signed(ALICE.into()), + Box::new(AP_DEST.into()), + Box::new(get_benf().into()), + Box::new(assets), + 0, + WeightLimit::Unlimited, + )); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) + ))); + }); + + Statemine::execute_with(|| { + use statemine_runtime::{RuntimeEvent, System}; + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { + outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), + .. + }) + ))); + }); + + let (relay_balance_after, ap_balance_after) = get_balances(); + assert_eq!(relay_balance - amount, relay_balance_after); + assert_eq!(ap_balance_after, ap_balance); + } +} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml b/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml new file mode 100644 index 00000000000..df2d2deb5f6 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "statemint-it" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Statemint parachain runtime integration tests with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + +# Polkadot +polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } + +# Cumulus +parachains-common = { path = "../../../../common" } +penpal-runtime = { path = "../../../../runtimes/testing/penpal" } +statemint-runtime = { path = "../../../../runtimes/assets/statemint" } + +# Local +xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs new file mode 100644 index 00000000000..5c6016f6a14 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -0,0 +1,2 @@ +#[cfg(test)] +mod tests {} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs new file mode 100644 index 00000000000..5672b49974c --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs @@ -0,0 +1,372 @@ +use frame_support::{ + assert_ok, + instances::Instance1, + pallet_prelude::Hooks, + sp_io, sp_tracing, + traits::{fungibles::Inspect, GenesisBuild}, +}; + +use codec::Encode; +use polkadot_runtime_parachains::configuration::HostConfiguration; +use sp_core::parameter_types; +use statemint_runtime::constants::currency::DOLLARS; +use xcm::prelude::*; +use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; + +use xcm_executor::traits::Convert; + +use parachains_common::Balance; +use polkadot_core_primitives::InboundDownwardMessage; +use polkadot_parachain::primitives::DmpMessageHandler; +use sp_weights::Weight; +use xcm::{ + latest::{Ancestor, MultiLocation}, + prelude::{AccountId32, Here, Parachain}, + v3::Outcome, + VersionedMultiAssets, +}; + +pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); +pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); +pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; + +decl_test_parachain! { + pub struct Statemint { + Runtime = statemint_runtime::Runtime, + RuntimeOrigin = statemint_runtime::RuntimeOrigin, + XcmpMessageHandler = statemint_runtime::XcmpQueue, + DmpMessageHandler = statemint_runtime::DmpQueue, + new_ext = statemint_ext(), + } +} + +decl_test_parachain! { + pub struct Penpal { + Runtime = penpal_runtime::Runtime, + RuntimeOrigin = penpal_runtime::RuntimeOrigin, + XcmpMessageHandler = penpal_runtime::XcmpQueue, + DmpMessageHandler = penpal_runtime::DmpQueue, + new_ext = penpal_ext(), + } +} + +decl_test_relay_chain! { + pub struct Relay { + Runtime = polkadot_runtime::Runtime, + XcmConfig = polkadot_runtime::xcm_config::XcmConfig, + new_ext = relay_ext(), + } +} + +decl_test_network! { + pub struct MockNet { + relay_chain = Relay, + parachains = vec![ + (1000, Statemint), + (2000, Penpal), + ], + } +} + +// Define Statemint TestExternalities. +pub fn statemint_ext() -> sp_io::TestExternalities { + use statemint_runtime::{Runtime, System}; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + System::set_block_number(1); + }); + ext +} + +// Define Penpal TestExternalities. +pub fn penpal_ext() -> sp_io::TestExternalities { + use penpal_runtime::{Runtime, System}; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + System::set_block_number(1); + }); + ext +} + +// Define Polkadot TestExternalities. +pub fn relay_ext() -> sp_io::TestExternalities { + use polkadot_runtime::{Runtime, RuntimeOrigin, System}; + + // ::XcmSender = RelayChainXcmRouter; + // ::XcmRouter = RelayChainXcmRouter; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + polkadot_runtime_parachains::configuration::GenesisConfig:: { + config: HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + ..Default::default() + }, + } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![ + (ALICE, INITIAL_BALANCE), + (child_account_id(1000), INITIAL_BALANCE), + (child_account_id(2000), INITIAL_BALANCE), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + System::set_block_number(1); + }); + ext +} + +pub fn parent_account_id() -> parachains_common::AccountId { + let location = (Parent,); + statemint_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() +} + +pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { + let location = (Parachain(para),); + polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() +} + +pub type RelayChainPalletXcm = pallet_xcm::Pallet; +pub type StatemintPalletXcm = pallet_xcm::Pallet; +pub type PenpalPalletXcm = pallet_xcm::Pallet; + +parameter_types! { + pub StatemintLocation: MultiLocation = (Ancestor(0), Parachain(1000)).into(); +} + +#[test] +// NOTE: This needs to be run before every other test to ensure that chains can communicate with one +// another. +fn force_xcm_version() { + let xcm_version = 3; + Relay::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, System}; + + let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); + let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); + + // Check that we can force xcm version for Statemint and Penpal from Polkadot. + for location in [statemint_location, penpal_location] { + assert_ok!(RelayChainPalletXcm::force_xcm_version( + polkadot_runtime::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + } + }); + + // Penpal forces Polkadot xcm version. + Penpal::execute_with(|| { + use penpal_runtime::{RuntimeEvent, System}; + + let location: MultiLocation = (Parent).into(); + + assert_ok!(PenpalPalletXcm::force_xcm_version( + penpal_runtime::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + }); +} + +// Direct message passing tests. +mod dmp { + use super::*; + use xcm::latest::Error; + use xcm_emulator::cumulus_pallet_dmp_queue; + + fn get_balances() -> (Balance, Balance) { + let mut relay_balance = Default::default(); + Relay::execute_with(|| { + relay_balance = + polkadot_runtime::System::account::(ALICE.into()) + .data + .free; + }); + let mut assets_para_balance = Default::default(); + + Statemint::execute_with(|| { + assets_para_balance = + statemint_runtime::System::account::(ALICE.into()) + .data + .free; + }); + + (relay_balance, assets_para_balance) + } + + fn get_benf() -> Junction { + AccountId32 { network: None, id: ALICE.into() } + } + + const AP_DEST: (Ancestor, Junction) = (Ancestor(0), Parachain(1000)); + + #[test] + fn teleport_native_assets_relay_to_assets_para() { + force_xcm_version(); + let amount = 1000_000_000; + let assets: VersionedMultiAssets = (Here, amount).into(); + + let mut messages: Vec = Vec::new(); + + let (relay_balance, ap_balance) = get_balances(); + + Relay::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + assert_ok!(RelayChainPalletXcm::limited_teleport_assets( + RuntimeOrigin::signed(ALICE.into()), + Box::new(AP_DEST.into()), + Box::new(get_benf().into()), + Box::new(assets), + 0, + WeightLimit::Unlimited, + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) + ))); + }); + + Statemint::execute_with(|| { + use statemint_runtime::{Runtime, RuntimeEvent, System}; + assert!(System::events().iter().any(|r| matches!( + &r.event, + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) + if *who == ALICE.into() + ))); + }); + + let (relay_balance_after, ap_balance_after) = get_balances(); + assert_eq!(relay_balance - amount, relay_balance_after); + assert!(ap_balance_after > ap_balance); + } + + #[test] + fn transact_sudo_relay_to_assets_para_works() { + force_xcm_version(); + + Relay::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< + statemint_runtime::Runtime, + Instance1, + >::force_create { + id: 1.into(), + is_sufficient: true, + min_balance: 1000, + owner: ALICE.into(), + }); + let xcm = Xcm(vec![ + UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, + Transact { + require_weight_at_most: Weight::from_parts(1000000000, 200000), + origin_kind: OriginKind::Superuser, + call: call.encode().into(), + }, + ]); + assert_ok!(RelayChainPalletXcm::send( + RuntimeOrigin::root(), + Box::new(AP_DEST.into()), + Box::new(VersionedXcm::from(xcm)), + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) + ))); + }); + + Statemint::execute_with(|| { + assert!(statemint_runtime::Assets::asset_exists(1)); + }); + } + + #[test] + fn reserved_transfer_native_relay_to_assets_para_fails() { + force_xcm_version(); + let (relay_balance, ap_balance) = get_balances(); + let amount = 1000_000_000; + let assets: VersionedMultiAssets = (Here, amount).into(); + + Relay::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( + RuntimeOrigin::signed(ALICE.into()), + Box::new(AP_DEST.into()), + Box::new(get_benf().into()), + Box::new(assets), + 0, + WeightLimit::Unlimited, + )); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) + ))); + }); + + Statemint::execute_with(|| { + use statemint_runtime::{RuntimeEvent, System}; + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { + outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), + .. + }) + ))); + }); + + let (relay_balance_after, ap_balance_after) = get_balances(); + assert_eq!(relay_balance - amount, relay_balance_after); + assert_eq!(ap_balance_after, ap_balance); + } +} diff --git a/parachains/integration-tests/xcm-emulator/common.rs b/parachains/integration-tests/xcm-emulator/common.rs new file mode 100644 index 00000000000..e69de29bb2d From 721a12f8d4fcd1ef1a0a15034b566aa4e0559e2e Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 24 Apr 2023 13:22:04 +0200 Subject: [PATCH 02/60] common created --- Cargo.lock | 27 ++ Cargo.toml | 1 + .../xcm-emulator/assets/common.rs | 0 .../xcm-emulator/assets/statemine/Cargo.toml | 1 + .../xcm-emulator/assets/statemint/Cargo.toml | 1 + .../assets/statemint/tests/statemint.rs | 268 +++++++++--------- .../integration-tests/xcm-emulator/common.rs | 0 .../xcm-emulator/common/Cargo.toml | 35 +++ .../xcm-emulator/common/src/constants.rs | 85 ++++++ .../xcm-emulator/common/src/lib.rs | 141 +++++++++ 10 files changed, 426 insertions(+), 133 deletions(-) delete mode 100644 parachains/integration-tests/xcm-emulator/assets/common.rs delete mode 100644 parachains/integration-tests/xcm-emulator/common.rs create mode 100644 parachains/integration-tests/xcm-emulator/common/Cargo.toml create mode 100644 parachains/integration-tests/xcm-emulator/common/src/constants.rs create mode 100644 parachains/integration-tests/xcm-emulator/common/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 1babecad7e7..04834479983 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4364,6 +4364,31 @@ dependencies = [ "num-traits", ] +[[package]] +name = "integration-tests-common" +version = "1.0.0" +dependencies = [ + "frame-support", + "frame-system", + "pallet-assets", + "pallet-balances", + "pallet-xcm", + "parachains-common", + "parity-scale-codec", + "penpal-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime", + "polkadot-runtime-parachains", + "sp-core", + "sp-runtime", + "sp-weights", + "statemint-runtime", + "xcm", + "xcm-emulator", + "xcm-executor", +] + [[package]] name = "interceptor" version = "0.8.2" @@ -12676,6 +12701,7 @@ version = "1.0.0" dependencies = [ "frame-support", "frame-system", + "integration-tests-common", "kusama-runtime", "pallet-assets", "pallet-balances", @@ -12771,6 +12797,7 @@ version = "1.0.0" dependencies = [ "frame-support", "frame-system", + "integration-tests-common", "pallet-assets", "pallet-balances", "pallet-xcm", diff --git a/Cargo.toml b/Cargo.toml index 8b0bd5596cb..51705186116 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,7 @@ members = [ "parachains/runtimes/collectives/collectives-polkadot", "parachains/runtimes/contracts/contracts-rococo", "parachains/runtimes/testing/penpal", + "parachains/integration-tests/xcm-emulator/common", "parachains/integration-tests/xcm-emulator/assets/statemine", "parachains/integration-tests/xcm-emulator/assets/statemint", "test/client", diff --git a/parachains/integration-tests/xcm-emulator/assets/common.rs b/parachains/integration-tests/xcm-emulator/assets/common.rs deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml b/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml index 0f30cdf245e..1cb25d869a3 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml +++ b/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml @@ -33,3 +33,4 @@ statemine-runtime = { path = "../../../../runtimes/assets/statemine" } # Local xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } +integration-tests-common = { default-features = false, path = "../../common" } diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml b/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml index df2d2deb5f6..8c6077b67e4 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml @@ -33,3 +33,4 @@ statemint-runtime = { path = "../../../../runtimes/assets/statemint" } # Local xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } +integration-tests-common = { default-features = false, path = "../../common" } diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs index 5672b49974c..4e2eb13882a 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs @@ -26,136 +26,138 @@ use xcm::{ VersionedMultiAssets, }; -pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); -pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); -pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; - -decl_test_parachain! { - pub struct Statemint { - Runtime = statemint_runtime::Runtime, - RuntimeOrigin = statemint_runtime::RuntimeOrigin, - XcmpMessageHandler = statemint_runtime::XcmpQueue, - DmpMessageHandler = statemint_runtime::DmpQueue, - new_ext = statemint_ext(), - } -} - -decl_test_parachain! { - pub struct Penpal { - Runtime = penpal_runtime::Runtime, - RuntimeOrigin = penpal_runtime::RuntimeOrigin, - XcmpMessageHandler = penpal_runtime::XcmpQueue, - DmpMessageHandler = penpal_runtime::DmpQueue, - new_ext = penpal_ext(), - } -} - -decl_test_relay_chain! { - pub struct Relay { - Runtime = polkadot_runtime::Runtime, - XcmConfig = polkadot_runtime::xcm_config::XcmConfig, - new_ext = relay_ext(), - } -} - -decl_test_network! { - pub struct MockNet { - relay_chain = Relay, - parachains = vec![ - (1000, Statemint), - (2000, Penpal), - ], - } -} - -// Define Statemint TestExternalities. -pub fn statemint_ext() -> sp_io::TestExternalities { - use statemint_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - sp_tracing::try_init_simple(); - System::set_block_number(1); - }); - ext -} +use integration_tests_common::{PolkadotMockNet, Polkadot, Statemint, Penpal, constants::accounts::{ALICE, BOB}}; -// Define Penpal TestExternalities. -pub fn penpal_ext() -> sp_io::TestExternalities { - use penpal_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - sp_tracing::try_init_simple(); - System::set_block_number(1); - }); - ext -} - -// Define Polkadot TestExternalities. -pub fn relay_ext() -> sp_io::TestExternalities { - use polkadot_runtime::{Runtime, RuntimeOrigin, System}; - - // ::XcmSender = RelayChainXcmRouter; - // ::XcmRouter = RelayChainXcmRouter; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: HostConfiguration { - max_upward_queue_count: 10, - max_upward_queue_size: 51200, - max_upward_message_size: 51200, - max_upward_message_num_per_candidate: 10, - max_downward_message_size: 51200, - ..Default::default() - }, - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![ - (ALICE, INITIAL_BALANCE), - (child_account_id(1000), INITIAL_BALANCE), - (child_account_id(2000), INITIAL_BALANCE), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - System::set_block_number(1); - }); - ext -} - -pub fn parent_account_id() -> parachains_common::AccountId { - let location = (Parent,); - statemint_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() -} +// pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); +// pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); +pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; -pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { - let location = (Parachain(para),); - polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() -} +// decl_test_parachain! { +// pub struct Statemint { +// Runtime = statemint_runtime::Runtime, +// RuntimeOrigin = statemint_runtime::RuntimeOrigin, +// XcmpMessageHandler = statemint_runtime::XcmpQueue, +// DmpMessageHandler = statemint_runtime::DmpQueue, +// new_ext = statemint_ext(), +// } +// } + +// decl_test_parachain! { +// pub struct Penpal { +// Runtime = penpal_runtime::Runtime, +// RuntimeOrigin = penpal_runtime::RuntimeOrigin, +// XcmpMessageHandler = penpal_runtime::XcmpQueue, +// DmpMessageHandler = penpal_runtime::DmpQueue, +// new_ext = penpal_ext(), +// } +// } + +// decl_test_relay_chain! { +// pub struct Relay { +// Runtime = polkadot_runtime::Runtime, +// XcmConfig = polkadot_runtime::xcm_config::XcmConfig, +// new_ext = relay_ext(), +// } +// } + +// decl_test_network! { +// pub struct MockNet { +// relay_chain = Relay, +// parachains = vec![ +// (1000, Statemint), +// (2000, Penpal), +// ], +// } +// } + +// // Define Statemint TestExternalities. +// pub fn statemint_ext() -> sp_io::TestExternalities { +// use statemint_runtime::{Runtime, System}; + +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// sp_tracing::try_init_simple(); +// System::set_block_number(1); +// }); +// ext +// } + +// // Define Penpal TestExternalities. +// pub fn penpal_ext() -> sp_io::TestExternalities { +// use penpal_runtime::{Runtime, System}; + +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// sp_tracing::try_init_simple(); +// System::set_block_number(1); +// }); +// ext +// } + +// // Define Polkadot TestExternalities. +// pub fn relay_ext() -> sp_io::TestExternalities { +// use polkadot_runtime::{Runtime, RuntimeOrigin, System}; + +// // ::XcmSender = RelayChainXcmRouter; +// // ::XcmRouter = RelayChainXcmRouter; + +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + +// polkadot_runtime_parachains::configuration::GenesisConfig:: { +// config: HostConfiguration { +// max_upward_queue_count: 10, +// max_upward_queue_size: 51200, +// max_upward_message_size: 51200, +// max_upward_message_num_per_candidate: 10, +// max_downward_message_size: 51200, +// ..Default::default() +// }, +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![ +// (ALICE, INITIAL_BALANCE), +// (child_account_id(1000), INITIAL_BALANCE), +// (child_account_id(2000), INITIAL_BALANCE), +// ], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// System::set_block_number(1); +// }); +// ext +// } + +// pub fn parent_account_id() -> parachains_common::AccountId { +// let location = (Parent,); +// statemint_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() +// } + +// pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { +// let location = (Parachain(para),); +// polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() +// } pub type RelayChainPalletXcm = pallet_xcm::Pallet; pub type StatemintPalletXcm = pallet_xcm::Pallet; @@ -170,7 +172,7 @@ parameter_types! { // another. fn force_xcm_version() { let xcm_version = 3; - Relay::execute_with(|| { + Polkadot::execute_with(|| { use polkadot_runtime::{RuntimeEvent, System}; let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); @@ -223,7 +225,7 @@ mod dmp { fn get_balances() -> (Balance, Balance) { let mut relay_balance = Default::default(); - Relay::execute_with(|| { + Polkadot::execute_with(|| { relay_balance = polkadot_runtime::System::account::(ALICE.into()) .data @@ -257,7 +259,7 @@ mod dmp { let (relay_balance, ap_balance) = get_balances(); - Relay::execute_with(|| { + Polkadot::execute_with(|| { use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; assert_ok!(RelayChainPalletXcm::limited_teleport_assets( @@ -292,7 +294,7 @@ mod dmp { fn transact_sudo_relay_to_assets_para_works() { force_xcm_version(); - Relay::execute_with(|| { + Polkadot::execute_with(|| { use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< @@ -335,7 +337,7 @@ mod dmp { let amount = 1000_000_000; let assets: VersionedMultiAssets = (Here, amount).into(); - Relay::execute_with(|| { + Polkadot::execute_with(|| { use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( diff --git a/parachains/integration-tests/xcm-emulator/common.rs b/parachains/integration-tests/xcm-emulator/common.rs deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/parachains/integration-tests/xcm-emulator/common/Cargo.toml b/parachains/integration-tests/xcm-emulator/common/Cargo.toml new file mode 100644 index 00000000000..a3ab882fbec --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/common/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "integration-tests-common" +version = "1.0.0" +authors = ["Parity Technologies "] +edition = "2021" +description = "Common resources for integration testing with xcm-emulator" + +[dependencies] +codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } + +# Substrate +sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } + +# Polkadot +polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } + +# Cumulus +parachains-common = { path = "../../../common" } +penpal-runtime = { path = "../../../runtimes/testing/penpal" } +statemint-runtime = { path = "../../../runtimes/assets/statemint" } + +# Local +xcm-emulator = { default-features = false, path = "../../../../xcm/xcm-emulator" } diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs new file mode 100644 index 00000000000..046b3be8b2f --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -0,0 +1,85 @@ +pub use polkadot_runtime_parachains::configuration::HostConfiguration; +pub use parachains_common::BlockNumber; + +pub mod accounts { + pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); + pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); +} + +// pub mod polkadot { +// pub const MAX_UPWARD_QUEUE_COUNT = 10; +// pub const MAX_UPWARD_QUEUE_SIZE = 10; +// pub const MAX_UPWARD_QUEUE_SIZE = 10; +// } + +pub mod polkadot { + use super::HostConfiguration; + use super::BlockNumber; + + pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + ..Default::default() + } + } +} + +pub mod kusama { + use super::HostConfiguration; + use super::BlockNumber; + + pub fn get_host_config() -> HostConfiguration { + HostConfiguration { + max_upward_queue_count: 10, + max_upward_queue_size: 51200, + max_upward_message_size: 51200, + max_upward_message_num_per_candidate: 10, + max_downward_message_size: 51200, + ..Default::default() + } + } +} + +// pub const POLKADOT_HOST_CONFIG: HostConfiguration = HostConfiguration { +// max_upward_queue_count: 10, +// max_upward_queue_size: 51200, +// max_upward_message_size: 51200, +// max_upward_message_num_per_candidate: 10, +// max_downward_message_size: 51200, +// ..ConstDefault::default() +// }; + +// pub let KUSAMA_HOST_CONFIG: HostConfiguration = HostConfiguration { +// max_upward_queue_count: 10, +// max_upward_queue_size: 51200, +// max_upward_message_size: 51200, +// max_upward_message_num_per_candidate: 10, +// max_downward_message_size: 51200, +// ..Default::default() +// }; + +// pub const fn get_polkadot_host_config() -> HostConfiguration { +// HostConfiguration { +// max_upward_queue_count: 10, +// max_upward_queue_size: 51200, +// max_upward_message_size: 51200, +// max_upward_message_num_per_candidate: 10, +// max_downward_message_size: 51200, +// ..Default::default() +// } +// } + +// pub const fn get_kusama_host_config() -> HostConfiguration { +// HostConfiguration { +// max_upward_queue_count: 10, +// max_upward_queue_size: 51200, +// max_upward_message_size: 51200, +// max_upward_message_num_per_candidate: 10, +// max_downward_message_size: 51200, +// ..Default::default() +// } +// } diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs new file mode 100644 index 00000000000..b2806b371a8 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -0,0 +1,141 @@ +pub mod constants; + +use frame_support::{ + assert_ok, + instances::Instance1, + pallet_prelude::Hooks, + sp_io, sp_tracing, + traits::{fungibles::Inspect, GenesisBuild}, +}; +use xcm::prelude::*; +use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; +use polkadot_runtime_parachains::configuration::HostConfiguration; +use xcm_executor::traits::Convert; +use statemint_runtime::constants::currency::DOLLARS; +pub use constants::{polkadot, kusama, accounts::{ALICE, BOB}}; + +decl_test_relay_chain! { + pub struct Polkadot { + Runtime = polkadot_runtime::Runtime, + XcmConfig = polkadot_runtime::xcm_config::XcmConfig, + new_ext = relay_ext(), + } +} + +decl_test_parachain! { + pub struct Statemint { + Runtime = statemint_runtime::Runtime, + RuntimeOrigin = statemint_runtime::RuntimeOrigin, + XcmpMessageHandler = statemint_runtime::XcmpQueue, + DmpMessageHandler = statemint_runtime::DmpQueue, + new_ext = statemint_ext(), + } +} + +decl_test_parachain! { + pub struct Penpal { + Runtime = penpal_runtime::Runtime, + RuntimeOrigin = penpal_runtime::RuntimeOrigin, + XcmpMessageHandler = penpal_runtime::XcmpQueue, + DmpMessageHandler = penpal_runtime::DmpQueue, + new_ext = penpal_ext(), + } +} + +decl_test_network! { + pub struct PolkadotMockNet { + relay_chain = Polkadot, + parachains = vec![ + (1000, Statemint), + (2000, Penpal), + ], + } +} + +pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; + +pub fn parent_account_id() -> parachains_common::AccountId { + let location = (Parent,); + statemint_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() +} + +pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { + let location = (Parachain(para),); + polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() +} + +pub fn relay_ext() -> sp_io::TestExternalities { + use polkadot_runtime::{Runtime, RuntimeOrigin, System}; + + // ::XcmSender = RelayChainXcmRouter; + // ::XcmRouter = RelayChainXcmRouter; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + polkadot_runtime_parachains::configuration::GenesisConfig:: { + config: polkadot::get_host_config(), + } + .assimilate_storage(&mut t) + .unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![ + (ALICE, INITIAL_BALANCE), + (child_account_id(1000), INITIAL_BALANCE), + (child_account_id(2000), INITIAL_BALANCE), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + System::set_block_number(1); + }); + ext +} + +// Define Statemint TestExternalities. +pub fn statemint_ext() -> sp_io::TestExternalities { + use statemint_runtime::{Runtime, System}; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + System::set_block_number(1); + }); + ext +} + +// Define Penpal TestExternalities. +pub fn penpal_ext() -> sp_io::TestExternalities { + use penpal_runtime::{Runtime, System}; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + System::set_block_number(1); + }); + ext +} + +// mod accounts { +// pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); +// pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); +// } From 11eb54f50dc4508b5e86baa9f8dfb2ab838021e7 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 24 Apr 2023 14:08:46 +0200 Subject: [PATCH 03/60] make macros repetitions --- Cargo.lock | 2 + .../assets/statemine/tests/statemine.rs | 78 ++-- .../assets/statemint/tests/statemint.rs | 131 +----- .../xcm-emulator/common/Cargo.toml | 2 + .../xcm-emulator/common/src/constants.rs | 12 +- .../xcm-emulator/common/src/lib.rs | 45 +- xcm/xcm-emulator/src/lib.rs | 397 +++++++++--------- 7 files changed, 289 insertions(+), 378 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 04834479983..78a57af8ece 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4370,6 +4370,7 @@ version = "1.0.0" dependencies = [ "frame-support", "frame-system", + "kusama-runtime", "pallet-assets", "pallet-balances", "pallet-xcm", @@ -4383,6 +4384,7 @@ dependencies = [ "sp-core", "sp-runtime", "sp-weights", + "statemine-runtime", "statemint-runtime", "xcm", "xcm-emulator", diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs b/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs index 62831c417e5..a12bb4f9492 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs @@ -68,45 +68,45 @@ decl_test_network! { } } -// Define Statemine TestExternalities. -pub fn statemine_ext() -> sp_io::TestExternalities { - use statemine_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - sp_tracing::try_init_simple(); - System::set_block_number(1); - }); - ext -} - -// Define Penpal TestExternalities. -pub fn penpal_ext() -> sp_io::TestExternalities { - use penpal_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - sp_tracing::try_init_simple(); - System::set_block_number(1); - }); - ext -} +// // Define Statemine TestExternalities. +// pub fn statemine_ext() -> sp_io::TestExternalities { +// use statemine_runtime::{Runtime, System}; + +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// sp_tracing::try_init_simple(); +// System::set_block_number(1); +// }); +// ext +// } + +// // Define Penpal TestExternalities. +// pub fn penpal_ext() -> sp_io::TestExternalities { +// use penpal_runtime::{Runtime, System}; + +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// sp_tracing::try_init_simple(); +// System::set_block_number(1); +// }); +// ext +// } // Define Kusama TestExternalities. pub fn relay_ext() -> sp_io::TestExternalities { diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs index 4e2eb13882a..8bfecba5a0e 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs @@ -11,7 +11,7 @@ use polkadot_runtime_parachains::configuration::HostConfiguration; use sp_core::parameter_types; use statemint_runtime::constants::currency::DOLLARS; use xcm::prelude::*; -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; +use xcm_emulator::TestExt; use xcm_executor::traits::Convert; @@ -28,137 +28,8 @@ use xcm::{ use integration_tests_common::{PolkadotMockNet, Polkadot, Statemint, Penpal, constants::accounts::{ALICE, BOB}}; -// pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); -// pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; -// decl_test_parachain! { -// pub struct Statemint { -// Runtime = statemint_runtime::Runtime, -// RuntimeOrigin = statemint_runtime::RuntimeOrigin, -// XcmpMessageHandler = statemint_runtime::XcmpQueue, -// DmpMessageHandler = statemint_runtime::DmpQueue, -// new_ext = statemint_ext(), -// } -// } - -// decl_test_parachain! { -// pub struct Penpal { -// Runtime = penpal_runtime::Runtime, -// RuntimeOrigin = penpal_runtime::RuntimeOrigin, -// XcmpMessageHandler = penpal_runtime::XcmpQueue, -// DmpMessageHandler = penpal_runtime::DmpQueue, -// new_ext = penpal_ext(), -// } -// } - -// decl_test_relay_chain! { -// pub struct Relay { -// Runtime = polkadot_runtime::Runtime, -// XcmConfig = polkadot_runtime::xcm_config::XcmConfig, -// new_ext = relay_ext(), -// } -// } - -// decl_test_network! { -// pub struct MockNet { -// relay_chain = Relay, -// parachains = vec![ -// (1000, Statemint), -// (2000, Penpal), -// ], -// } -// } - -// // Define Statemint TestExternalities. -// pub fn statemint_ext() -> sp_io::TestExternalities { -// use statemint_runtime::{Runtime, System}; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// sp_tracing::try_init_simple(); -// System::set_block_number(1); -// }); -// ext -// } - -// // Define Penpal TestExternalities. -// pub fn penpal_ext() -> sp_io::TestExternalities { -// use penpal_runtime::{Runtime, System}; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// sp_tracing::try_init_simple(); -// System::set_block_number(1); -// }); -// ext -// } - -// // Define Polkadot TestExternalities. -// pub fn relay_ext() -> sp_io::TestExternalities { -// use polkadot_runtime::{Runtime, RuntimeOrigin, System}; - -// // ::XcmSender = RelayChainXcmRouter; -// // ::XcmRouter = RelayChainXcmRouter; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// polkadot_runtime_parachains::configuration::GenesisConfig:: { -// config: HostConfiguration { -// max_upward_queue_count: 10, -// max_upward_queue_size: 51200, -// max_upward_message_size: 51200, -// max_upward_message_num_per_candidate: 10, -// max_downward_message_size: 51200, -// ..Default::default() -// }, -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![ -// (ALICE, INITIAL_BALANCE), -// (child_account_id(1000), INITIAL_BALANCE), -// (child_account_id(2000), INITIAL_BALANCE), -// ], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// System::set_block_number(1); -// }); -// ext -// } - -// pub fn parent_account_id() -> parachains_common::AccountId { -// let location = (Parent,); -// statemint_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() -// } - -// pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { -// let location = (Parachain(para),); -// polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() -// } - pub type RelayChainPalletXcm = pallet_xcm::Pallet; pub type StatemintPalletXcm = pallet_xcm::Pallet; pub type PenpalPalletXcm = pallet_xcm::Pallet; diff --git a/parachains/integration-tests/xcm-emulator/common/Cargo.toml b/parachains/integration-tests/xcm-emulator/common/Cargo.toml index a3ab882fbec..397c78f5e55 100644 --- a/parachains/integration-tests/xcm-emulator/common/Cargo.toml +++ b/parachains/integration-tests/xcm-emulator/common/Cargo.toml @@ -22,6 +22,7 @@ polkadot-core-primitives = { default-features = false, git = "https://github.com polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } @@ -30,6 +31,7 @@ pallet-xcm = { default-features = false, git = "https://github.com/paritytech/po parachains-common = { path = "../../../common" } penpal-runtime = { path = "../../../runtimes/testing/penpal" } statemint-runtime = { path = "../../../runtimes/assets/statemint" } +statemine-runtime = { path = "../../../runtimes/assets/statemine" } # Local xcm-emulator = { default-features = false, path = "../../../../xcm/xcm-emulator" } diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs index 046b3be8b2f..fa627aa91b5 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/constants.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -6,15 +6,8 @@ pub mod accounts { pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); } -// pub mod polkadot { -// pub const MAX_UPWARD_QUEUE_COUNT = 10; -// pub const MAX_UPWARD_QUEUE_SIZE = 10; -// pub const MAX_UPWARD_QUEUE_SIZE = 10; -// } - pub mod polkadot { - use super::HostConfiguration; - use super::BlockNumber; + use super::*; pub fn get_host_config() -> HostConfiguration { HostConfiguration { @@ -29,8 +22,7 @@ pub mod polkadot { } pub mod kusama { - use super::HostConfiguration; - use super::BlockNumber; + use super::*; pub fn get_host_config() -> HostConfiguration { HostConfiguration { diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index b2806b371a8..f7304695927 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -8,31 +8,40 @@ use frame_support::{ traits::{fungibles::Inspect, GenesisBuild}, }; use xcm::prelude::*; -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt}; use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; pub use constants::{polkadot, kusama, accounts::{ALICE, BOB}}; -decl_test_relay_chain! { +decl_test_relay_chains! { pub struct Polkadot { Runtime = polkadot_runtime::Runtime, XcmConfig = polkadot_runtime::xcm_config::XcmConfig, new_ext = relay_ext(), + }, + pub struct Kusama { + Runtime = kusama_runtime::Runtime, + XcmConfig = kusama_runtime::xcm_config::XcmConfig, + new_ext = relay_ext(), } } -decl_test_parachain! { +decl_test_parachains! { + pub struct Statemine { + Runtime = statemine_runtime::Runtime, + RuntimeOrigin = statemine_runtime::RuntimeOrigin, + XcmpMessageHandler = statemine_runtime::XcmpQueue, + DmpMessageHandler = statemine_runtime::DmpQueue, + new_ext = statemine_ext(), + }, pub struct Statemint { Runtime = statemint_runtime::Runtime, RuntimeOrigin = statemint_runtime::RuntimeOrigin, XcmpMessageHandler = statemint_runtime::XcmpQueue, DmpMessageHandler = statemint_runtime::DmpQueue, new_ext = statemint_ext(), - } -} - -decl_test_parachain! { + }, pub struct Penpal { Runtime = penpal_runtime::Runtime, RuntimeOrigin = penpal_runtime::RuntimeOrigin, @@ -42,7 +51,7 @@ decl_test_parachain! { } } -decl_test_network! { +decl_test_networks! { pub struct PolkadotMockNet { relay_chain = Polkadot, parachains = vec![ @@ -115,6 +124,26 @@ pub fn statemint_ext() -> sp_io::TestExternalities { ext } +// Define Statemine TestExternalities. +pub fn statemine_ext() -> sp_io::TestExternalities { + use statemine_runtime::{Runtime, System}; + + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + System::set_block_number(1); + }); + ext +} + // Define Penpal TestExternalities. pub fn penpal_ext() -> sp_io::TestExternalities { use penpal_runtime::{Runtime, System}; diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index a8bebd6fb02..cf6c53003cb 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -52,77 +52,87 @@ pub trait TestExt { } #[macro_export] -macro_rules! decl_test_relay_chain { +macro_rules! decl_test_relay_chains { ( - pub struct $name:ident { - Runtime = $runtime:path, - XcmConfig = $xcm_config:path, - new_ext = $new_ext:expr, - } + $( + pub struct $name:ident { + Runtime = $runtime:path, + XcmConfig = $xcm_config:path, + new_ext = $new_ext:expr, + } + ), + + ) => { - pub struct $name; + $( + pub struct $name; - $crate::__impl_ext_for_relay_chain!($name, $runtime, $new_ext); + $crate::__impl_ext_for_relay_chain!($name, $runtime, $new_ext); - impl $crate::UmpSink for $name { - fn process_upward_message( - origin: $crate::ParaId, - msg: &[u8], - max_weight: $crate::Weight, - ) -> Result<$crate::Weight, ($crate::MessageId, $crate::Weight)> { - use $crate::{TestExt, UmpSink}; + impl $crate::UmpSink for $name { + fn process_upward_message( + origin: $crate::ParaId, + msg: &[u8], + max_weight: $crate::Weight, + ) -> Result<$crate::Weight, ($crate::MessageId, $crate::Weight)> { + use $crate::{TestExt, UmpSink}; - Self::execute_with(|| { - $crate::XcmSink::<$crate::XcmExecutor<$xcm_config>, $runtime>::process_upward_message(origin, msg, max_weight) - }) + Self::execute_with(|| { + $crate::XcmSink::<$crate::XcmExecutor<$xcm_config>, $runtime>::process_upward_message(origin, msg, max_weight) + }) + } } - } + )+ }; } #[macro_export] -macro_rules! decl_test_parachain { +macro_rules! decl_test_parachains { ( - pub struct $name:ident { - Runtime = $runtime:path, - RuntimeOrigin = $origin:path, - XcmpMessageHandler = $xcmp_message_handler:path, - DmpMessageHandler = $dmp_message_handler:path, - new_ext = $new_ext:expr, - } + $( + pub struct $name:ident { + Runtime = $runtime:path, + RuntimeOrigin = $origin:path, + XcmpMessageHandler = $xcmp_message_handler:path, + DmpMessageHandler = $dmp_message_handler:path, + new_ext = $new_ext:expr, + } + ), + + ) => { - pub struct $name; - - $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $new_ext); - - impl $crate::XcmpMessageHandler for $name { - fn handle_xcmp_messages< - 'a, - I: Iterator, - >( - iter: I, - max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{TestExt, XcmpMessageHandler}; - - $name::execute_with(|| { - <$xcmp_message_handler>::handle_xcmp_messages(iter, max_weight) - }) + $( + pub struct $name; + + $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $new_ext); + + impl $crate::XcmpMessageHandler for $name { + fn handle_xcmp_messages< + 'a, + I: Iterator, + >( + iter: I, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{TestExt, XcmpMessageHandler}; + + $name::execute_with(|| { + <$xcmp_message_handler>::handle_xcmp_messages(iter, max_weight) + }) + } } - } - impl $crate::DmpMessageHandler for $name { - fn handle_dmp_messages( - iter: impl Iterator)>, - max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{DmpMessageHandler, TestExt}; + impl $crate::DmpMessageHandler for $name { + fn handle_dmp_messages( + iter: impl Iterator)>, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{DmpMessageHandler, TestExt}; - $name::execute_with(|| { - <$dmp_message_handler>::handle_dmp_messages(iter, max_weight) - }) + $name::execute_with(|| { + <$dmp_message_handler>::handle_dmp_messages(iter, max_weight) + }) + } } - } + )+ }; } @@ -319,169 +329,174 @@ thread_local! { } #[macro_export] -macro_rules! decl_test_network { +macro_rules! decl_test_networks { ( - pub struct $name:ident { - relay_chain = $relay_chain:ty, - parachains = vec![ $( ($para_id:expr, $parachain:ty), )* ], - } + $( + pub struct $name:ident { + relay_chain = $relay_chain:ty, + parachains = vec![ $( ($para_id:expr, $parachain:ty), )* ], + } + ), + + ) => { - pub struct $name; + $( + pub struct $name; - impl $name { - pub fn reset() { - use $crate::{TestExt, VecDeque}; + impl $name { + pub fn reset() { + use $crate::{TestExt, VecDeque}; - <$relay_chain>::reset_ext(); - $( <$parachain>::reset_ext(); )* + <$relay_chain>::reset_ext(); + $( <$parachain>::reset_ext(); )* - $( <$parachain>::prepare_for_xcmp(); )* + $( <$parachain>::prepare_for_xcmp(); )* - $crate::DOWNWARD_MESSAGES.with(|b| b.replace(VecDeque::new())); - $crate::DMP_DONE.with(|b| b.replace(VecDeque::new())); + $crate::DOWNWARD_MESSAGES.with(|b| b.replace(VecDeque::new())); + $crate::DMP_DONE.with(|b| b.replace(VecDeque::new())); + } } - } - fn _para_ids() -> Vec { - vec![$( $para_id, )*] - } + fn _para_ids() -> Vec { + vec![$( $para_id, )*] + } - fn _process_messages() { - while _has_unprocessed_messages() { - _process_upward_messages(); - _process_horizontal_messages(); - _process_downward_messages(); + fn _process_messages() { + while _has_unprocessed_messages() { + _process_upward_messages(); + _process_horizontal_messages(); + _process_downward_messages(); + } } - } - fn _has_unprocessed_messages() -> bool { - $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - } + fn _has_unprocessed_messages() -> bool { + $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) + || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().is_empty()) + || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) + } - fn _process_downward_messages() { - use $crate::{DmpMessageHandler, Bounded}; - use polkadot_parachain::primitives::RelayChainBlockNumber; - - while let Some((to_para_id, messages)) - = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - match to_para_id { - $( - $para_id => { - let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); - for m in messages { - msg_dedup.push((m.0, m.1.clone())); - } - msg_dedup.dedup(); - - let msgs = msg_dedup.clone().into_iter().filter(|m| { - !$crate::DMP_DONE.with(|b| b.borrow_mut().contains(&(to_para_id, m.0, m.1.clone()))) - }).collect::)>>(); - if msgs.len() != 0 { - <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); - for m in msgs { - $crate::DMP_DONE.with(|b| b.borrow_mut().push_back((to_para_id, m.0, m.1))); + fn _process_downward_messages() { + use $crate::{DmpMessageHandler, Bounded}; + use polkadot_parachain::primitives::RelayChainBlockNumber; + + while let Some((to_para_id, messages)) + = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + match to_para_id { + $( + $para_id => { + let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); + for m in messages { + msg_dedup.push((m.0, m.1.clone())); } - } - }, - )* - _ => unreachable!(), + msg_dedup.dedup(); + + let msgs = msg_dedup.clone().into_iter().filter(|m| { + !$crate::DMP_DONE.with(|b| b.borrow_mut().contains(&(to_para_id, m.0, m.1.clone()))) + }).collect::)>>(); + if msgs.len() != 0 { + <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); + for m in msgs { + $crate::DMP_DONE.with(|b| b.borrow_mut().push_back((to_para_id, m.0, m.1))); + } + } + }, + )* + _ => unreachable!(), + } } } - } - fn _process_horizontal_messages() { - use $crate::{XcmpMessageHandler, Bounded}; - - while let Some((to_para_id, messages)) - = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); - match to_para_id { - $( - $para_id => { - <$parachain>::handle_xcmp_messages(iter, $crate::Weight::max_value()); - }, - )* - _ => unreachable!(), + fn _process_horizontal_messages() { + use $crate::{XcmpMessageHandler, Bounded}; + + while let Some((to_para_id, messages)) + = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); + match to_para_id { + $( + $para_id => { + <$parachain>::handle_xcmp_messages(iter, $crate::Weight::max_value()); + }, + )* + _ => unreachable!(), + } } } - } - fn _process_upward_messages() { - use $crate::{UmpSink, Bounded}; - while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - let _ = <$relay_chain>::process_upward_message( - from_para_id.into(), - &msg[..], - $crate::Weight::max_value(), - ); + fn _process_upward_messages() { + use $crate::{UmpSink, Bounded}; + while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + let _ = <$relay_chain>::process_upward_message( + from_para_id.into(), + &msg[..], + $crate::Weight::max_value(), + ); + } } - } - pub struct _Messenger; - impl _Messenger { - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); - } + pub struct _Messenger; + impl _Messenger { + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); + } - fn send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) { - $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); - } + fn send_horizontal_messages< + I: Iterator)>, + >(to_para_id: u32, iter: I) { + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); + } - fn send_upward_message(from_para_id: u32, msg: Vec) { - $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().push_back((from_para_id, msg))); + fn send_upward_message(from_para_id: u32, msg: Vec) { + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().push_back((from_para_id, msg))); + } } - } - fn _hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> $crate::ParachainInherentData { - use $crate::cumulus_primitives_core::{relay_chain::HrmpChannelId, AbridgedHrmpChannel}; - - let mut sproof = $crate::RelayStateSproofBuilder::default(); - sproof.para_id = para_id.into(); - - // egress channel - let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); - for recipient_para_id in &[ $( $para_id, )* ] { - let recipient_para_id = $crate::ParaId::from(*recipient_para_id); - if let Err(idx) = e_index.binary_search(&recipient_para_id) { - e_index.insert(idx, recipient_para_id); + fn _hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> $crate::ParachainInherentData { + use $crate::cumulus_primitives_core::{relay_chain::HrmpChannelId, AbridgedHrmpChannel}; + + let mut sproof = $crate::RelayStateSproofBuilder::default(); + sproof.para_id = para_id.into(); + + // egress channel + let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); + for recipient_para_id in &[ $( $para_id, )* ] { + let recipient_para_id = $crate::ParaId::from(*recipient_para_id); + if let Err(idx) = e_index.binary_search(&recipient_para_id) { + e_index.insert(idx, recipient_para_id); + } + + sproof + .hrmp_channels + .entry(HrmpChannelId { + sender: sproof.para_id, + recipient: recipient_para_id, + }) + .or_insert_with(|| AbridgedHrmpChannel { + max_capacity: 1024, + max_total_size: 1024 * 1024, + max_message_size: 1024 * 1024, + msg_count: 0, + total_size: 0, + mqc_head: Option::None, + }); } - sproof - .hrmp_channels - .entry(HrmpChannelId { - sender: sproof.para_id, - recipient: recipient_para_id, - }) - .or_insert_with(|| AbridgedHrmpChannel { - max_capacity: 1024, - max_total_size: 1024 * 1024, - max_message_size: 1024 * 1024, - msg_count: 0, - total_size: 0, - mqc_head: Option::None, - }); - } - - let (relay_storage_root, proof) = sproof.into_state_root_and_proof(); - - $crate::ParachainInherentData { - validation_data: $crate::PersistedValidationData { - parent_head: Default::default(), - relay_parent_number, - relay_parent_storage_root: relay_storage_root, - max_pov_size: Default::default(), - }, - relay_chain_state: proof, - downward_messages: Default::default(), - horizontal_messages: Default::default(), + let (relay_storage_root, proof) = sproof.into_state_root_and_proof(); + + $crate::ParachainInherentData { + validation_data: $crate::PersistedValidationData { + parent_head: Default::default(), + relay_parent_number, + relay_parent_storage_root: relay_storage_root, + max_pov_size: Default::default(), + }, + relay_chain_state: proof, + downward_messages: Default::default(), + horizontal_messages: Default::default(), + } } - } + )+ }; } From fb5f5c7a45c8959870f2cbb19207f4f96251803a Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 25 Apr 2023 12:28:37 +0200 Subject: [PATCH 04/60] messenger traits for relay and para --- .../xcm-emulator/common/src/lib.rs | 13 +- xcm/xcm-emulator/src/lib.rs | 348 +++++++++++------- 2 files changed, 226 insertions(+), 135 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index f7304695927..df8a4bf6c6e 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -8,7 +8,7 @@ use frame_support::{ traits::{fungibles::Inspect, GenesisBuild}, }; use xcm::prelude::*; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, RelayMessenger, ParachainMessenger}; use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; @@ -19,12 +19,12 @@ decl_test_relay_chains! { Runtime = polkadot_runtime::Runtime, XcmConfig = polkadot_runtime::xcm_config::XcmConfig, new_ext = relay_ext(), - }, - pub struct Kusama { - Runtime = kusama_runtime::Runtime, - XcmConfig = kusama_runtime::xcm_config::XcmConfig, - new_ext = relay_ext(), } + // pub struct Kusama { + // Runtime = kusama_runtime::Runtime, + // XcmConfig = kusama_runtime::xcm_config::XcmConfig, + // new_ext = relay_ext(), + // } } decl_test_parachains! { @@ -61,6 +61,7 @@ decl_test_networks! { } } + pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; pub fn parent_account_id() -> parachains_common::AccountId { diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index cf6c53003cb..20f68df0a20 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -51,6 +51,35 @@ pub trait TestExt { fn execute_with(execute: impl FnOnce() -> R) -> R; } + +pub trait RelayMessenger { + fn para_ids() -> Vec; + + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>); + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData; + + fn process_messages(); +} + +pub trait ParachainMessenger { + fn send_horizontal_messages< + I: Iterator)>, + >(to_para_id: u32, iter: I); + + fn send_upward_message(from_para_id: u32, msg: Vec) {} + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData; + + fn process_messages(); +} + #[macro_export] macro_rules! decl_test_relay_chains { ( @@ -169,7 +198,7 @@ macro_rules! __impl_ext_for_relay_chain { use $crate::polkadot_primitives::runtime_api::runtime_decl_for_parachain_host::ParachainHostV4; //TODO: mark sent count & filter out sent msg - for para_id in _para_ids() { + for para_id in <$name>::para_ids() { // downward messages let downward_messages = <$runtime>::dmq_contents(para_id.into()) .into_iter() @@ -177,7 +206,7 @@ macro_rules! __impl_ext_for_relay_chain { if downward_messages.len() == 0 { continue; } - _Messenger::send_downward_messages(para_id, downward_messages.into_iter()); + <$name>::send_downward_messages(para_id, downward_messages.into_iter()); // Note: no need to handle horizontal messages, as the // simulator directly sends them to dest (not relayed). @@ -185,7 +214,7 @@ macro_rules! __impl_ext_for_relay_chain { }) }); - _process_messages(); + <$name>::process_messages(); r } @@ -220,7 +249,7 @@ macro_rules! __impl_ext_for_parachain { let _ = ParachainSystem::set_validation_data( <$origin>::none(), - _hrmp_channel_parachain_inherent_data(para_id.into(), 1), + <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), 1), ); // set `AnnouncedHrmpMessagesPerCandidate` ParachainSystem::on_initialize(block_number); @@ -253,7 +282,7 @@ macro_rules! __impl_ext_for_parachain { let relay_block = *v.borrow(); let _ = ParachainSystem::set_validation_data( <$origin>::none(), - _hrmp_channel_parachain_inherent_data(para_id.into(), relay_block), + <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), relay_block), ); }); }) @@ -282,14 +311,14 @@ macro_rules! __impl_ext_for_parachain { // send upward messages let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); for msg in collation_info.upward_messages.clone() { - _Messenger::send_upward_message(para_id.into(), msg); + <$name>::send_upward_message(para_id.into(), msg); } // send horizontal messages for msg in collation_info.horizontal_messages { $crate::GLOBAL_RELAY.with(|v| { let relay_block = *v.borrow(); - _Messenger::send_horizontal_messages( + <$name>::send_horizontal_messages( msg.recipient.into(), vec![(para_id.into(), relay_block, msg.data)].into_iter(), ); @@ -301,7 +330,7 @@ macro_rules! __impl_ext_for_parachain { }) }); - _process_messages(); + <$name>::process_messages(); r } @@ -340,6 +369,8 @@ macro_rules! decl_test_networks { + ) => { $( + use $crate::{RelayBlockNumber, ParaId, ParachainInherentData}; + pub struct $name; impl $name { @@ -354,149 +385,208 @@ macro_rules! decl_test_networks { $crate::DOWNWARD_MESSAGES.with(|b| b.replace(VecDeque::new())); $crate::DMP_DONE.with(|b| b.replace(VecDeque::new())); } - } - fn _para_ids() -> Vec { - vec![$( $para_id, )*] - } + fn _send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); + } - fn _process_messages() { - while _has_unprocessed_messages() { - _process_upward_messages(); - _process_horizontal_messages(); - _process_downward_messages(); + fn _send_horizontal_messages< + I: Iterator)>, + >(to_para_id: u32, iter: I) { + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); } - } - fn _has_unprocessed_messages() -> bool { - $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - } + fn _send_upward_message(from_para_id: u32, msg: Vec) { + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().push_back((from_para_id, msg))); + } - fn _process_downward_messages() { - use $crate::{DmpMessageHandler, Bounded}; - use polkadot_parachain::primitives::RelayChainBlockNumber; - - while let Some((to_para_id, messages)) - = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - match to_para_id { - $( - $para_id => { - let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); - for m in messages { - msg_dedup.push((m.0, m.1.clone())); - } - msg_dedup.dedup(); - - let msgs = msg_dedup.clone().into_iter().filter(|m| { - !$crate::DMP_DONE.with(|b| b.borrow_mut().contains(&(to_para_id, m.0, m.1.clone()))) - }).collect::)>>(); - if msgs.len() != 0 { - <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); - for m in msgs { - $crate::DMP_DONE.with(|b| b.borrow_mut().push_back((to_para_id, m.0, m.1))); - } - } - }, - )* - _ => unreachable!(), - } + fn _para_ids() -> Vec { + vec![$( $para_id, )*] } - } - fn _process_horizontal_messages() { - use $crate::{XcmpMessageHandler, Bounded}; - - while let Some((to_para_id, messages)) - = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); - match to_para_id { - $( - $para_id => { - <$parachain>::handle_xcmp_messages(iter, $crate::Weight::max_value()); - }, - )* - _ => unreachable!(), + fn _process_messages() { + while Self::_has_unprocessed_messages() { + Self::_process_upward_messages(); + Self::_process_horizontal_messages(); + Self::_process_downward_messages(); } } - } - fn _process_upward_messages() { - use $crate::{UmpSink, Bounded}; - while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { - let _ = <$relay_chain>::process_upward_message( - from_para_id.into(), - &msg[..], - $crate::Weight::max_value(), - ); + fn _has_unprocessed_messages() -> bool { + $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) + || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().is_empty()) + || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) } - } - pub struct _Messenger; - impl _Messenger { - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); + fn _process_downward_messages() { + use $crate::{DmpMessageHandler, Bounded}; + use polkadot_parachain::primitives::RelayChainBlockNumber; + + while let Some((to_para_id, messages)) + = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + match to_para_id { + $( + $para_id => { + let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); + for m in messages { + msg_dedup.push((m.0, m.1.clone())); + } + msg_dedup.dedup(); + + let msgs = msg_dedup.clone().into_iter().filter(|m| { + !$crate::DMP_DONE.with(|b| b.borrow_mut().contains(&(to_para_id, m.0, m.1.clone()))) + }).collect::)>>(); + if msgs.len() != 0 { + <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); + for m in msgs { + $crate::DMP_DONE.with(|b| b.borrow_mut().push_back((to_para_id, m.0, m.1))); + } + } + }, + )* + _ => unreachable!(), + } + } } - fn send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) { - $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); + fn _process_horizontal_messages() { + use $crate::{XcmpMessageHandler, Bounded}; + + while let Some((to_para_id, messages)) + = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); + match to_para_id { + $( + $para_id => { + <$parachain>::handle_xcmp_messages(iter, $crate::Weight::max_value()); + }, + )* + _ => unreachable!(), + } + } } - fn send_upward_message(from_para_id: u32, msg: Vec) { - $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().push_back((from_para_id, msg))); + fn _process_upward_messages() { + use $crate::{UmpSink, Bounded}; + while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + let _ = <$relay_chain>::process_upward_message( + from_para_id.into(), + &msg[..], + $crate::Weight::max_value(), + ); + } } - } - fn _hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> $crate::ParachainInherentData { - use $crate::cumulus_primitives_core::{relay_chain::HrmpChannelId, AbridgedHrmpChannel}; - - let mut sproof = $crate::RelayStateSproofBuilder::default(); - sproof.para_id = para_id.into(); - - // egress channel - let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); - for recipient_para_id in &[ $( $para_id, )* ] { - let recipient_para_id = $crate::ParaId::from(*recipient_para_id); - if let Err(idx) = e_index.binary_search(&recipient_para_id) { - e_index.insert(idx, recipient_para_id); - } + fn _hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> $crate::ParachainInherentData { + use $crate::cumulus_primitives_core::{relay_chain::HrmpChannelId, AbridgedHrmpChannel}; + + let mut sproof = $crate::RelayStateSproofBuilder::default(); + sproof.para_id = para_id.into(); + + // egress channel + let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); + for recipient_para_id in &[ $( $para_id, )* ] { + let recipient_para_id = $crate::ParaId::from(*recipient_para_id); + if let Err(idx) = e_index.binary_search(&recipient_para_id) { + e_index.insert(idx, recipient_para_id); + } - sproof - .hrmp_channels - .entry(HrmpChannelId { - sender: sproof.para_id, - recipient: recipient_para_id, - }) - .or_insert_with(|| AbridgedHrmpChannel { - max_capacity: 1024, - max_total_size: 1024 * 1024, - max_message_size: 1024 * 1024, - msg_count: 0, - total_size: 0, - mqc_head: Option::None, - }); - } + sproof + .hrmp_channels + .entry(HrmpChannelId { + sender: sproof.para_id, + recipient: recipient_para_id, + }) + .or_insert_with(|| AbridgedHrmpChannel { + max_capacity: 1024, + max_total_size: 1024 * 1024, + max_message_size: 1024 * 1024, + msg_count: 0, + total_size: 0, + mqc_head: Option::None, + }); + } - let (relay_storage_root, proof) = sproof.into_state_root_and_proof(); - - $crate::ParachainInherentData { - validation_data: $crate::PersistedValidationData { - parent_head: Default::default(), - relay_parent_number, - relay_parent_storage_root: relay_storage_root, - max_pov_size: Default::default(), - }, - relay_chain_state: proof, - downward_messages: Default::default(), - horizontal_messages: Default::default(), + let (relay_storage_root, proof) = sproof.into_state_root_and_proof(); + + $crate::ParachainInherentData { + validation_data: $crate::PersistedValidationData { + parent_head: Default::default(), + relay_parent_number, + relay_parent_storage_root: relay_storage_root, + max_pov_size: Default::default(), + }, + relay_chain_state: proof, + downward_messages: Default::default(), + horizontal_messages: Default::default(), + } } } + + $crate::__impl_messenger_for_relay!($name, $relay_chain); + + $( + $crate::__impl_messenger_for_parachain!($name, $parachain); + )* )+ }; } + +#[macro_export] +macro_rules! __impl_messenger_for_relay { + ($network_name:ident, $relay_chain:ty) => { + + impl RelayMessenger for $relay_chain { + fn para_ids() -> Vec { + <$network_name>::_para_ids() + } + + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { + <$network_name>::_send_downward_messages(to_para_id, iter) + } + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData { + <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) + } + + fn process_messages() { + <$network_name>::_process_messages(); + } + } + } +} + +#[macro_export] +macro_rules! __impl_messenger_for_parachain { + ($network_name:ident, $parachain:ty) => { + + impl ParachainMessenger for $parachain { + fn send_horizontal_messages< + I: Iterator)>, + >(to_para_id: u32, iter: I) { + <$network_name>::_send_horizontal_messages(to_para_id, iter); + } + + fn send_upward_message(from_para_id: u32, msg: Vec) { + <$network_name>::_send_upward_message(from_para_id, msg); + } + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData { + <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) + } + + fn process_messages() { + <$network_name>::_process_messages(); + } + } + } +} From f216cf78b98b0665754e6c6ff8efb476a4830d81 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 25 Apr 2023 13:15:48 +0200 Subject: [PATCH 05/60] default Messenger impls --- Cargo.lock | 1 + .../xcm-emulator/common/src/lib.rs | 10 ++-- xcm/xcm-emulator/Cargo.toml | 1 + xcm/xcm-emulator/src/lib.rs | 48 +++++++++++++++---- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 78a57af8ece..a455c4e991c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15323,6 +15323,7 @@ dependencies = [ "sp-arithmetic", "sp-io", "sp-std", + "sp-trie", "xcm", "xcm-executor", ] diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index df8a4bf6c6e..3012c3f75ad 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -19,12 +19,12 @@ decl_test_relay_chains! { Runtime = polkadot_runtime::Runtime, XcmConfig = polkadot_runtime::xcm_config::XcmConfig, new_ext = relay_ext(), + }, + pub struct Kusama { + Runtime = kusama_runtime::Runtime, + XcmConfig = kusama_runtime::xcm_config::XcmConfig, + new_ext = relay_ext(), } - // pub struct Kusama { - // Runtime = kusama_runtime::Runtime, - // XcmConfig = kusama_runtime::xcm_config::XcmConfig, - // new_ext = relay_ext(), - // } } decl_test_parachains! { diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml index ff8b1e11963..6830250f7c2 100644 --- a/xcm/xcm-emulator/Cargo.toml +++ b/xcm/xcm-emulator/Cargo.toml @@ -15,6 +15,7 @@ frame-system = { git = "https://github.com/paritytech/substrate", branch = "mast sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } cumulus-primitives-core = { path = "../../primitives/core"} cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue" } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 20f68df0a20..4c2ee5df0d2 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -25,6 +25,7 @@ pub use frame_system; pub use sp_arithmetic::traits::Bounded; pub use sp_io::TestExternalities; pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData}; +pub use sp_trie::StorageProof; pub use cumulus_pallet_dmp_queue; pub use cumulus_pallet_parachain_system; @@ -51,33 +52,56 @@ pub trait TestExt { fn execute_with(execute: impl FnOnce() -> R) -> R; } - pub trait RelayMessenger { - fn para_ids() -> Vec; + fn para_ids() -> Vec { Default::default() } - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>); + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) {} fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, - ) -> ParachainInherentData; + ) -> ParachainInherentData { + ParachainInherentData { + validation_data: PersistedValidationData { + parent_head: Default::default(), + relay_parent_number: Default::default(), + relay_parent_storage_root: Default::default(), + max_pov_size: Default::default(), + }, + relay_chain_state: StorageProof::new(Vec::new()), + downward_messages: Default::default(), + horizontal_messages: Default::default(), + } + } - fn process_messages(); + fn process_messages() {} } pub trait ParachainMessenger { fn send_horizontal_messages< I: Iterator)>, - >(to_para_id: u32, iter: I); + >(to_para_id: u32, iter: I) {} fn send_upward_message(from_para_id: u32, msg: Vec) {} fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, - ) -> ParachainInherentData; + ) -> ParachainInherentData { + ParachainInherentData { + validation_data: PersistedValidationData { + parent_head: Default::default(), + relay_parent_number: Default::default(), + relay_parent_storage_root: Default::default(), + max_pov_size: Default::default(), + }, + relay_chain_state: StorageProof::new(Vec::new()), + downward_messages: Default::default(), + horizontal_messages: Default::default(), + } + } - fn process_messages(); + fn process_messages() {} } #[macro_export] @@ -95,6 +119,8 @@ macro_rules! decl_test_relay_chains { $( pub struct $name; + impl RelayMessenger for $name {} + $crate::__impl_ext_for_relay_chain!($name, $runtime, $new_ext); impl $crate::UmpSink for $name { @@ -131,6 +157,8 @@ macro_rules! decl_test_parachains { $( pub struct $name; + impl ParachainMessenger for $name {} + $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $new_ext); impl $crate::XcmpMessageHandler for $name { @@ -539,7 +567,7 @@ macro_rules! decl_test_networks { macro_rules! __impl_messenger_for_relay { ($network_name:ident, $relay_chain:ty) => { - impl RelayMessenger for $relay_chain { + impl $relay_chain { fn para_ids() -> Vec { <$network_name>::_para_ids() } @@ -566,7 +594,7 @@ macro_rules! __impl_messenger_for_relay { macro_rules! __impl_messenger_for_parachain { ($network_name:ident, $parachain:ty) => { - impl ParachainMessenger for $parachain { + impl $parachain { fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { From 1e3a5d4022b476272ac52460e8ef2622cff146d4 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 25 Apr 2023 13:34:18 +0200 Subject: [PATCH 06/60] messenger traits refactor --- .../xcm-emulator/common/src/lib.rs | 2 +- xcm/xcm-emulator/src/lib.rs | 70 ++++++++++++------- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 3012c3f75ad..515a5a88453 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -8,7 +8,7 @@ use frame_support::{ traits::{fungibles::Inspect, GenesisBuild}, }; use xcm::prelude::*; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, RelayMessenger, ParachainMessenger}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, Messenger, RelayMessenger, ParachainMessenger}; use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 4c2ee5df0d2..50ebb73c7eb 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -52,11 +52,7 @@ pub trait TestExt { fn execute_with(execute: impl FnOnce() -> R) -> R; } -pub trait RelayMessenger { - fn para_ids() -> Vec { Default::default() } - - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) {} - +pub trait Messenger { fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, @@ -76,32 +72,56 @@ pub trait RelayMessenger { fn process_messages() {} } +pub trait RelayMessenger: Messenger { + fn para_ids() -> Vec { Default::default() } + + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) {} + + // fn hrmp_channel_parachain_inherent_data( + // para_id: u32, + // relay_parent_number: u32, + // ) -> ParachainInherentData { + // ParachainInherentData { + // validation_data: PersistedValidationData { + // parent_head: Default::default(), + // relay_parent_number: Default::default(), + // relay_parent_storage_root: Default::default(), + // max_pov_size: Default::default(), + // }, + // relay_chain_state: StorageProof::new(Vec::new()), + // downward_messages: Default::default(), + // horizontal_messages: Default::default(), + // } + // } + + // fn process_messages() {} +} -pub trait ParachainMessenger { +pub trait ParachainMessenger: Messenger { fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) {} fn send_upward_message(from_para_id: u32, msg: Vec) {} - fn hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> ParachainInherentData { - ParachainInherentData { - validation_data: PersistedValidationData { - parent_head: Default::default(), - relay_parent_number: Default::default(), - relay_parent_storage_root: Default::default(), - max_pov_size: Default::default(), - }, - relay_chain_state: StorageProof::new(Vec::new()), - downward_messages: Default::default(), - horizontal_messages: Default::default(), - } - } - - fn process_messages() {} + // fn hrmp_channel_parachain_inherent_data( + // para_id: u32, + // relay_parent_number: u32, + // ) -> ParachainInherentData { + // ParachainInherentData { + // validation_data: PersistedValidationData { + // parent_head: Default::default(), + // relay_parent_number: Default::default(), + // relay_parent_storage_root: Default::default(), + // max_pov_size: Default::default(), + // }, + // relay_chain_state: StorageProof::new(Vec::new()), + // downward_messages: Default::default(), + // horizontal_messages: Default::default(), + // } + // } + + // fn process_messages() {} } #[macro_export] @@ -119,6 +139,7 @@ macro_rules! decl_test_relay_chains { $( pub struct $name; + impl Messenger for $name {} impl RelayMessenger for $name {} $crate::__impl_ext_for_relay_chain!($name, $runtime, $new_ext); @@ -157,6 +178,7 @@ macro_rules! decl_test_parachains { $( pub struct $name; + impl Messenger for $name {} impl ParachainMessenger for $name {} $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $new_ext); From 0fdf2151b678364669ff10da2260ab0d84f129a3 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 25 Apr 2023 13:51:35 +0200 Subject: [PATCH 07/60] declared two networks --- .../assets/statemint/tests/statemint.rs | 12 ++--- .../xcm-emulator/common/src/lib.rs | 34 +++++++++---- xcm/xcm-emulator/src/lib.rs | 48 ++----------------- 3 files changed, 36 insertions(+), 58 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs index 8bfecba5a0e..4f29278ec98 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs @@ -26,13 +26,13 @@ use xcm::{ VersionedMultiAssets, }; -use integration_tests_common::{PolkadotMockNet, Polkadot, Statemint, Penpal, constants::accounts::{ALICE, BOB}}; +use integration_tests_common::{PolkadotMockNet, Polkadot, Statemint, PenpalPolkadot, constants::accounts::{ALICE, BOB}}; pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; pub type RelayChainPalletXcm = pallet_xcm::Pallet; pub type StatemintPalletXcm = pallet_xcm::Pallet; -pub type PenpalPalletXcm = pallet_xcm::Pallet; +pub type PenpalPolkadotPalletXcm = pallet_xcm::Pallet; parameter_types! { pub StatemintLocation: MultiLocation = (Ancestor(0), Parachain(1000)).into(); @@ -49,7 +49,7 @@ fn force_xcm_version() { let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); - // Check that we can force xcm version for Statemint and Penpal from Polkadot. + // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. for location in [statemint_location, penpal_location] { assert_ok!(RelayChainPalletXcm::force_xcm_version( polkadot_runtime::RuntimeOrigin::root(), @@ -66,13 +66,13 @@ fn force_xcm_version() { } }); - // Penpal forces Polkadot xcm version. - Penpal::execute_with(|| { + // PenpalPolkadot forces Polkadot xcm version. + PenpalPolkadot::execute_with(|| { use penpal_runtime::{RuntimeEvent, System}; let location: MultiLocation = (Parent).into(); - assert_ok!(PenpalPalletXcm::force_xcm_version( + assert_ok!(PenpalPolkadotPalletXcm::force_xcm_version( penpal_runtime::RuntimeOrigin::root(), Box::new(location), xcm_version, diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 515a5a88453..a187d2c6357 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -28,13 +28,7 @@ decl_test_relay_chains! { } decl_test_parachains! { - pub struct Statemine { - Runtime = statemine_runtime::Runtime, - RuntimeOrigin = statemine_runtime::RuntimeOrigin, - XcmpMessageHandler = statemine_runtime::XcmpQueue, - DmpMessageHandler = statemine_runtime::DmpQueue, - new_ext = statemine_ext(), - }, + // Polkadot pub struct Statemint { Runtime = statemint_runtime::Runtime, RuntimeOrigin = statemint_runtime::RuntimeOrigin, @@ -42,7 +36,22 @@ decl_test_parachains! { DmpMessageHandler = statemint_runtime::DmpQueue, new_ext = statemint_ext(), }, - pub struct Penpal { + pub struct PenpalPolkadot { + Runtime = penpal_runtime::Runtime, + RuntimeOrigin = penpal_runtime::RuntimeOrigin, + XcmpMessageHandler = penpal_runtime::XcmpQueue, + DmpMessageHandler = penpal_runtime::DmpQueue, + new_ext = penpal_ext(), + }, + // Kusama + pub struct Statemine { + Runtime = statemine_runtime::Runtime, + RuntimeOrigin = statemine_runtime::RuntimeOrigin, + XcmpMessageHandler = statemine_runtime::XcmpQueue, + DmpMessageHandler = statemine_runtime::DmpQueue, + new_ext = statemine_ext(), + }, + pub struct PenpalKusama { Runtime = penpal_runtime::Runtime, RuntimeOrigin = penpal_runtime::RuntimeOrigin, XcmpMessageHandler = penpal_runtime::XcmpQueue, @@ -56,7 +65,14 @@ decl_test_networks! { relay_chain = Polkadot, parachains = vec![ (1000, Statemint), - (2000, Penpal), + (2000, PenpalPolkadot), + ], + }, + pub struct KusamaMockNet { + relay_chain = Kusama, + parachains = vec![ + (1000, Statemine), + (2000, PenpalKusama), ], } } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 50ebb73c7eb..e414fd54b87 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -76,25 +76,6 @@ pub trait RelayMessenger: Messenger { fn para_ids() -> Vec { Default::default() } fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) {} - - // fn hrmp_channel_parachain_inherent_data( - // para_id: u32, - // relay_parent_number: u32, - // ) -> ParachainInherentData { - // ParachainInherentData { - // validation_data: PersistedValidationData { - // parent_head: Default::default(), - // relay_parent_number: Default::default(), - // relay_parent_storage_root: Default::default(), - // max_pov_size: Default::default(), - // }, - // relay_chain_state: StorageProof::new(Vec::new()), - // downward_messages: Default::default(), - // horizontal_messages: Default::default(), - // } - // } - - // fn process_messages() {} } pub trait ParachainMessenger: Messenger { @@ -103,25 +84,6 @@ pub trait ParachainMessenger: Messenger { >(to_para_id: u32, iter: I) {} fn send_upward_message(from_para_id: u32, msg: Vec) {} - - // fn hrmp_channel_parachain_inherent_data( - // para_id: u32, - // relay_parent_number: u32, - // ) -> ParachainInherentData { - // ParachainInherentData { - // validation_data: PersistedValidationData { - // parent_head: Default::default(), - // relay_parent_number: Default::default(), - // relay_parent_storage_root: Default::default(), - // max_pov_size: Default::default(), - // }, - // relay_chain_state: StorageProof::new(Vec::new()), - // downward_messages: Default::default(), - // horizontal_messages: Default::default(), - // } - // } - - // fn process_messages() {} } #[macro_export] @@ -419,7 +381,7 @@ macro_rules! decl_test_networks { + ) => { $( - use $crate::{RelayBlockNumber, ParaId, ParachainInherentData}; + // use $crate::{RelayBlockNumber, ParaId, ParachainInherentData}; pub struct $name; @@ -594,14 +556,14 @@ macro_rules! __impl_messenger_for_relay { <$network_name>::_para_ids() } - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { <$network_name>::_send_downward_messages(to_para_id, iter) } fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, - ) -> ParachainInherentData { + ) -> $crate::ParachainInherentData { <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) } @@ -618,7 +580,7 @@ macro_rules! __impl_messenger_for_parachain { impl $parachain { fn send_horizontal_messages< - I: Iterator)>, + I: Iterator)>, >(to_para_id: u32, iter: I) { <$network_name>::_send_horizontal_messages(to_para_id, iter); } @@ -630,7 +592,7 @@ macro_rules! __impl_messenger_for_parachain { fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, - ) -> ParachainInherentData { + ) -> $crate::ParachainInherentData { <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) } From 8cedf418ded3cd063f66bd42cd8be8051062cc19 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Tue, 25 Apr 2023 20:44:49 +0200 Subject: [PATCH 08/60] init network approach works --- Cargo.lock | 10 ++++++ xcm/xcm-emulator/Cargo.toml | 1 + xcm/xcm-emulator/src/lib.rs | 68 ++++++++++++++++++++++++++++++------- 3 files changed, 66 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a455c4e991c..bfc1feba00c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1007,6 +1007,15 @@ dependencies = [ "thiserror", ] +[[package]] +name = "casey" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabe85130dda9cf267715582ce6cf1ab581c8dfe3cb33f7065fee0f14e3fea14" +dependencies = [ + "syn 1.0.109", +] + [[package]] name = "cast" version = "0.3.0" @@ -15306,6 +15315,7 @@ dependencies = [ name = "xcm-emulator" version = "0.1.0" dependencies = [ + "casey", "cumulus-pallet-dmp-queue", "cumulus-pallet-parachain-system", "cumulus-pallet-xcmp-queue", diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml index 6830250f7c2..9811e270074 100644 --- a/xcm/xcm-emulator/Cargo.toml +++ b/xcm/xcm-emulator/Cargo.toml @@ -9,6 +9,7 @@ edition = "2021" codec = { package = "parity-scale-codec", version = "3.0.0" } paste = "1.0.5" quote = "1.0.23" +casey = "0.3.3" frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index e414fd54b87..cff3686c717 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -16,6 +16,7 @@ pub use codec::Encode; pub use paste; +pub use casey::pascal; pub use frame_support::{ traits::{Get, Hooks}, @@ -24,7 +25,7 @@ pub use frame_support::{ pub use frame_system; pub use sp_arithmetic::traits::Bounded; pub use sp_io::TestExternalities; -pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData}; +pub use sp_std::{cell::RefCell, collections::{vec_deque::VecDeque}, marker::PhantomData}; pub use sp_trie::StorageProof; pub use cumulus_pallet_dmp_queue; @@ -45,6 +46,7 @@ pub use polkadot_runtime_parachains::{ }; pub use xcm::{v3::prelude::*, VersionedXcm}; pub use xcm_executor::XcmExecutor; +pub use std::{thread::LocalKey, collections::HashMap}; pub trait TestExt { fn new_ext() -> sp_io::TestExternalities; @@ -53,6 +55,10 @@ pub trait TestExt { } pub trait Messenger { + fn init() {} + + fn relay_block_number() -> LocalKey> { DEFAULT_RELAY_BLOCK_NUMBER } + fn hrmp_channel_parachain_inherent_data( para_id: u32, relay_parent_number: u32, @@ -202,6 +208,9 @@ macro_rules! __impl_ext_for_relay_chain { } fn execute_with(execute: impl FnOnce() -> R) -> R { + // Make sure the Network is initialized + <$name>::init(); + let r = $ext_name.with(|v| v.borrow_mut().execute_with(execute)); // send messages if needed @@ -281,16 +290,20 @@ macro_rules! __impl_ext_for_parachain { fn execute_with(execute: impl FnOnce() -> R) -> R { use $crate::{Get, Hooks}; + + // Make sure the Network is initialized + <$name>::init(); + type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; - $crate::GLOBAL_RELAY.with(|v| { + $crate::RELAY_BLOCK_NUMBER.with(|v| { *v.borrow_mut() += 1; }); $ext_name.with(|v| { v.borrow_mut().execute_with(|| { let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - $crate::GLOBAL_RELAY.with(|v| { + $crate::RELAY_BLOCK_NUMBER.with(|v| { let relay_block = *v.borrow(); let _ = ParachainSystem::set_validation_data( <$origin>::none(), @@ -328,7 +341,7 @@ macro_rules! __impl_ext_for_parachain { // send horizontal messages for msg in collation_info.horizontal_messages { - $crate::GLOBAL_RELAY.with(|v| { + $crate::RELAY_BLOCK_NUMBER.with(|v| { let relay_block = *v.borrow(); <$name>::send_horizontal_messages( msg.recipient.into(), @@ -355,10 +368,10 @@ thread_local! { #[allow(clippy::type_complexity)] pub static DOWNWARD_MESSAGES: RefCell)>)>> = RefCell::new(VecDeque::new()); - #[allow(clippy::type_complexity)] + #[allow(clippy::type_complexity)] /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` - pub static DMP_DONE: RefCell)>> - = RefCell::new(VecDeque::new()); + pub static DMP_DONE: RefCell)>>> + = RefCell::new(HashMap::new()); /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` #[allow(clippy::type_complexity)] pub static HORIZONTAL_MESSAGES: RefCell)>)>> @@ -366,7 +379,9 @@ thread_local! { /// Upward messages, each message is: `(from_para_id, msg) pub static UPWARD_MESSAGES: RefCell)>> = RefCell::new(VecDeque::new()); /// Global incremental relay chain block number - pub static GLOBAL_RELAY: RefCell = RefCell::new(1); + pub static RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); + pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); + pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); } #[macro_export] @@ -381,8 +396,6 @@ macro_rules! decl_test_networks { + ) => { $( - // use $crate::{RelayBlockNumber, ParaId, ParachainInherentData}; - pub struct $name; impl $name { @@ -395,7 +408,16 @@ macro_rules! decl_test_networks { $( <$parachain>::prepare_for_xcmp(); )* $crate::DOWNWARD_MESSAGES.with(|b| b.replace(VecDeque::new())); - $crate::DMP_DONE.with(|b| b.replace(VecDeque::new())); + $crate::DMP_DONE.with(|b| b.replace($crate::HashMap::new())); + $crate::INITIALIZED.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), false)); + } + + fn _init() { + // If Network has not been itialized yet, it gets initialized + if $crate::INITIALIZED.with(|b| b.borrow_mut().get(stringify!($name)).is_none()) { + $crate::DMP_DONE.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::INITIALIZED.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), true)); + } } fn _send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { @@ -416,6 +438,10 @@ macro_rules! decl_test_networks { vec![$( $para_id, )*] } + fn _relay_block_number() -> $crate::LocalKey<$crate::RefCell> { + $crate::RELAY_BLOCK_NUMBER + } + fn _process_messages() { while Self::_has_unprocessed_messages() { Self::_process_upward_messages(); @@ -446,12 +472,12 @@ macro_rules! decl_test_networks { msg_dedup.dedup(); let msgs = msg_dedup.clone().into_iter().filter(|m| { - !$crate::DMP_DONE.with(|b| b.borrow_mut().contains(&(to_para_id, m.0, m.1.clone()))) + !$crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap_or(&mut $crate::VecDeque::new()).contains(&(to_para_id, m.0, m.1.clone()))) }).collect::)>>(); if msgs.len() != 0 { <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); for m in msgs { - $crate::DMP_DONE.with(|b| b.borrow_mut().push_back((to_para_id, m.0, m.1))); + $crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, m.0, m.1))); } } }, @@ -552,6 +578,14 @@ macro_rules! __impl_messenger_for_relay { ($network_name:ident, $relay_chain:ty) => { impl $relay_chain { + fn init() { + <$network_name>::_init(); + } + + fn relay_block_number() -> $crate::LocalKey<$crate::RefCell> { + <$network_name>::_relay_block_number() + } + fn para_ids() -> Vec { <$network_name>::_para_ids() } @@ -579,6 +613,14 @@ macro_rules! __impl_messenger_for_parachain { ($network_name:ident, $parachain:ty) => { impl $parachain { + fn init() { + <$network_name>::_init(); + } + + fn relay_block_number() -> $crate::LocalKey<$crate::RefCell> { + <$network_name>::_relay_block_number() + } + fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { From 729f918fa900af1192a9b05a33019fcba8a83f08 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 26 Apr 2023 11:54:13 +0200 Subject: [PATCH 09/60] queues use HashMap but relay block number --- xcm/xcm-emulator/src/lib.rs | 47 ++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index cff3686c717..3d92190b748 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -366,21 +366,23 @@ macro_rules! __impl_ext_for_parachain { thread_local! { /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` #[allow(clippy::type_complexity)] - pub static DOWNWARD_MESSAGES: RefCell)>)>> - = RefCell::new(VecDeque::new()); + pub static DOWNWARD_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); #[allow(clippy::type_complexity)] /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` pub static DMP_DONE: RefCell)>>> = RefCell::new(HashMap::new()); /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` #[allow(clippy::type_complexity)] - pub static HORIZONTAL_MESSAGES: RefCell)>)>> - = RefCell::new(VecDeque::new()); + pub static HORIZONTAL_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); /// Upward messages, each message is: `(from_para_id, msg) - pub static UPWARD_MESSAGES: RefCell)>> = RefCell::new(VecDeque::new()); + pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); /// Global incremental relay chain block number - pub static RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); - pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); + // pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); + pub static RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); + pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); + // pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); } @@ -407,31 +409,38 @@ macro_rules! decl_test_networks { $( <$parachain>::prepare_for_xcmp(); )* - $crate::DOWNWARD_MESSAGES.with(|b| b.replace(VecDeque::new())); + $crate::INITIALIZED.with(|b| b.replace($crate::HashMap::new())); + $crate::DOWNWARD_MESSAGES.with(|b| b.replace($crate::HashMap::new())); $crate::DMP_DONE.with(|b| b.replace($crate::HashMap::new())); - $crate::INITIALIZED.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), false)); + $crate::UPWARD_MESSAGES.with(|b| b.replace($crate::HashMap::new())); + $crate::HORIZONTAL_MESSAGES.with(|b| b.replace($crate::HashMap::new())); + // $crate::RELAY_BLOCK_NUMBER.with(|b| b.replace($crate::HashMap::new())); } fn _init() { // If Network has not been itialized yet, it gets initialized if $crate::INITIALIZED.with(|b| b.borrow_mut().get(stringify!($name)).is_none()) { - $crate::DMP_DONE.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::INITIALIZED.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), true)); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::DMP_DONE.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + // $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); } } fn _send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, iter.collect()))); } fn _send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { - $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().push_back((to_para_id, iter.collect()))); + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, iter.collect()))); } fn _send_upward_message(from_para_id: u32, msg: Vec) { - $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().push_back((from_para_id, msg))); + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((from_para_id, msg))); } fn _para_ids() -> Vec { @@ -451,9 +460,9 @@ macro_rules! decl_test_networks { } fn _has_unprocessed_messages() -> bool { - $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().is_empty()) - || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().is_empty()) + $crate::DOWNWARD_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) + || $crate::HORIZONTAL_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) + || $crate::UPWARD_MESSAGES.with(|b| !b.borrow_mut().get_mut(stringify!($name)).unwrap().is_empty()) } fn _process_downward_messages() { @@ -461,7 +470,7 @@ macro_rules! decl_test_networks { use polkadot_parachain::primitives::RelayChainBlockNumber; while let Some((to_para_id, messages)) - = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { match to_para_id { $( $para_id => { @@ -491,7 +500,7 @@ macro_rules! decl_test_networks { use $crate::{XcmpMessageHandler, Bounded}; while let Some((to_para_id, messages)) - = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); match to_para_id { $( @@ -506,7 +515,7 @@ macro_rules! decl_test_networks { fn _process_upward_messages() { use $crate::{UmpSink, Bounded}; - while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().pop_front()) { + while let Some((from_para_id, msg)) = $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { let _ = <$relay_chain>::process_upward_message( from_para_id.into(), &msg[..], From b45cc42801cbc9a36667a455d2aaac4d7a090915 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 26 Apr 2023 13:21:55 +0200 Subject: [PATCH 10/60] init and reset refactor --- xcm/xcm-emulator/src/lib.rs | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 3d92190b748..ca6d1666b9b 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -55,9 +55,11 @@ pub trait TestExt { } pub trait Messenger { + fn network_name() -> String { Default::default() } + fn init() {} - fn relay_block_number() -> LocalKey> { DEFAULT_RELAY_BLOCK_NUMBER } + fn relay_block_number() -> LocalKey> { RELAY_BLOCK_NUMBER } fn hrmp_channel_parachain_inherent_data( para_id: u32, @@ -78,6 +80,7 @@ pub trait Messenger { fn process_messages() {} } + pub trait RelayMessenger: Messenger { fn para_ids() -> Vec { Default::default() } @@ -381,7 +384,7 @@ thread_local! { /// Global incremental relay chain block number // pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); pub static RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); - pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); + // pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); // pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); } @@ -409,12 +412,16 @@ macro_rules! decl_test_networks { $( <$parachain>::prepare_for_xcmp(); )* - $crate::INITIALIZED.with(|b| b.replace($crate::HashMap::new())); - $crate::DOWNWARD_MESSAGES.with(|b| b.replace($crate::HashMap::new())); - $crate::DMP_DONE.with(|b| b.replace($crate::HashMap::new())); - $crate::UPWARD_MESSAGES.with(|b| b.replace($crate::HashMap::new())); - $crate::HORIZONTAL_MESSAGES.with(|b| b.replace($crate::HashMap::new())); - // $crate::RELAY_BLOCK_NUMBER.with(|b| b.replace($crate::HashMap::new())); + $crate::INITIALIZED.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); + $crate::DMP_DONE.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); + // $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); + } + + fn _network_name() -> String { + stringify!($name).to_string() } fn _init() { @@ -587,6 +594,10 @@ macro_rules! __impl_messenger_for_relay { ($network_name:ident, $relay_chain:ty) => { impl $relay_chain { + fn network_name() -> String { + <$network_name>::_network_name() + } + fn init() { <$network_name>::_init(); } @@ -622,6 +633,10 @@ macro_rules! __impl_messenger_for_parachain { ($network_name:ident, $parachain:ty) => { impl $parachain { + fn network_name() -> String { + <$network_name>::_network_name() + } + fn init() { <$network_name>::_init(); } From 19f775d47636db2ba253d0a397c1d669c8bd6d69 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 26 Apr 2023 13:32:08 +0200 Subject: [PATCH 11/60] messengers trait name changed --- .../xcm-emulator/common/src/lib.rs | 2 +- xcm/xcm-emulator/src/lib.rs | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index a187d2c6357..287233cc6ad 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -8,7 +8,7 @@ use frame_support::{ traits::{fungibles::Inspect, GenesisBuild}, }; use xcm::prelude::*; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, Messenger, RelayMessenger, ParachainMessenger}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, Network, Relay, Parachain}; use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index ca6d1666b9b..ae2bd230683 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -54,7 +54,7 @@ pub trait TestExt { fn execute_with(execute: impl FnOnce() -> R) -> R; } -pub trait Messenger { +pub trait Network { fn network_name() -> String { Default::default() } fn init() {} @@ -81,13 +81,13 @@ pub trait Messenger { fn process_messages() {} } -pub trait RelayMessenger: Messenger { +pub trait Relay: Network { fn para_ids() -> Vec { Default::default() } fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) {} } -pub trait ParachainMessenger: Messenger { +pub trait Parachain: Network { fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) {} @@ -110,8 +110,8 @@ macro_rules! decl_test_relay_chains { $( pub struct $name; - impl Messenger for $name {} - impl RelayMessenger for $name {} + impl Network for $name {} + impl Relay for $name {} $crate::__impl_ext_for_relay_chain!($name, $runtime, $new_ext); @@ -149,8 +149,8 @@ macro_rules! decl_test_parachains { $( pub struct $name; - impl Messenger for $name {} - impl ParachainMessenger for $name {} + impl Network for $name {} + impl Parachain for $name {} $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $new_ext); From 769ecf4b0904b6678896c80bcace23aab20a476e Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 26 Apr 2023 15:57:38 +0200 Subject: [PATCH 12/60] relay block number suboptimal --- xcm/xcm-emulator/src/lib.rs | 42 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index ae2bd230683..12ddb8c22c9 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -59,7 +59,7 @@ pub trait Network { fn init() {} - fn relay_block_number() -> LocalKey> { RELAY_BLOCK_NUMBER } + fn relay_block_number() -> &'static LocalKey>> { &RELAY_BLOCK_NUMBER } fn hrmp_channel_parachain_inherent_data( para_id: u32, @@ -299,18 +299,26 @@ macro_rules! __impl_ext_for_parachain { type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; - $crate::RELAY_BLOCK_NUMBER.with(|v| { - *v.borrow_mut() += 1; + let network_name = <$name>::network_name(); + + println!("{:?}", network_name); + <$name>::relay_block_number().with(|v| { + println!("{:?}", *v.borrow().get(&network_name).unwrap()); + }); + + <$name>::relay_block_number().with(|v| { + *v.borrow_mut().get_mut(&network_name).unwrap() += 1; }); $ext_name.with(|v| { v.borrow_mut().execute_with(|| { let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - $crate::RELAY_BLOCK_NUMBER.with(|v| { - let relay_block = *v.borrow(); + <$name>::relay_block_number().with(|v| { + let relay_block_number = *v.borrow().get(&network_name).unwrap(); + // let relay_block_number = *hash_map.get(stringify!($name)).unwrap(); let _ = ParachainSystem::set_validation_data( <$origin>::none(), - <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), relay_block), + <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), relay_block_number), ); }); }) @@ -344,11 +352,11 @@ macro_rules! __impl_ext_for_parachain { // send horizontal messages for msg in collation_info.horizontal_messages { - $crate::RELAY_BLOCK_NUMBER.with(|v| { - let relay_block = *v.borrow(); + <$name>::relay_block_number().with(|v| { + let relay_block_number = *v.borrow().get(&network_name).unwrap(); <$name>::send_horizontal_messages( msg.recipient.into(), - vec![(para_id.into(), relay_block, msg.data)].into_iter(), + vec![(para_id.into(), relay_block_number, msg.data)].into_iter(), ); }); } @@ -382,8 +390,8 @@ thread_local! { /// Upward messages, each message is: `(from_para_id, msg) pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); /// Global incremental relay chain block number - // pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); - pub static RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); + pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); + // pub static RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); // pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); // pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); @@ -417,7 +425,7 @@ macro_rules! decl_test_networks { $crate::DMP_DONE.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); - // $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); } fn _network_name() -> String { @@ -432,7 +440,7 @@ macro_rules! decl_test_networks { $crate::DMP_DONE.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); - // $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); + $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), 1)); } } @@ -454,8 +462,8 @@ macro_rules! decl_test_networks { vec![$( $para_id, )*] } - fn _relay_block_number() -> $crate::LocalKey<$crate::RefCell> { - $crate::RELAY_BLOCK_NUMBER + fn _relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + &$crate::RELAY_BLOCK_NUMBER } fn _process_messages() { @@ -602,7 +610,7 @@ macro_rules! __impl_messenger_for_relay { <$network_name>::_init(); } - fn relay_block_number() -> $crate::LocalKey<$crate::RefCell> { + fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { <$network_name>::_relay_block_number() } @@ -641,7 +649,7 @@ macro_rules! __impl_messenger_for_parachain { <$network_name>::_init(); } - fn relay_block_number() -> $crate::LocalKey<$crate::RefCell> { + fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { <$network_name>::_relay_block_number() } From 38cf3d944ac919c734cdfd95d14bd49b15f50f2b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 26 Apr 2023 17:01:49 +0200 Subject: [PATCH 13/60] fix reset hashmap keys --- xcm/xcm-emulator/src/lib.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 12ddb8c22c9..3a916f45d0f 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -301,11 +301,6 @@ macro_rules! __impl_ext_for_parachain { let network_name = <$name>::network_name(); - println!("{:?}", network_name); - <$name>::relay_block_number().with(|v| { - println!("{:?}", *v.borrow().get(&network_name).unwrap()); - }); - <$name>::relay_block_number().with(|v| { *v.borrow_mut().get_mut(&network_name).unwrap() += 1; }); @@ -420,12 +415,12 @@ macro_rules! decl_test_networks { $( <$parachain>::prepare_for_xcmp(); )* - $crate::INITIALIZED.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); - $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); - $crate::DMP_DONE.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); - $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); - $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); - $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(&stringify!($name).to_string())); + $crate::INITIALIZED.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::DMP_DONE.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); + $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); } fn _network_name() -> String { From eac6a881d0eb8b7560bc03daccbf6c98ce7d382d Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 27 Apr 2023 00:04:13 +0200 Subject: [PATCH 14/60] genesis added --- Cargo.lock | 2 + .../xcm-emulator/common/Cargo.toml | 2 + .../xcm-emulator/common/src/constants.rs | 126 ++++++++++++------ .../xcm-emulator/common/src/lib.rs | 17 ++- 4 files changed, 101 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bfc1feba00c..ff930cd83ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4377,6 +4377,8 @@ dependencies = [ name = "integration-tests-common" version = "1.0.0" dependencies = [ + "cumulus-primitives-core", + "cumulus-test-service", "frame-support", "frame-system", "kusama-runtime", diff --git a/parachains/integration-tests/xcm-emulator/common/Cargo.toml b/parachains/integration-tests/xcm-emulator/common/Cargo.toml index 397c78f5e55..a1966f0a07a 100644 --- a/parachains/integration-tests/xcm-emulator/common/Cargo.toml +++ b/parachains/integration-tests/xcm-emulator/common/Cargo.toml @@ -29,6 +29,8 @@ pallet-xcm = { default-features = false, git = "https://github.com/paritytech/po # Cumulus parachains-common = { path = "../../../common" } +cumulus-test-service = { path = "../../../../test/service" } +cumulus-primitives-core = { path = "../../../../primitives/core" } penpal-runtime = { path = "../../../runtimes/testing/penpal" } statemint-runtime = { path = "../../../runtimes/assets/statemint" } statemine-runtime = { path = "../../../runtimes/assets/statemine" } diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs index fa627aa91b5..30d191faf7c 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/constants.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -1,11 +1,54 @@ pub use polkadot_runtime_parachains::configuration::HostConfiguration; -pub use parachains_common::BlockNumber; +pub use parachains_common::{BlockNumber, AccountId, Balance, StatemintAuraId}; +use cumulus_primitives_core::ParaId; +pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; +pub use xcm; +use sp_core::{crypto::UncheckedInto, sr25519}; pub mod accounts { + use super::*; pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); + + pub fn init_balances() -> Vec { + vec![ + get_account_id_from_seed::("Alice"), + get_account_id_from_seed::("Bob"), + get_account_id_from_seed::("Charlie"), + get_account_id_from_seed::("Dave"), + get_account_id_from_seed::("Eve"), + get_account_id_from_seed::("Ferdie"), + get_account_id_from_seed::("Alice//stash"), + get_account_id_from_seed::("Bob//stash"), + get_account_id_from_seed::("Charlie//stash"), + get_account_id_from_seed::("Dave//stash"), + get_account_id_from_seed::("Eve//stash"), + get_account_id_from_seed::("Ferdie//stash"), + ] + } +} + +pub mod collators { + use super::*; + + pub fn invulnerables() -> Vec<(AccountId, StatemintAuraId)> { + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_from_seed::("Bob"), + ), + ] + } } +/// The default XCM version to set in genesis config. +const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; + +// Polkadot pub mod polkadot { use super::*; @@ -21,6 +64,7 @@ pub mod polkadot { } } +// Kusama pub mod kusama { use super::*; @@ -36,42 +80,46 @@ pub mod kusama { } } -// pub const POLKADOT_HOST_CONFIG: HostConfiguration = HostConfiguration { -// max_upward_queue_count: 10, -// max_upward_queue_size: 51200, -// max_upward_message_size: 51200, -// max_upward_message_num_per_candidate: 10, -// max_downward_message_size: 51200, -// ..ConstDefault::default() -// }; - -// pub let KUSAMA_HOST_CONFIG: HostConfiguration = HostConfiguration { -// max_upward_queue_count: 10, -// max_upward_queue_size: 51200, -// max_upward_message_size: 51200, -// max_upward_message_num_per_candidate: 10, -// max_downward_message_size: 51200, -// ..Default::default() -// }; - -// pub const fn get_polkadot_host_config() -> HostConfiguration { -// HostConfiguration { -// max_upward_queue_count: 10, -// max_upward_queue_size: 51200, -// max_upward_message_size: 51200, -// max_upward_message_num_per_candidate: 10, -// max_downward_message_size: 51200, -// ..Default::default() -// } -// } +// Statemint +pub mod statemint { + use super::*; + pub const PARA_ID: u32 = 1000; + pub const ED: Balance = statemint_runtime::constants::currency::EXISTENTIAL_DEPOSIT; -// pub const fn get_kusama_host_config() -> HostConfiguration { -// HostConfiguration { -// max_upward_queue_count: 10, -// max_upward_queue_size: 51200, -// max_upward_message_size: 51200, -// max_upward_message_num_per_candidate: 10, -// max_downward_message_size: 51200, -// ..Default::default() -// } -// } + pub fn genesis() -> statemint_runtime::GenesisConfig { + statemint_runtime::GenesisConfig { + system: statemint_runtime::SystemConfig { + code: statemint_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: statemint_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + parachain_info: statemint_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: statemint_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: statemint_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + statemint_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: statemint_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + } + } +} diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 287233cc6ad..e4f6acde60e 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -12,7 +12,8 @@ use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_cha use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; -pub use constants::{polkadot, kusama, accounts::{ALICE, BOB}}; +pub use constants::{polkadot, kusama, statemint, accounts::{ALICE, BOB}}; +use sp_runtime::BuildStorage; decl_test_relay_chains! { pub struct Polkadot { @@ -125,13 +126,15 @@ pub fn relay_ext() -> sp_io::TestExternalities { pub fn statemint_ext() -> sp_io::TestExternalities { use statemint_runtime::{Runtime, System}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + let mut t = statemint::genesis().build_storage().unwrap(); - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); + // let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + + // pallet_balances::GenesisConfig:: { + // balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + // } + // .assimilate_storage(&mut t) + // .unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| { From 7c4dd4701b4260dd2c0a7147db0b011b12d76bdd Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 27 Apr 2023 14:21:46 +0200 Subject: [PATCH 15/60] test ext added for parachains --- Cargo.lock | 1 + .../xcm-emulator/common/src/constants.rs | 112 +++++++++++++++++- .../xcm-emulator/common/src/lib.rs | 33 +++++- xcm/xcm-emulator/Cargo.toml | 1 + xcm/xcm-emulator/src/lib.rs | 39 ++++-- 5 files changed, 168 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ff930cd83ff..131a22a2791 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15333,6 +15333,7 @@ dependencies = [ "polkadot-runtime-parachains", "quote", "sp-arithmetic", + "sp-core", "sp-io", "sp-std", "sp-trie", diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs index 30d191faf7c..2d902c3edbf 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/constants.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -1,5 +1,5 @@ pub use polkadot_runtime_parachains::configuration::HostConfiguration; -pub use parachains_common::{BlockNumber, AccountId, Balance, StatemintAuraId}; +pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; use cumulus_primitives_core::ParaId; pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; pub use xcm; @@ -31,7 +31,7 @@ pub mod accounts { pub mod collators { use super::*; - pub fn invulnerables() -> Vec<(AccountId, StatemintAuraId)> { + pub fn invulnerables_statemint() -> Vec<(AccountId, StatemintAuraId)> { vec![ ( get_account_id_from_seed::("Alice"), @@ -43,6 +43,19 @@ pub mod collators { ), ] } + + pub fn invulnerables() -> Vec<(AccountId, AuraId)> { + vec![ + ( + get_account_id_from_seed::("Alice"), + get_from_seed::("Alice"), + ), + ( + get_account_id_from_seed::("Bob"), + get_from_seed::("Bob"), + ), + ] + } } /// The default XCM version to set in genesis config. @@ -98,12 +111,12 @@ pub mod statemint { }, parachain_info: statemint_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, collator_selection: statemint_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: collators::invulnerables_statemint().iter().cloned().map(|(acc, _)| acc).collect(), candidacy_bond: ED * 16, ..Default::default() }, session: statemint_runtime::SessionConfig { - keys: collators::invulnerables() + keys: collators::invulnerables_statemint() .into_iter() .map(|(acc, aura)| { ( @@ -123,3 +136,94 @@ pub mod statemint { } } } + +// Statemint +pub mod statemine { + use super::*; + pub const PARA_ID: u32 = 1000; + pub const ED: Balance = statemine_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> statemine_runtime::GenesisConfig { + statemine_runtime::GenesisConfig { + system: statemine_runtime::SystemConfig { + code: statemine_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: statemine_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + parachain_info: statemine_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: statemine_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: statemine_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + statemine_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: statemine_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + } + } +} + +// Penpal +pub mod penpal { + use super::*; + pub const PARA_ID: u32 = 2000; + pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT; + + pub fn genesis(para_id: u32) -> penpal_runtime::GenesisConfig { + penpal_runtime::GenesisConfig { + system: penpal_runtime::SystemConfig { + code: penpal_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: penpal_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + parachain_info: penpal_runtime::ParachainInfoConfig { parachain_id: para_id.into() }, + collator_selection: penpal_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: penpal_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + penpal_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: penpal_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + sudo: penpal_runtime::SudoConfig { + key: Some(get_account_id_from_seed::("Alice")), + }, + } + } +} diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index e4f6acde60e..3a06f067c17 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -12,8 +12,9 @@ use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_cha use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; -pub use constants::{polkadot, kusama, statemint, accounts::{ALICE, BOB}}; +pub use constants::{polkadot, kusama, statemint, statemine, penpal, accounts::{ALICE, BOB}}; use sp_runtime::BuildStorage; +pub use sp_core::storage::Storage; decl_test_relay_chains! { pub struct Polkadot { @@ -35,6 +36,8 @@ decl_test_parachains! { RuntimeOrigin = statemint_runtime::RuntimeOrigin, XcmpMessageHandler = statemint_runtime::XcmpQueue, DmpMessageHandler = statemint_runtime::DmpQueue, + System = statemint_runtime::System, + genesis = statemint_storage(), new_ext = statemint_ext(), }, pub struct PenpalPolkadot { @@ -42,6 +45,8 @@ decl_test_parachains! { RuntimeOrigin = penpal_runtime::RuntimeOrigin, XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, + System = penpal_runtime::System, + genesis = penpal::genesis(penpal::PARA_ID).build_storage().unwrap(), new_ext = penpal_ext(), }, // Kusama @@ -50,6 +55,8 @@ decl_test_parachains! { RuntimeOrigin = statemine_runtime::RuntimeOrigin, XcmpMessageHandler = statemine_runtime::XcmpQueue, DmpMessageHandler = statemine_runtime::DmpQueue, + System = statemine_runtime::System, + genesis = statemine::genesis().build_storage().unwrap(), new_ext = statemine_ext(), }, pub struct PenpalKusama { @@ -57,6 +64,8 @@ decl_test_parachains! { RuntimeOrigin = penpal_runtime::RuntimeOrigin, XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, + System = penpal_runtime::System, + genesis = penpal::genesis(penpal::PARA_ID).build_storage().unwrap(), new_ext = penpal_ext(), } } @@ -122,6 +131,18 @@ pub fn relay_ext() -> sp_io::TestExternalities { ext } +pub fn statemint_storage() -> Storage { + use statemint_runtime::{Runtime, System}; + let mut t = statemint::genesis().build_storage().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); + + t +} // Define Statemint TestExternalities. pub fn statemint_ext() -> sp_io::TestExternalities { use statemint_runtime::{Runtime, System}; @@ -130,11 +151,11 @@ pub fn statemint_ext() -> sp_io::TestExternalities { // let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - // pallet_balances::GenesisConfig:: { - // balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - // } - // .assimilate_storage(&mut t) - // .unwrap(); + pallet_balances::GenesisConfig:: { + balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], + } + .assimilate_storage(&mut t) + .unwrap(); let mut ext = sp_io::TestExternalities::new(t); ext.execute_with(|| { diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml index 9811e270074..83d31d2aea7 100644 --- a/xcm/xcm-emulator/Cargo.toml +++ b/xcm/xcm-emulator/Cargo.toml @@ -14,6 +14,7 @@ casey = "0.3.3" frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } +sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 3a916f45d0f..bf85315c6cd 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -21,12 +21,14 @@ pub use casey::pascal; pub use frame_support::{ traits::{Get, Hooks}, weights::Weight, + sp_runtime::BuildStorage, }; pub use frame_system; pub use sp_arithmetic::traits::Bounded; pub use sp_io::TestExternalities; pub use sp_std::{cell::RefCell, collections::{vec_deque::VecDeque}, marker::PhantomData}; pub use sp_trie::StorageProof; +pub use sp_core::storage::Storage; pub use cumulus_pallet_dmp_queue; pub use cumulus_pallet_parachain_system; @@ -49,6 +51,7 @@ pub use xcm_executor::XcmExecutor; pub use std::{thread::LocalKey, collections::HashMap}; pub trait TestExt { + fn build_new_ext(storage: Storage) -> sp_io::TestExternalities; fn new_ext() -> sp_io::TestExternalities; fn reset_ext(); fn execute_with(execute: impl FnOnce() -> R) -> R; @@ -141,6 +144,8 @@ macro_rules! decl_test_parachains { RuntimeOrigin = $origin:path, XcmpMessageHandler = $xcmp_message_handler:path, DmpMessageHandler = $dmp_message_handler:path, + System = $system:path, + genesis = $genesis:expr, new_ext = $new_ext:expr, } ), @@ -152,7 +157,7 @@ macro_rules! decl_test_parachains { impl Network for $name {} impl Parachain for $name {} - $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $new_ext); + $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $system, $genesis, $new_ext); impl $crate::XcmpMessageHandler for $name { fn handle_xcmp_messages< @@ -202,6 +207,16 @@ macro_rules! __impl_ext_for_relay_chain { } impl $crate::TestExt for $name { + fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { + // let mut ext = sp_io::TestExternalities::new(storage); + // ext.execute_with(|| { + // sp_tracing::try_init_simple(); + // <$system>::set_block_number(1); + // }); + // ext + $new_ext + } + fn new_ext() -> $crate::TestExternalities { $new_ext } @@ -249,16 +264,17 @@ macro_rules! __impl_ext_for_relay_chain { #[macro_export] macro_rules! __impl_ext_for_parachain { // entry point: generate ext name - ($name:ident, $runtime:path, $origin:path, $new_ext:expr) => { + ($name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $new_ext:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $new_ext, []); + $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $system, $genesis, $new_ext, []); } }; // impl - (@impl $name:ident, $runtime:path, $origin:path, $new_ext:expr, $ext_name:ident) => { + (@impl $name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $new_ext:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> - = $crate::RefCell::new($new_ext); + // = $crate::RefCell::new($new_ext); + = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } impl $name { @@ -283,6 +299,15 @@ macro_rules! __impl_ext_for_parachain { } impl $crate::TestExt for $name { + fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + <$system>::set_block_number(1); + }); + ext + } + fn new_ext() -> $crate::TestExternalities { $new_ext } @@ -386,9 +411,7 @@ thread_local! { pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); /// Global incremental relay chain block number pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); - // pub static RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); - // pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell = RefCell::new(1); // RefCell::new(1); - // pub static DEFAULT_RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); + /// Flag indicating if global variables have been initialized for a certain Network pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); } From 0490ab670a0f7e44e8db5cdd3873bb12ce04a6fd Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 27 Apr 2023 18:18:23 +0200 Subject: [PATCH 16/60] genesis added relay chains --- Cargo.lock | 9 + .../xcm-emulator/common/Cargo.toml | 9 + .../xcm-emulator/common/src/constants.rs | 189 ++++++++++++++++++ .../xcm-emulator/common/src/lib.rs | 23 ++- xcm/xcm-emulator/src/lib.rs | 37 ++-- 5 files changed, 251 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 131a22a2791..6688d16450e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4382,16 +4382,25 @@ dependencies = [ "frame-support", "frame-system", "kusama-runtime", + "kusama-runtime-constants", "pallet-assets", "pallet-balances", + "pallet-im-online", + "pallet-staking", "pallet-xcm", "parachains-common", "parity-scale-codec", "penpal-runtime", "polkadot-core-primitives", "polkadot-parachain", + "polkadot-primitives", "polkadot-runtime", + "polkadot-runtime-constants", "polkadot-runtime-parachains", + "polkadot-service", + "sc-consensus-grandpa", + "sp-authority-discovery", + "sp-consensus-babe", "sp-core", "sp-runtime", "sp-weights", diff --git a/parachains/integration-tests/xcm-emulator/common/Cargo.toml b/parachains/integration-tests/xcm-emulator/common/Cargo.toml index a1966f0a07a..085907a78d3 100644 --- a/parachains/integration-tests/xcm-emulator/common/Cargo.toml +++ b/parachains/integration-tests/xcm-emulator/common/Cargo.toml @@ -9,20 +9,29 @@ description = "Common resources for integration testing with xcm-emulator" codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } # Substrate +grandpa = { package = "sc-consensus-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" } +sp-authority-discovery = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +sp-consensus-babe = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-staking = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-im-online = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } # Polkadot polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-service = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } polkadot-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +polkadot-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } +kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", branch = "master" } xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs index 2d902c3edbf..017176a158d 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/constants.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -1,9 +1,16 @@ pub use polkadot_runtime_parachains::configuration::HostConfiguration; +use polkadot_primitives::{AccountPublic, AssignmentId, ValidatorId}; pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; use cumulus_primitives_core::ParaId; pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; pub use xcm; +use grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; +use sp_runtime::{Perbill}; +use sp_consensus_babe::AuthorityId as BabeId; +use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; +use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; +use pallet_im_online::sr25519::AuthorityId as ImOnlineId; pub mod accounts { use super::*; @@ -58,12 +65,31 @@ pub mod collators { } } +pub mod validators { + use super::*; + + pub fn initial_authorities() -> Vec<( + AccountId, + AccountId, + BabeId, + GrandpaId, + ImOnlineId, + ValidatorId, + AssignmentId, + AuthorityDiscoveryId, + )> { + vec![get_authority_keys_from_seed_no_beefy("Alice")] + } +} + /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; // Polkadot pub mod polkadot { use super::*; + pub const ED: Balance = polkadot_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + const STASH: u128 = 100 * polkadot_runtime_constants::currency::UNITS; pub fn get_host_config() -> HostConfiguration { HostConfiguration { @@ -75,11 +101,97 @@ pub mod polkadot { ..Default::default() } } + + fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + ) -> polkadot_runtime::SessionKeys { + polkadot_runtime::SessionKeys { + babe, + grandpa, + im_online, + para_validator, + para_assignment, + authority_discovery, + } + } + + pub fn genesis() -> polkadot_runtime::GenesisConfig { + polkadot_runtime::GenesisConfig { + system: polkadot_runtime::SystemConfig { code: polkadot_runtime::WASM_BINARY.unwrap().to_vec() }, + balances: polkadot_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + indices: polkadot_runtime::IndicesConfig { indices: vec![] }, + session: polkadot_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + polkadot::session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + staking: polkadot_runtime::StakingConfig { + validator_count: validators::initial_authorities().len() as u32, + minimum_validator_count: 1, + stakers: validators::initial_authorities() + .iter() + .map(|x| (x.0.clone(), x.1.clone(), STASH, polkadot_runtime::StakerStatus::Validator)) + .collect(), + invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(), + force_era: pallet_staking::Forcing::ForceNone, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }, + phragmen_election: Default::default(), + democracy: Default::default(), + council: polkadot_runtime::CouncilConfig { members: vec![], phantom: Default::default() }, + technical_committee: polkadot_runtime::TechnicalCommitteeConfig { + members: vec![], + phantom: Default::default(), + }, + technical_membership: Default::default(), + babe: polkadot_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(polkadot_runtime::BABE_GENESIS_EPOCH_CONFIG), + }, + grandpa: Default::default(), + im_online: Default::default(), + authority_discovery: polkadot_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + claims: polkadot_runtime::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: polkadot_runtime::VestingConfig { vesting: vec![] }, + treasury: Default::default(), + hrmp: Default::default(), + configuration: polkadot_runtime::ConfigurationConfig { + config: get_host_config(), + }, + paras: Default::default(), + xcm_pallet: Default::default(), + nomination_pools: Default::default(), + } + } } // Kusama pub mod kusama { use super::*; + pub const ED: Balance = kusama_runtime_constants::currency::EXISTENTIAL_DEPOSIT; + const STASH: u128 = 100 * kusama_runtime_constants::currency::UNITS; pub fn get_host_config() -> HostConfiguration { HostConfiguration { @@ -91,6 +203,83 @@ pub mod kusama { ..Default::default() } } + + fn session_keys( + babe: BabeId, + grandpa: GrandpaId, + im_online: ImOnlineId, + para_validator: ValidatorId, + para_assignment: AssignmentId, + authority_discovery: AuthorityDiscoveryId, + ) -> kusama_runtime::SessionKeys { + kusama_runtime::SessionKeys { + babe, + grandpa, + im_online, + para_validator, + para_assignment, + authority_discovery, + } + } + + pub fn genesis() -> kusama_runtime::GenesisConfig { + kusama_runtime::GenesisConfig { + system: kusama_runtime::SystemConfig { code: kusama_runtime::WASM_BINARY.unwrap().to_vec() }, + balances: kusama_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + indices: kusama_runtime::IndicesConfig { indices: vec![] }, + session: kusama_runtime::SessionConfig { + keys: validators::initial_authorities() + .iter() + .map(|x| { + ( + x.0.clone(), + x.0.clone(), + kusama::session_keys( + x.2.clone(), + x.3.clone(), + x.4.clone(), + x.5.clone(), + x.6.clone(), + x.7.clone(), + ), + ) + }) + .collect::>(), + }, + staking: kusama_runtime::StakingConfig { + minimum_validator_count: 1, + validator_count: validators::initial_authorities().len() as u32, + stakers: validators::initial_authorities() + .iter() + .map(|x| (x.0.clone(), x.1.clone(), STASH, kusama_runtime::StakerStatus::Validator)) + .collect(), + invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(), + force_era: pallet_staking::Forcing::NotForcing, + slash_reward_fraction: Perbill::from_percent(10), + ..Default::default() + }, + babe: kusama_runtime::BabeConfig { + authorities: Default::default(), + epoch_config: Some(kusama_runtime::BABE_GENESIS_EPOCH_CONFIG), + }, + grandpa: Default::default(), + im_online: Default::default(), + authority_discovery: kusama_runtime::AuthorityDiscoveryConfig { keys: vec![] }, + claims: kusama_runtime::ClaimsConfig { claims: vec![], vesting: vec![] }, + vesting: kusama_runtime::VestingConfig { vesting: vec![] }, + treasury: Default::default(), + hrmp: Default::default(), + configuration: kusama_runtime::ConfigurationConfig { + config: get_host_config(), + }, + paras: Default::default(), + xcm_pallet: Default::default(), + nomination_pools: Default::default(), + nis_counterpart_balances: Default::default(), + } + } } // Statemint diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 3a06f067c17..98d0c2b591e 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -20,11 +20,15 @@ decl_test_relay_chains! { pub struct Polkadot { Runtime = polkadot_runtime::Runtime, XcmConfig = polkadot_runtime::xcm_config::XcmConfig, + System = statemint_runtime::System, + genesis = polkadot_storage(), new_ext = relay_ext(), }, pub struct Kusama { Runtime = kusama_runtime::Runtime, XcmConfig = kusama_runtime::xcm_config::XcmConfig, + System = kusama_runtime::System, + genesis = kusama::genesis().build_storage().unwrap(), new_ext = relay_ext(), } } @@ -131,8 +135,25 @@ pub fn relay_ext() -> sp_io::TestExternalities { ext } +pub fn polkadot_storage() -> Storage { + use polkadot_runtime::{Runtime}; + let mut t = polkadot::genesis().build_storage().unwrap(); + + pallet_balances::GenesisConfig:: { + balances: vec![ + (ALICE, INITIAL_BALANCE), + (child_account_id(1000), INITIAL_BALANCE), + (child_account_id(2000), INITIAL_BALANCE), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + t +} + pub fn statemint_storage() -> Storage { - use statemint_runtime::{Runtime, System}; + use statemint_runtime::{Runtime}; let mut t = statemint::genesis().build_storage().unwrap(); pallet_balances::GenesisConfig:: { diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index bf85315c6cd..63edf764f17 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -105,6 +105,8 @@ macro_rules! decl_test_relay_chains { pub struct $name:ident { Runtime = $runtime:path, XcmConfig = $xcm_config:path, + System = $system:path, + genesis = $genesis:expr, new_ext = $new_ext:expr, } ), @@ -116,7 +118,7 @@ macro_rules! decl_test_relay_chains { impl Network for $name {} impl Relay for $name {} - $crate::__impl_ext_for_relay_chain!($name, $runtime, $new_ext); + $crate::__impl_ext_for_relay_chain!($name, $runtime, $system, $genesis, $new_ext); impl $crate::UmpSink for $name { fn process_upward_message( @@ -194,31 +196,30 @@ macro_rules! decl_test_parachains { #[macro_export] macro_rules! __impl_ext_for_relay_chain { // entry point: generate ext name - ($name:ident, $runtime:path, $new_ext:expr) => { + ($name:ident, $runtime:path, $system:path, $genesis:expr, $new_ext:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_relay_chain!(@impl $name, $runtime, $new_ext, []); + $crate::__impl_ext_for_relay_chain!(@impl $name, $runtime, $system, $genesis, $new_ext, []); } }; // impl - (@impl $name:ident, $runtime:path, $new_ext:expr, $ext_name:ident) => { + (@impl $name:ident, $runtime:path, $system:path, $genesis:expr, $new_ext:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> - = $crate::RefCell::new($new_ext); + = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } impl $crate::TestExt for $name { fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { - // let mut ext = sp_io::TestExternalities::new(storage); - // ext.execute_with(|| { - // sp_tracing::try_init_simple(); - // <$system>::set_block_number(1); - // }); - // ext - $new_ext + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| { + sp_tracing::try_init_simple(); + <$system>::set_block_number(1); + }); + ext } fn new_ext() -> $crate::TestExternalities { - $new_ext + <$name>::build_new_ext($genesis) } fn reset_ext() { @@ -273,7 +274,6 @@ macro_rules! __impl_ext_for_parachain { (@impl $name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $new_ext:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> - // = $crate::RefCell::new($new_ext); = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } @@ -309,7 +309,7 @@ macro_rules! __impl_ext_for_parachain { } fn new_ext() -> $crate::TestExternalities { - $new_ext + <$name>::build_new_ext($genesis) } fn reset_ext() { @@ -694,3 +694,10 @@ macro_rules! __impl_messenger_for_parachain { } } } + +#[macro_export] +macro_rules! bx { + ($e:expr) => { + Box::new($e) + }; +} From edb86844162c1f23f17e1249fbe2cf4899e39aa0 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 27 Apr 2023 18:33:13 +0200 Subject: [PATCH 17/60] genesis to storage --- .../xcm-emulator/common/src/constants.rs | 44 ++++++++++++------- .../xcm-emulator/common/src/lib.rs | 12 ++--- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs index 017176a158d..4b3039a66a9 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/constants.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -5,8 +5,8 @@ use cumulus_primitives_core::ParaId; pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; pub use xcm; use grandpa::AuthorityId as GrandpaId; -use sp_core::{crypto::UncheckedInto, sr25519}; -use sp_runtime::{Perbill}; +use sp_core::{crypto::UncheckedInto, sr25519, storage::Storage}; +use sp_runtime::{Perbill, BuildStorage}; use sp_consensus_babe::AuthorityId as BabeId; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; @@ -120,8 +120,8 @@ pub mod polkadot { } } - pub fn genesis() -> polkadot_runtime::GenesisConfig { - polkadot_runtime::GenesisConfig { + pub fn genesis() -> Storage { + let genesis_config = polkadot_runtime::GenesisConfig { system: polkadot_runtime::SystemConfig { code: polkadot_runtime::WASM_BINARY.unwrap().to_vec() }, balances: polkadot_runtime::BalancesConfig { balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), @@ -183,7 +183,9 @@ pub mod polkadot { paras: Default::default(), xcm_pallet: Default::default(), nomination_pools: Default::default(), - } + }; + + genesis_config.build_storage().unwrap() } } @@ -222,8 +224,8 @@ pub mod kusama { } } - pub fn genesis() -> kusama_runtime::GenesisConfig { - kusama_runtime::GenesisConfig { + pub fn genesis() -> Storage { + let genesis_config = kusama_runtime::GenesisConfig { system: kusama_runtime::SystemConfig { code: kusama_runtime::WASM_BINARY.unwrap().to_vec() }, balances: kusama_runtime::BalancesConfig { balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), @@ -278,7 +280,9 @@ pub mod kusama { xcm_pallet: Default::default(), nomination_pools: Default::default(), nis_counterpart_balances: Default::default(), - } + }; + + genesis_config.build_storage().unwrap() } } @@ -288,8 +292,8 @@ pub mod statemint { pub const PARA_ID: u32 = 1000; pub const ED: Balance = statemint_runtime::constants::currency::EXISTENTIAL_DEPOSIT; - pub fn genesis() -> statemint_runtime::GenesisConfig { - statemint_runtime::GenesisConfig { + pub fn genesis() -> Storage { + let genesis_config = statemint_runtime::GenesisConfig { system: statemint_runtime::SystemConfig { code: statemint_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") @@ -322,7 +326,9 @@ pub mod statemint { polkadot_xcm: statemint_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, - } + }; + + genesis_config.build_storage().unwrap() } } @@ -332,8 +338,8 @@ pub mod statemine { pub const PARA_ID: u32 = 1000; pub const ED: Balance = statemine_runtime::constants::currency::EXISTENTIAL_DEPOSIT; - pub fn genesis() -> statemine_runtime::GenesisConfig { - statemine_runtime::GenesisConfig { + pub fn genesis() -> Storage { + let genesis_config = statemine_runtime::GenesisConfig { system: statemine_runtime::SystemConfig { code: statemine_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") @@ -366,7 +372,9 @@ pub mod statemine { polkadot_xcm: statemine_runtime::PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), }, - } + }; + + genesis_config.build_storage().unwrap() } } @@ -376,8 +384,8 @@ pub mod penpal { pub const PARA_ID: u32 = 2000; pub const ED: Balance = penpal_runtime::EXISTENTIAL_DEPOSIT; - pub fn genesis(para_id: u32) -> penpal_runtime::GenesisConfig { - penpal_runtime::GenesisConfig { + pub fn genesis(para_id: u32) -> Storage { + let genesis_config = penpal_runtime::GenesisConfig { system: penpal_runtime::SystemConfig { code: penpal_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") @@ -413,6 +421,8 @@ pub mod penpal { sudo: penpal_runtime::SudoConfig { key: Some(get_account_id_from_seed::("Alice")), }, - } + }; + + genesis_config.build_storage().unwrap() } } diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 98d0c2b591e..69a93b31e57 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -28,7 +28,7 @@ decl_test_relay_chains! { Runtime = kusama_runtime::Runtime, XcmConfig = kusama_runtime::xcm_config::XcmConfig, System = kusama_runtime::System, - genesis = kusama::genesis().build_storage().unwrap(), + genesis = kusama::genesis(), new_ext = relay_ext(), } } @@ -50,7 +50,7 @@ decl_test_parachains! { XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, - genesis = penpal::genesis(penpal::PARA_ID).build_storage().unwrap(), + genesis = penpal::genesis(penpal::PARA_ID), new_ext = penpal_ext(), }, // Kusama @@ -60,7 +60,7 @@ decl_test_parachains! { XcmpMessageHandler = statemine_runtime::XcmpQueue, DmpMessageHandler = statemine_runtime::DmpQueue, System = statemine_runtime::System, - genesis = statemine::genesis().build_storage().unwrap(), + genesis = statemine::genesis(), new_ext = statemine_ext(), }, pub struct PenpalKusama { @@ -69,7 +69,7 @@ decl_test_parachains! { XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, - genesis = penpal::genesis(penpal::PARA_ID).build_storage().unwrap(), + genesis = penpal::genesis(penpal::PARA_ID), new_ext = penpal_ext(), } } @@ -137,7 +137,7 @@ pub fn relay_ext() -> sp_io::TestExternalities { pub fn polkadot_storage() -> Storage { use polkadot_runtime::{Runtime}; - let mut t = polkadot::genesis().build_storage().unwrap(); + let mut t = polkadot::genesis(); pallet_balances::GenesisConfig:: { balances: vec![ @@ -154,7 +154,7 @@ pub fn polkadot_storage() -> Storage { pub fn statemint_storage() -> Storage { use statemint_runtime::{Runtime}; - let mut t = statemint::genesis().build_storage().unwrap(); + let mut t = statemint::genesis(); pallet_balances::GenesisConfig:: { balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], From 3a99e0360ddd75ceadfb649582d7c65143ab05a7 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 4 May 2023 12:34:14 +0200 Subject: [PATCH 18/60] new_ext replaced by on_init --- .../xcm-emulator/common/src/lib.rs | 18 ++++++++----- xcm/xcm-emulator/src/lib.rs | 26 ++++++++++--------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 69a93b31e57..0a43dfb8728 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -20,16 +20,16 @@ decl_test_relay_chains! { pub struct Polkadot { Runtime = polkadot_runtime::Runtime, XcmConfig = polkadot_runtime::xcm_config::XcmConfig, - System = statemint_runtime::System, + System = polkadot_runtime::System, genesis = polkadot_storage(), - new_ext = relay_ext(), + on_init = (), }, pub struct Kusama { Runtime = kusama_runtime::Runtime, XcmConfig = kusama_runtime::xcm_config::XcmConfig, System = kusama_runtime::System, genesis = kusama::genesis(), - new_ext = relay_ext(), + on_init = (), } } @@ -42,7 +42,7 @@ decl_test_parachains! { DmpMessageHandler = statemint_runtime::DmpQueue, System = statemint_runtime::System, genesis = statemint_storage(), - new_ext = statemint_ext(), + on_init = (), }, pub struct PenpalPolkadot { Runtime = penpal_runtime::Runtime, @@ -51,7 +51,7 @@ decl_test_parachains! { DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, genesis = penpal::genesis(penpal::PARA_ID), - new_ext = penpal_ext(), + on_init = (), }, // Kusama pub struct Statemine { @@ -61,7 +61,7 @@ decl_test_parachains! { DmpMessageHandler = statemine_runtime::DmpQueue, System = statemine_runtime::System, genesis = statemine::genesis(), - new_ext = statemine_ext(), + on_init = (), }, pub struct PenpalKusama { Runtime = penpal_runtime::Runtime, @@ -70,7 +70,7 @@ decl_test_parachains! { DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, genesis = penpal::genesis(penpal::PARA_ID), - new_ext = penpal_ext(), + on_init = (), } } @@ -91,6 +91,10 @@ decl_test_networks! { } } +// pub fn on_init() { +// polkadot_runtime::System::set_block_number(1); +// } + pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 63edf764f17..97bcd0b08f5 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -107,7 +107,7 @@ macro_rules! decl_test_relay_chains { XcmConfig = $xcm_config:path, System = $system:path, genesis = $genesis:expr, - new_ext = $new_ext:expr, + on_init = $on_init:expr, } ), + @@ -118,7 +118,7 @@ macro_rules! decl_test_relay_chains { impl Network for $name {} impl Relay for $name {} - $crate::__impl_ext_for_relay_chain!($name, $runtime, $system, $genesis, $new_ext); + $crate::__impl_ext_for_relay_chain!($name, $runtime, $system, $genesis, $on_init); impl $crate::UmpSink for $name { fn process_upward_message( @@ -148,7 +148,7 @@ macro_rules! decl_test_parachains { DmpMessageHandler = $dmp_message_handler:path, System = $system:path, genesis = $genesis:expr, - new_ext = $new_ext:expr, + on_init = $on_init:expr, } ), + @@ -159,7 +159,7 @@ macro_rules! decl_test_parachains { impl Network for $name {} impl Parachain for $name {} - $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $system, $genesis, $new_ext); + $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $system, $genesis, $on_init); impl $crate::XcmpMessageHandler for $name { fn handle_xcmp_messages< @@ -196,13 +196,13 @@ macro_rules! decl_test_parachains { #[macro_export] macro_rules! __impl_ext_for_relay_chain { // entry point: generate ext name - ($name:ident, $runtime:path, $system:path, $genesis:expr, $new_ext:expr) => { + ($name:ident, $runtime:path, $system:path, $genesis:expr, $on_init:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_relay_chain!(@impl $name, $runtime, $system, $genesis, $new_ext, []); + $crate::__impl_ext_for_relay_chain!(@impl $name, $runtime, $system, $genesis, $on_init, []); } }; // impl - (@impl $name:ident, $runtime:path, $system:path, $genesis:expr, $new_ext:expr, $ext_name:ident) => { + (@impl $name:ident, $runtime:path, $system:path, $genesis:expr, $on_init:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> = $crate::RefCell::new(<$name>::build_new_ext($genesis)); @@ -212,6 +212,7 @@ macro_rules! __impl_ext_for_relay_chain { fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { + $on_init; sp_tracing::try_init_simple(); <$system>::set_block_number(1); }); @@ -223,7 +224,7 @@ macro_rules! __impl_ext_for_relay_chain { } fn reset_ext() { - $ext_name.with(|v| *v.borrow_mut() = $new_ext); + $ext_name.with(|v| *v.borrow_mut() = <$name>::build_new_ext($genesis)); } fn execute_with(execute: impl FnOnce() -> R) -> R { @@ -265,13 +266,13 @@ macro_rules! __impl_ext_for_relay_chain { #[macro_export] macro_rules! __impl_ext_for_parachain { // entry point: generate ext name - ($name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $new_ext:expr) => { + ($name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $system, $genesis, $new_ext, []); + $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $system, $genesis, $on_init, []); } }; // impl - (@impl $name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $new_ext:expr, $ext_name:ident) => { + (@impl $name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> = $crate::RefCell::new(<$name>::build_new_ext($genesis)); @@ -302,6 +303,7 @@ macro_rules! __impl_ext_for_parachain { fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { + $on_init; sp_tracing::try_init_simple(); <$system>::set_block_number(1); }); @@ -313,7 +315,7 @@ macro_rules! __impl_ext_for_parachain { } fn reset_ext() { - $ext_name.with(|v| *v.borrow_mut() = $new_ext); + $ext_name.with(|v| *v.borrow_mut() = <$name>::build_new_ext($genesis)); } fn execute_with(execute: impl FnOnce() -> R) -> R { From 4e82c97a14e080856d6e51d2d17e713905d9e2b4 Mon Sep 17 00:00:00 2001 From: Muharem Ismailov Date: Fri, 5 May 2023 16:39:13 +0200 Subject: [PATCH 19/60] Companion: XCM remote lock config (#2463) * xcm remote lock config * rename * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: parity-processbot <> --- Cargo.lock | 585 ++++++++++-------- parachain-template/runtime/src/xcm_config.rs | 2 + .../assets/statemine/src/xcm_config.rs | 2 + .../assets/statemint/src/xcm_config.rs | 2 + .../assets/westmint/src/xcm_config.rs | 2 + .../bridge-hub-kusama/src/xcm_config.rs | 2 + .../bridge-hub-polkadot/src/xcm_config.rs | 2 + .../bridge-hub-rococo/src/xcm_config.rs | 2 + .../collectives-polkadot/src/xcm_config.rs | 2 + .../contracts-rococo/src/xcm_config.rs | 2 + .../runtimes/testing/penpal/src/xcm_config.rs | 2 + .../testing/rococo-parachain/src/lib.rs | 2 + 12 files changed, 342 insertions(+), 265 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e23b26dd6e7..3bb509f77b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -585,7 +585,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "hash-db", "log", @@ -1715,6 +1715,19 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "console" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "unicode-width", + "windows-sys 0.42.0", +] + [[package]] name = "const-oid" version = "0.9.2" @@ -3375,6 +3388,12 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "enum-as-inner" version = "0.5.1" @@ -3742,7 +3761,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", ] @@ -3765,7 +3784,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-support-procedural", @@ -3790,7 +3809,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3837,7 +3856,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3848,7 +3867,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3865,7 +3884,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -3894,10 +3913,11 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-recursion", "futures", + "indicatif", "jsonrpsee", "log", "parity-scale-codec", @@ -3905,6 +3925,7 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", + "spinners", "substrate-rpc-client", "tokio", ] @@ -3912,7 +3933,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "bitflags", "environmental", @@ -3945,7 +3966,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "Inflector", "cfg-expr", @@ -3961,7 +3982,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3973,7 +3994,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro2", "quote", @@ -3983,7 +4004,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "log", @@ -4001,7 +4022,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -4016,7 +4037,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "sp-api", @@ -4025,7 +4046,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "parity-scale-codec", @@ -4730,6 +4751,18 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" +[[package]] +name = "indicatif" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cef509aa9bc73864d6756f0d34d35504af3cf0844373afe9b8669a5b8005a729" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width", +] + [[package]] name = "instant" version = "0.1.12" @@ -5030,7 +5063,7 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kusama-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "frame-benchmarking", @@ -5128,7 +5161,7 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-support", "polkadot-primitives", @@ -5982,7 +6015,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "log", @@ -6001,7 +6034,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "anyhow", "jsonrpsee", @@ -6349,6 +6382,12 @@ dependencies = [ "libc", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" version = "0.29.0" @@ -6500,7 +6539,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -6521,7 +6560,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6539,7 +6578,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6554,7 +6593,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -6570,7 +6609,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -6586,7 +6625,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -6600,7 +6639,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6624,7 +6663,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6644,7 +6683,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6659,7 +6698,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -6678,7 +6717,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -6702,7 +6741,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6808,7 +6847,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6852,7 +6891,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6869,7 +6908,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "bitflags", "environmental", @@ -6899,7 +6938,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "bitflags", "parity-scale-codec", @@ -6912,7 +6951,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro2", "quote", @@ -6922,7 +6961,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6939,7 +6978,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -6957,7 +6996,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6980,7 +7019,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6993,7 +7032,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7011,7 +7050,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7029,7 +7068,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7052,7 +7091,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7068,7 +7107,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7088,7 +7127,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7105,7 +7144,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -7119,7 +7158,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7136,7 +7175,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7153,7 +7192,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7169,7 +7208,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7187,7 +7226,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "pallet-nfts", @@ -7198,7 +7237,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7214,7 +7253,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -7231,7 +7270,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7251,7 +7290,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -7262,7 +7301,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -7279,7 +7318,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7303,7 +7342,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7320,7 +7359,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7335,7 +7374,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7353,7 +7392,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7368,7 +7407,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7387,7 +7426,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7404,7 +7443,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -7425,7 +7464,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7441,7 +7480,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -7455,7 +7494,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7478,7 +7517,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7489,7 +7528,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "log", "sp-arithmetic", @@ -7498,7 +7537,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "sp-api", @@ -7507,7 +7546,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7524,7 +7563,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -7553,7 +7592,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7571,7 +7610,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7590,7 +7629,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-support", "frame-system", @@ -7606,7 +7645,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7622,7 +7661,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7634,7 +7673,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7651,7 +7690,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7666,7 +7705,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7682,7 +7721,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7697,7 +7736,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-benchmarking", "frame-support", @@ -7712,7 +7751,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -7733,7 +7772,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-benchmarking", "frame-support", @@ -8311,7 +8350,7 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "polkadot-node-jaeger", @@ -8327,7 +8366,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -8341,7 +8380,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "derive_more", "fatality", @@ -8364,7 +8403,7 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "fatality", "futures", @@ -8385,7 +8424,7 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "clap 4.2.7", "frame-benchmarking-cli", @@ -8414,7 +8453,7 @@ dependencies = [ [[package]] name = "polkadot-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "frame-benchmarking", @@ -8457,7 +8496,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "always-assert", "bitvec", @@ -8479,7 +8518,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "parity-scale-codec", "scale-info", @@ -8491,7 +8530,7 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "derive_more", "fatality", @@ -8516,7 +8555,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8530,7 +8569,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "futures-timer", @@ -8550,7 +8589,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "always-assert", "async-trait", @@ -8573,7 +8612,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "parity-scale-codec", @@ -8591,7 +8630,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "derive_more", @@ -8620,7 +8659,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "futures", @@ -8641,7 +8680,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "fatality", @@ -8660,7 +8699,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8675,7 +8714,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "futures", @@ -8695,7 +8734,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "polkadot-node-metrics", @@ -8710,7 +8749,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "futures-timer", @@ -8727,7 +8766,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "fatality", "futures", @@ -8746,7 +8785,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "futures", @@ -8763,7 +8802,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "fatality", @@ -8781,7 +8820,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "always-assert", "futures", @@ -8808,7 +8847,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "polkadot-node-primitives", @@ -8824,7 +8863,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-worker" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "assert_matches", "cpu-time", @@ -8853,7 +8892,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "futures", "lru 0.9.0", @@ -8868,7 +8907,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "lazy_static", "log", @@ -8886,7 +8925,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bs58", "futures", @@ -8905,7 +8944,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "derive_more", @@ -8927,7 +8966,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bounded-vec", "futures", @@ -8949,7 +8988,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8959,7 +8998,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "futures", @@ -8977,7 +9016,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "derive_more", @@ -9000,7 +9039,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "derive_more", @@ -9033,7 +9072,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "futures", @@ -9056,7 +9095,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bounded-collections", "derive_more", @@ -9154,7 +9193,7 @@ dependencies = [ [[package]] name = "polkadot-performance-test" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "env_logger 0.9.0", "kusama-runtime", @@ -9172,7 +9211,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "hex-literal 0.4.1", @@ -9198,7 +9237,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -9230,7 +9269,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "frame-benchmarking", @@ -9324,7 +9363,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "frame-benchmarking", @@ -9370,7 +9409,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-support", "polkadot-primitives", @@ -9384,7 +9423,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bs58", "parity-scale-codec", @@ -9396,7 +9435,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitflags", "bitvec", @@ -9440,7 +9479,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "async-trait", "frame-benchmarking-cli", @@ -9550,7 +9589,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -9571,7 +9610,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9581,7 +9620,7 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -9606,7 +9645,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "frame-election-provider-support", @@ -9667,7 +9706,7 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-benchmarking", "frame-system", @@ -9764,6 +9803,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" + [[package]] name = "portpicker" version = "0.1.1" @@ -10434,7 +10479,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -10520,7 +10565,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-support", "polkadot-primitives", @@ -10767,7 +10812,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "log", "sp-core", @@ -10778,7 +10823,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures", @@ -10806,7 +10851,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "futures-timer", @@ -10829,7 +10874,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10844,7 +10889,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10863,7 +10908,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10874,7 +10919,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10914,7 +10959,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "fnv", "futures", @@ -10941,7 +10986,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "hash-db", "kvdb", @@ -10967,7 +11012,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures", @@ -10992,7 +11037,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures", @@ -11021,7 +11066,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "fork-tree", @@ -11057,7 +11102,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "jsonrpsee", @@ -11079,7 +11124,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11114,7 +11159,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "jsonrpsee", @@ -11133,7 +11178,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "fork-tree", "parity-scale-codec", @@ -11146,7 +11191,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "ahash 0.8.2", "array-bytes 4.2.0", @@ -11186,7 +11231,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "finality-grandpa", "futures", @@ -11206,7 +11251,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures", @@ -11229,7 +11274,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -11253,7 +11298,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -11266,7 +11311,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "log", "sc-allocator", @@ -11279,7 +11324,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "anyhow", "cfg-if", @@ -11297,7 +11342,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "ansi_term", "futures", @@ -11313,7 +11358,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11328,7 +11373,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -11373,7 +11418,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "cid", "futures", @@ -11393,7 +11438,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11421,7 +11466,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "ahash 0.8.2", "futures", @@ -11440,7 +11485,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11462,7 +11507,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11496,7 +11541,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11516,7 +11561,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11547,7 +11592,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "libp2p", @@ -11560,7 +11605,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11569,7 +11614,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "jsonrpsee", @@ -11600,7 +11645,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11619,7 +11664,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "http", "jsonrpsee", @@ -11634,7 +11679,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11660,7 +11705,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "directories", @@ -11726,7 +11771,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "log", "parity-scale-codec", @@ -11737,7 +11782,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "clap 4.2.7", "fs4", @@ -11753,7 +11798,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11772,7 +11817,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "libc", @@ -11791,7 +11836,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "chrono", "futures", @@ -11810,7 +11855,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "ansi_term", "atty", @@ -11841,7 +11886,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11852,7 +11897,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures", @@ -11879,7 +11924,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures", @@ -11893,7 +11938,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-channel", "futures", @@ -12374,7 +12419,7 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "enumn", "parity-scale-codec", @@ -12451,7 +12496,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "hash-db", "log", @@ -12471,7 +12516,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "Inflector", "blake2", @@ -12485,7 +12530,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "scale-info", @@ -12498,7 +12543,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "integer-sqrt", "num-traits", @@ -12512,7 +12557,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "scale-info", @@ -12525,7 +12570,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "sp-api", @@ -12537,7 +12582,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "log", @@ -12555,7 +12600,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures", @@ -12570,7 +12615,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "parity-scale-codec", @@ -12588,7 +12633,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "parity-scale-codec", @@ -12609,7 +12654,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "lazy_static", "parity-scale-codec", @@ -12628,7 +12673,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "finality-grandpa", "log", @@ -12646,7 +12691,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "scale-info", @@ -12658,7 +12703,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -12702,7 +12747,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "blake2b_simd", "byteorder", @@ -12716,7 +12761,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro2", "quote", @@ -12727,7 +12772,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12736,7 +12781,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro2", "quote", @@ -12746,7 +12791,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "environmental", "parity-scale-codec", @@ -12757,7 +12802,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12772,7 +12817,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "bytes", "ed25519", @@ -12798,7 +12843,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "lazy_static", "sp-core", @@ -12809,7 +12854,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "parity-scale-codec", @@ -12823,7 +12868,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -12832,7 +12877,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -12843,7 +12888,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -12861,7 +12906,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "scale-info", @@ -12875,7 +12920,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "sp-api", "sp-core", @@ -12885,7 +12930,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "backtrace", "lazy_static", @@ -12895,7 +12940,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "rustc-hash", "serde", @@ -12905,7 +12950,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "either", "hash256-std-hasher", @@ -12927,7 +12972,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -12945,7 +12990,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "Inflector", "proc-macro-crate", @@ -12957,7 +13002,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "serde", "serde_json", @@ -12966,7 +13011,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "scale-info", @@ -12980,7 +13025,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "scale-info", @@ -12993,7 +13038,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "hash-db", "log", @@ -13013,7 +13058,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "log", "parity-scale-codec", @@ -13031,12 +13076,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13049,7 +13094,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "futures-timer", @@ -13064,7 +13109,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "sp-std", @@ -13076,7 +13121,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "sp-api", "sp-runtime", @@ -13085,7 +13130,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "log", @@ -13101,7 +13146,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "ahash 0.8.2", "hash-db", @@ -13124,7 +13169,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13141,7 +13186,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -13152,7 +13197,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13166,7 +13211,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "parity-scale-codec", "scale-info", @@ -13190,6 +13235,17 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +[[package]] +name = "spinners" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08615eea740067d9899969bc2891c68a19c315cb1f66640af9a9ecb91b13bcab" +dependencies = [ + "lazy_static", + "maplit", + "strum", +] + [[package]] name = "spki" version = "0.6.0" @@ -13490,7 +13546,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "platforms 2.0.0", ] @@ -13498,7 +13554,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -13517,7 +13573,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "hyper", "log", @@ -13529,7 +13585,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "jsonrpsee", @@ -13542,7 +13598,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "jsonrpsee", "log", @@ -13561,7 +13617,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -13587,7 +13643,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "futures", "substrate-test-utils-derive", @@ -13597,7 +13653,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -13608,7 +13664,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "ansi_term", "build-helper", @@ -13735,7 +13791,7 @@ checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" [[package]] name = "test-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-support", "polkadot-primitives", @@ -14121,7 +14177,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -14132,7 +14188,7 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "expander 2.0.0", "proc-macro-crate", @@ -14262,7 +14318,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#82f783d902a11e4bf05a02acd07a70ba6d834d8c" +source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" dependencies = [ "async-trait", "clap 4.2.7", @@ -14617,9 +14673,9 @@ dependencies = [ [[package]] name = "wasm-opt" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a303793cbc01fb96551badfc7367db6007396bba6bac97936b3c8b6f7fdb41" +checksum = "87fef6d0d508f08334e0ab0e6877feb4c0ecb3956bcf2cb950699b22fedf3e9c" dependencies = [ "anyhow", "libc", @@ -14633,9 +14689,9 @@ dependencies = [ [[package]] name = "wasm-opt-cxx-sys" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c9deb56f8a9f2ec177b3bd642a8205621835944ed5da55f2388ef216aca5a4" +checksum = "bc816bbc1596c8f2e8127e137a760c798023ef3d378f2ae51f0f1840e2dfa445" dependencies = [ "anyhow", "cxx", @@ -14645,15 +14701,14 @@ dependencies = [ [[package]] name = "wasm-opt-sys" -version = "0.111.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4432e28b542738a9776cedf92e8a99d8991c7b4667ee2c7ccddfb479dd2856a7" +checksum = "40199e4f68ef1071b3c6d0bd8026a12b481865d4b9e49c156932ea9a6234dd14" dependencies = [ "anyhow", "cc", "cxx", "cxx-build", - "regex", ] [[package]] @@ -15196,7 +15251,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bitvec", "frame-benchmarking", @@ -15288,7 +15343,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-support", "polkadot-primitives", @@ -15790,7 +15845,7 @@ dependencies = [ [[package]] name = "xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "bounded-collections", "derivative", @@ -15806,7 +15861,7 @@ dependencies = [ [[package]] name = "xcm-builder" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "frame-support", "frame-system", @@ -15827,7 +15882,7 @@ dependencies = [ [[package]] name = "xcm-executor" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "environmental", "frame-benchmarking", @@ -15847,7 +15902,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#400b5a5c85e377edd454c854f722346e5d606b0f" +source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" dependencies = [ "Inflector", "proc-macro2", diff --git a/parachain-template/runtime/src/xcm_config.rs b/parachain-template/runtime/src/xcm_config.rs index bd395c83d38..096359004d6 100644 --- a/parachain-template/runtime/src/xcm_config.rs +++ b/parachain-template/runtime/src/xcm_config.rs @@ -248,6 +248,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index 45f95ee07d4..eb99e2fb709 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -477,6 +477,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/assets/statemint/src/xcm_config.rs b/parachains/runtimes/assets/statemint/src/xcm_config.rs index 9d31bc0da60..19fb96c3027 100644 --- a/parachains/runtimes/assets/statemint/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemint/src/xcm_config.rs @@ -373,6 +373,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index d9987a627ae..a834180bd29 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -470,6 +470,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index 7b395a4d4e3..0e3ce655349 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -261,6 +261,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index d063fda2c13..3cd79a8324b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -264,6 +264,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { 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 91fd15136bb..cd915a99313 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 @@ -298,6 +298,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs index b2b93d88ffe..7749877a52f 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs @@ -294,6 +294,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs index 1b42819b423..e79d06b1aa1 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/xcm_config.rs @@ -213,6 +213,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/testing/penpal/src/xcm_config.rs b/parachains/runtimes/testing/penpal/src/xcm_config.rs index 89cfc2ced65..89236aa93a9 100644 --- a/parachains/runtimes/testing/penpal/src/xcm_config.rs +++ b/parachains/runtimes/testing/penpal/src/xcm_config.rs @@ -339,6 +339,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 1a26290f2a3..0147c28335c 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -470,6 +470,8 @@ impl pallet_xcm::Config for Runtime { #[cfg(feature = "runtime-benchmarks")] type ReachableDest = ReachableDest; type AdminOrigin = EnsureRoot; + type MaxRemoteLockConsumers = ConstU32<0>; + type RemoteLockConsumerIdentifier = (); } impl cumulus_pallet_xcm::Config for Runtime { From b7f54e6d19f171a4f00228111eda37e7a17a1dff Mon Sep 17 00:00:00 2001 From: NachoPal Date: Fri, 5 May 2023 16:44:06 +0200 Subject: [PATCH 20/60] new relay block number approach --- Cargo.lock | 1 + .../xcm-emulator/common/Cargo.toml | 1 + .../xcm-emulator/common/src/lib.rs | 7 +- xcm/xcm-emulator/src/lib.rs | 168 ++++++++++++++---- 4 files changed, 138 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6688d16450e..55f3007ce03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4388,6 +4388,7 @@ dependencies = [ "pallet-im-online", "pallet-staking", "pallet-xcm", + "parachain-info", "parachains-common", "parity-scale-codec", "penpal-runtime", diff --git a/parachains/integration-tests/xcm-emulator/common/Cargo.toml b/parachains/integration-tests/xcm-emulator/common/Cargo.toml index 085907a78d3..d8d47c93846 100644 --- a/parachains/integration-tests/xcm-emulator/common/Cargo.toml +++ b/parachains/integration-tests/xcm-emulator/common/Cargo.toml @@ -38,6 +38,7 @@ pallet-xcm = { default-features = false, git = "https://github.com/paritytech/po # Cumulus parachains-common = { path = "../../../common" } +parachain-info = { path = "../../../pallets/parachain-info" } cumulus-test-service = { path = "../../../../test/service" } cumulus-primitives-core = { path = "../../../../primitives/core" } penpal-runtime = { path = "../../../runtimes/testing/penpal" } diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 0a43dfb8728..75f817af18e 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -14,7 +14,8 @@ use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; pub use constants::{polkadot, kusama, statemint, statemine, penpal, accounts::{ALICE, BOB}}; use sp_runtime::BuildStorage; -pub use sp_core::storage::Storage; +pub use sp_core::{Get, storage::Storage}; +use parachain_info::pallet::Pallet; decl_test_relay_chains! { pub struct Polkadot { @@ -43,6 +44,7 @@ decl_test_parachains! { System = statemint_runtime::System, genesis = statemint_storage(), on_init = (), + para_id = statemint_runtime::ParachainInfo::get(), }, pub struct PenpalPolkadot { Runtime = penpal_runtime::Runtime, @@ -52,6 +54,7 @@ decl_test_parachains! { System = penpal_runtime::System, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), + para_id = penpal_runtime::ParachainInfo::get(), }, // Kusama pub struct Statemine { @@ -62,6 +65,7 @@ decl_test_parachains! { System = statemine_runtime::System, genesis = statemine::genesis(), on_init = (), + para_id = statemine_runtime::ParachainInfo::get(), }, pub struct PenpalKusama { Runtime = penpal_runtime::Runtime, @@ -71,6 +75,7 @@ decl_test_parachains! { System = penpal_runtime::System, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), + para_id = penpal_runtime::ParachainInfo::get(), } } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 97bcd0b08f5..a4698c83a4f 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -55,6 +55,7 @@ pub trait TestExt { fn new_ext() -> sp_io::TestExternalities; fn reset_ext(); fn execute_with(execute: impl FnOnce() -> R) -> R; + // fn get_ext() -> &'static sp_io::TestExternalities; } pub trait Network { @@ -62,7 +63,11 @@ pub trait Network { fn init() {} - fn relay_block_number() -> &'static LocalKey>> { &RELAY_BLOCK_NUMBER } + // fn relay_block_number() -> &'static LocalKey>> { &RELAY_BLOCK_NUMBER } + + fn relay_block_number() -> u32 { Default::default() } // { &RELAY_BLOCK_NUMBER } + + fn set_relay_block_number(block_number: u32) {} // { &RELAY_BLOCK_NUMBER } fn hrmp_channel_parachain_inherent_data( para_id: u32, @@ -91,6 +96,10 @@ pub trait Relay: Network { } pub trait Parachain: Network { + fn para_id() -> ParaId { + Default::default() + } + fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) {} @@ -149,6 +158,7 @@ macro_rules! decl_test_parachains { System = $system:path, genesis = $genesis:expr, on_init = $on_init:expr, + para_id = $para_id:expr, } ), + @@ -157,9 +167,13 @@ macro_rules! decl_test_parachains { pub struct $name; impl Network for $name {} - impl Parachain for $name {} + impl Parachain for $name { + fn para_id() -> $crate::ParaId { + $para_id + } + } - $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $system, $genesis, $on_init); + $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $system, $genesis, $on_init, $para_id); impl $crate::XcmpMessageHandler for $name { fn handle_xcmp_messages< @@ -259,6 +273,10 @@ macro_rules! __impl_ext_for_relay_chain { r } + + // fn get_ext() -> &'static $crate::TestExternalities { + // $ext_name.with(|v| &*v.clone().borrow()) + // } } }; } @@ -266,13 +284,13 @@ macro_rules! __impl_ext_for_relay_chain { #[macro_export] macro_rules! __impl_ext_for_parachain { // entry point: generate ext name - ($name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr) => { + ($name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr, $para_id:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $system, $genesis, $on_init, []); + $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $system, $genesis, $on_init, $para_id, []); } }; // impl - (@impl $name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr, $ext_name:ident) => { + (@impl $name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr, $para_id:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> = $crate::RefCell::new(<$name>::build_new_ext($genesis)); @@ -285,8 +303,10 @@ macro_rules! __impl_ext_for_parachain { use $crate::{Get, Hooks}; type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; - let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); - let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); + // let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); + let block_number = <$system>::block_number(); + // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); + let para_id = <$name>::para_id(); let _ = ParachainSystem::set_validation_data( <$origin>::none(), @@ -328,24 +348,48 @@ macro_rules! __impl_ext_for_parachain { let network_name = <$name>::network_name(); - <$name>::relay_block_number().with(|v| { - *v.borrow_mut().get_mut(&network_name).unwrap() += 1; - }); + // <$name>::relay_block_number().with(|v| { + // *v.borrow_mut().get_mut(&network_name).unwrap() += 1; + // }); + + // let para_id = <$name>::para_id().into(); + + let mut relay_block_number = <$name>::relay_block_number(); + + relay_block_number += 1; + + <$name>::set_relay_block_number(relay_block_number); + + // $ext_name.with(|v| { + // v.borrow_mut().execute_with(|| { + // // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); + // let para_id = <$name>::para_id(); + // <$name>::relay_block_number().with(|v| { + // let relay_block_number = *v.borrow().get(&network_name).unwrap(); + // // let relay_block_number = *hash_map.get(stringify!($name)).unwrap(); + // let _ = ParachainSystem::set_validation_data( + // <$origin>::none(), + // <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), relay_block_number), + // ); + // }); + // }) + // }); $ext_name.with(|v| { v.borrow_mut().execute_with(|| { - let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - <$name>::relay_block_number().with(|v| { - let relay_block_number = *v.borrow().get(&network_name).unwrap(); - // let relay_block_number = *hash_map.get(stringify!($name)).unwrap(); - let _ = ParachainSystem::set_validation_data( - <$origin>::none(), - <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), relay_block_number), - ); - }); + // Make sure it has been recorded properly + let relay_block_number = <$name>::relay_block_number(); + let para_id = <$name>::para_id().into(); + // panic!("{}", relay_block_number); + + let _ = ParachainSystem::set_validation_data( + <$origin>::none(), + <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), + ); }) }); + let r = $ext_name.with(|v| v.borrow_mut().execute_with(execute)); // send messages if needed @@ -367,22 +411,34 @@ macro_rules! __impl_ext_for_parachain { let collation_info = ParachainSystem::collect_collation_info(&mock_header); // send upward messages - let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); + // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); + let relay_block_number = <$name>::relay_block_number(); + let para_id = <$name>::para_id().into(); + for msg in collation_info.upward_messages.clone() { - <$name>::send_upward_message(para_id.into(), msg); + <$name>::send_upward_message(para_id, msg); } + // send horizontal messages + // for msg in collation_info.horizontal_messages { + // <$name>::relay_block_number().with(|v| { + // let relay_block_number = *v.borrow().get(&network_name).unwrap(); + // <$name>::send_horizontal_messages( + // msg.recipient.into(), + // vec![(para_id.into(), relay_block_number, msg.data)].into_iter(), + // ); + // }); + // } + // send horizontal messages for msg in collation_info.horizontal_messages { - <$name>::relay_block_number().with(|v| { - let relay_block_number = *v.borrow().get(&network_name).unwrap(); - <$name>::send_horizontal_messages( - msg.recipient.into(), - vec![(para_id.into(), relay_block_number, msg.data)].into_iter(), - ); - }); + <$name>::send_horizontal_messages( + msg.recipient.into(), + vec![(para_id.into(), relay_block_number, msg.data)].into_iter(), + ); } + // clean messages ParachainSystem::on_initialize(block_number); }) @@ -392,6 +448,10 @@ macro_rules! __impl_ext_for_parachain { r } + + // fn get_ext() -> &'static $crate::TestExternalities { + // $ext_name.with(|v| &*v.borrow()) + // } } }; } @@ -479,11 +539,26 @@ macro_rules! decl_test_networks { } fn _para_ids() -> Vec { - vec![$( $para_id, )*] + // vec![$( $para_id, )*] + // vec![] + // vec![$( <$parachain>::para_id().into(), )*] + vec![$( <$parachain>::execute_with(|| { + <$parachain>::para_id().into() + }), )*] } - fn _relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { - &$crate::RELAY_BLOCK_NUMBER + // fn _relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + // &$crate::RELAY_BLOCK_NUMBER + // } + + fn _relay_block_number() -> u32 { + // $crate::RELAY_BLOCK_NUMBER.with(|v| *(v.borrow()).clone().get(stringify!($name)).unwrap()) + $crate::RELAY_BLOCK_NUMBER.with(|v| *v.clone().borrow().get(stringify!($name)).unwrap()) + } + + fn _set_relay_block_number(block_number: u32) { + // $crate::RELAY_BLOCK_NUMBER.with(|v| *(v.borrow()).clone().get(stringify!($name)).unwrap()) + $crate::RELAY_BLOCK_NUMBER.with(|v| v.borrow_mut().insert(stringify!($name).to_string(), block_number)); } fn _process_messages() { @@ -608,17 +683,17 @@ macro_rules! decl_test_networks { } } - $crate::__impl_messenger_for_relay!($name, $relay_chain); + $crate::__impl_relay!($name, $relay_chain); $( - $crate::__impl_messenger_for_parachain!($name, $parachain); + $crate::__impl_parachain!($name, $parachain); )* )+ }; } #[macro_export] -macro_rules! __impl_messenger_for_relay { +macro_rules! __impl_relay { ($network_name:ident, $relay_chain:ty) => { impl $relay_chain { @@ -630,11 +705,20 @@ macro_rules! __impl_messenger_for_relay { <$network_name>::_init(); } - fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + // fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + // <$network_name>::_relay_block_number() + // } + + fn relay_block_number() -> u32 { <$network_name>::_relay_block_number() } + fn set_relay_block_number(block_number: u32) { + <$network_name>::_set_relay_block_number(block_number); + } + fn para_ids() -> Vec { + // panic!("{:?}", <$network_name>::_para_ids()); <$network_name>::_para_ids() } @@ -657,7 +741,7 @@ macro_rules! __impl_messenger_for_relay { } #[macro_export] -macro_rules! __impl_messenger_for_parachain { +macro_rules! __impl_parachain { ($network_name:ident, $parachain:ty) => { impl $parachain { @@ -669,10 +753,18 @@ macro_rules! __impl_messenger_for_parachain { <$network_name>::_init(); } - fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + // pub fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + // <$network_name>::_relay_block_number() + // } + + fn relay_block_number() -> u32 { <$network_name>::_relay_block_number() } + fn set_relay_block_number(block_number: u32) { + <$network_name>::_set_relay_block_number(block_number); + } + fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { From 1bddaae927201eb2809d788d1b57ba2942d95865 Mon Sep 17 00:00:00 2001 From: Artyom Bakhtin Date: Fri, 5 May 2023 15:58:28 +0100 Subject: [PATCH 21/60] Update DNS names of Rococo Contracts bootnodes (#2524) --- parachains/chain-specs/contracts-rococo.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/parachains/chain-specs/contracts-rococo.json b/parachains/chain-specs/contracts-rococo.json index a74ab22e05d..09108e9c099 100644 --- a/parachains/chain-specs/contracts-rococo.json +++ b/parachains/chain-specs/contracts-rococo.json @@ -3,11 +3,16 @@ "id": "contracts-rococo", "chainType": "Live", "bootNodes": [ - "/dns/contracts-collator-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", - "/dns/contracts-collator-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", - "/dns/contracts-collator-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", - "/dns/contracts-collator-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX" + "/dns/rococo-contracts-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", + "/dns/rococo-contracts-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", + "/dns/rococo-contracts-collator-node-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", + "/dns/rococo-contracts-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX", + "/dns/rococo-contracts-collator-node-0.polkadot.io/tcp/443/wss/p2p/12D3KooWKg3Rpxcr9oJ8n6khoxpGKWztCZydtUZk2cojHqnfLrpj", + "/dns/rococo-contracts-collator-node-1.polkadot.io/tcp/443/wss/p2p/12D3KooWPEXYrz8tHU3nDtPoPw4V7ou5dzMEWSTuUj7vaWiYVAVh", + "/dns/rococo-contracts-collator-node-2.polkadot.io/tcp/443/wss/p2p/12D3KooWEVU8AFNary4nP4qEnEcwJaRuy59Wefekzdu9pKbnVEhk", + "/dns/rococo-contracts-collator-node-3.polkadot.io/tcp/443/wss/p2p/12D3KooWP6pV3ZmcXzGDjv8ZMgA6nZxfAKDxSz4VNiLx6vVCQgJX" ], + "telemetryEndpoints": null, "protocolId": null, "properties": { @@ -80,4 +85,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} From 066a0c949e7f99d9a2a771114fe3f022d03a127f Mon Sep 17 00:00:00 2001 From: NachoPal Date: Fri, 5 May 2023 18:30:45 +0200 Subject: [PATCH 22/60] ext_wrapper added --- xcm/xcm-emulator/src/lib.rs | 63 +++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 6 deletions(-) diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index a4698c83a4f..f8c9aa1e61f 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -51,6 +51,8 @@ pub use xcm_executor::XcmExecutor; pub use std::{thread::LocalKey, collections::HashMap}; pub trait TestExt { + // fn ext_wrapper(func: impl FnOnce() -> R) -> R; + fn ext_wrapper(func: R) -> R; fn build_new_ext(storage: Storage) -> sp_io::TestExternalities; fn new_ext() -> sp_io::TestExternalities; fn reset_ext(); @@ -96,6 +98,12 @@ pub trait Relay: Network { } pub trait Parachain: Network { + type System; + type Runtime; + type Origin; + type XcmpMessageHandler; + type DmpMessageHandler; + fn para_id() -> ParaId { Default::default() } @@ -168,9 +176,15 @@ macro_rules! decl_test_parachains { impl Network for $name {} impl Parachain for $name { - fn para_id() -> $crate::ParaId { - $para_id - } + // fn para_id() -> $crate::ParaId { + // $para_id + // } + + type Runtime = $runtime; + type Origin = $origin; + type XcmpMessageHandler = $xcmp_message_handler; + type DmpMessageHandler = $dmp_message_handler; + type System = $system; } $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $system, $genesis, $on_init, $para_id); @@ -223,6 +237,18 @@ macro_rules! __impl_ext_for_relay_chain { } impl $crate::TestExt for $name { + // fn ext_wrapper(func: impl FnOnce() -> R) -> R { + // $ext_name.with(|v| { + // func() + // }) + // } + + fn ext_wrapper(func: R) -> R { + $ext_name.with(|v| { + func + }) + } + fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { @@ -297,6 +323,16 @@ macro_rules! __impl_ext_for_parachain { } impl $name { + fn para_id() -> $crate::ParaId { + // $ext_name.with(|v| { + // $para_id + // }) + // let a = Self::ext_wrapper($para_id); + + // panic!("{:?}", $para_id); + $para_id + } + fn prepare_for_xcmp() { $ext_name.with(|v| { v.borrow_mut().execute_with(|| { @@ -304,9 +340,12 @@ macro_rules! __impl_ext_for_parachain { type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; // let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); - let block_number = <$system>::block_number(); + // let block_number = <$system>::block_number(); + let block_number = ::System::block_number(); // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - let para_id = <$name>::para_id(); + // let para_id = <$name>::para_id(); + let para_id = Self::para_id(); + // panic!("{:?}", para_id); let _ = ParachainSystem::set_validation_data( <$origin>::none(), @@ -320,6 +359,18 @@ macro_rules! __impl_ext_for_parachain { } impl $crate::TestExt for $name { + // fn ext_wrapper(func: impl FnOnce() -> R) -> R { + // $ext_name.with(|v| { + // func() + // }) + // } + + fn ext_wrapper(func: R) -> R { + $ext_name.with(|v| { + func + }) + } + fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { @@ -397,7 +448,7 @@ macro_rules! __impl_ext_for_parachain { v.borrow_mut().execute_with(|| { use sp_runtime::traits::Header as HeaderT; - let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); + let block_number = ::System::block_number(); let mock_header = HeaderT::new( 0, Default::default(), From fb620686bf2ab2a85023cf49cceca26876ac2e0a Mon Sep 17 00:00:00 2001 From: NachoPal Date: Fri, 5 May 2023 18:59:28 +0200 Subject: [PATCH 23/60] added types to Parachain trait --- .../xcm-emulator/common/src/lib.rs | 4 + xcm/xcm-emulator/src/lib.rs | 93 +++++++++++-------- 2 files changed, 56 insertions(+), 41 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 75f817af18e..793150efed9 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -42,6 +42,7 @@ decl_test_parachains! { XcmpMessageHandler = statemint_runtime::XcmpQueue, DmpMessageHandler = statemint_runtime::DmpQueue, System = statemint_runtime::System, + ParachainSystem = statemint_runtime::ParachainSystem, genesis = statemint_storage(), on_init = (), para_id = statemint_runtime::ParachainInfo::get(), @@ -52,6 +53,7 @@ decl_test_parachains! { XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, + ParachainSystem = penpal_runtime::ParachainSystem, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), para_id = penpal_runtime::ParachainInfo::get(), @@ -63,6 +65,7 @@ decl_test_parachains! { XcmpMessageHandler = statemine_runtime::XcmpQueue, DmpMessageHandler = statemine_runtime::DmpQueue, System = statemine_runtime::System, + ParachainSystem = statemine_runtime::ParachainSystem, genesis = statemine::genesis(), on_init = (), para_id = statemine_runtime::ParachainInfo::get(), @@ -73,6 +76,7 @@ decl_test_parachains! { XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, + ParachainSystem = penpal_runtime::ParachainSystem, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), para_id = penpal_runtime::ParachainInfo::get(), diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index f8c9aa1e61f..4bbb25c99cb 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -98,11 +98,12 @@ pub trait Relay: Network { } pub trait Parachain: Network { - type System; type Runtime; type Origin; type XcmpMessageHandler; type DmpMessageHandler; + type System; + type ParachainSystem; fn para_id() -> ParaId { Default::default() @@ -164,6 +165,7 @@ macro_rules! decl_test_parachains { XcmpMessageHandler = $xcmp_message_handler:path, DmpMessageHandler = $dmp_message_handler:path, System = $system:path, + ParachainSystem = $parachain_system:path, genesis = $genesis:expr, on_init = $on_init:expr, para_id = $para_id:expr, @@ -185,40 +187,49 @@ macro_rules! decl_test_parachains { type XcmpMessageHandler = $xcmp_message_handler; type DmpMessageHandler = $dmp_message_handler; type System = $system; + type ParachainSystem = $parachain_system; } - $crate::__impl_ext_for_parachain!($name, $runtime, $origin, $system, $genesis, $on_init, $para_id); + $crate::__impl_ext_for_parachain!($name, $genesis, $on_init, $para_id); + $crate::__impl_xcm_handlers_for_parachain!($name); - impl $crate::XcmpMessageHandler for $name { - fn handle_xcmp_messages< - 'a, - I: Iterator, - >( - iter: I, - max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{TestExt, XcmpMessageHandler}; - $name::execute_with(|| { - <$xcmp_message_handler>::handle_xcmp_messages(iter, max_weight) - }) - } + )+ + }; +} + +#[macro_export] +macro_rules! __impl_xcm_handlers_for_parachain { + ($name:ident) => { + impl $crate::XcmpMessageHandler for $name { + fn handle_xcmp_messages< + 'a, + I: Iterator, + >( + iter: I, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{TestExt, XcmpMessageHandler}; + + $name::execute_with(|| { + ::XcmpMessageHandler::handle_xcmp_messages(iter, max_weight) + }) } + } - impl $crate::DmpMessageHandler for $name { - fn handle_dmp_messages( - iter: impl Iterator)>, - max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{DmpMessageHandler, TestExt}; + impl $crate::DmpMessageHandler for $name { + fn handle_dmp_messages( + iter: impl Iterator)>, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{DmpMessageHandler, TestExt}; - $name::execute_with(|| { - <$dmp_message_handler>::handle_dmp_messages(iter, max_weight) - }) - } + $name::execute_with(|| { + ::DmpMessageHandler::handle_dmp_messages(iter, max_weight) + }) } - )+ - }; + } + } } #[macro_export] @@ -310,13 +321,13 @@ macro_rules! __impl_ext_for_relay_chain { #[macro_export] macro_rules! __impl_ext_for_parachain { // entry point: generate ext name - ($name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr, $para_id:expr) => { + ($name:ident, $genesis:expr, $on_init:expr, $para_id:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_parachain!(@impl $name, $runtime, $origin, $system, $genesis, $on_init, $para_id, []); + $crate::__impl_ext_for_parachain!(@impl $name, $genesis, $on_init, $para_id, []); } }; // impl - (@impl $name:ident, $runtime:path, $origin:path, $system:path, $genesis:expr, $on_init:expr, $para_id:expr, $ext_name:ident) => { + (@impl $name:ident, $genesis:expr, $on_init:expr, $para_id:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> = $crate::RefCell::new(<$name>::build_new_ext($genesis)); @@ -337,7 +348,7 @@ macro_rules! __impl_ext_for_parachain { $ext_name.with(|v| { v.borrow_mut().execute_with(|| { use $crate::{Get, Hooks}; - type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; + // type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; // let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); // let block_number = <$system>::block_number(); @@ -347,12 +358,12 @@ macro_rules! __impl_ext_for_parachain { let para_id = Self::para_id(); // panic!("{:?}", para_id); - let _ = ParachainSystem::set_validation_data( - <$origin>::none(), + let _ = ::ParachainSystem::set_validation_data( + ::Origin::none(), <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), 1), ); // set `AnnouncedHrmpMessagesPerCandidate` - ParachainSystem::on_initialize(block_number); + ::ParachainSystem::on_initialize(block_number); }) }); } @@ -376,7 +387,7 @@ macro_rules! __impl_ext_for_parachain { ext.execute_with(|| { $on_init; sp_tracing::try_init_simple(); - <$system>::set_block_number(1); + ::System::set_block_number(1); }); ext } @@ -395,7 +406,7 @@ macro_rules! __impl_ext_for_parachain { // Make sure the Network is initialized <$name>::init(); - type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; + // type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; let network_name = <$name>::network_name(); @@ -433,8 +444,8 @@ macro_rules! __impl_ext_for_parachain { let para_id = <$name>::para_id().into(); // panic!("{}", relay_block_number); - let _ = ParachainSystem::set_validation_data( - <$origin>::none(), + let _ = ::ParachainSystem::set_validation_data( + ::Origin::none(), <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), ); }) @@ -458,8 +469,8 @@ macro_rules! __impl_ext_for_parachain { ); // get messages - ParachainSystem::on_finalize(block_number); - let collation_info = ParachainSystem::collect_collation_info(&mock_header); + ::ParachainSystem::on_finalize(block_number); + let collation_info = ::ParachainSystem::collect_collation_info(&mock_header); // send upward messages // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); @@ -491,7 +502,7 @@ macro_rules! __impl_ext_for_parachain { // clean messages - ParachainSystem::on_initialize(block_number); + ::ParachainSystem::on_initialize(block_number); }) }); From 0d04b8b47d3da27b385080f93f41179a72c0d2f0 Mon Sep 17 00:00:00 2001 From: Javier Viola Date: Fri, 5 May 2023 19:53:16 -0300 Subject: [PATCH 24/60] bump zombienet version (#2525) * bump zombienet version * fix para registration args --- .gitlab-ci.yml | 2 +- zombienet/tests/register-para.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7166ace649f..93471823d26 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,7 @@ variables: CI_IMAGE: "paritytech/ci-linux:production" DOCKER_OS: "debian:stretch" ARCH: "x86_64" - ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.43" + ZOMBIENET_IMAGE: "docker.io/paritytech/zombienet:v1.3.50" BUILDAH_IMAGE: "quay.io/buildah/stable:v1.29" BUILDAH_COMMAND: "buildah --storage-driver overlay2" diff --git a/zombienet/tests/register-para.js b/zombienet/tests/register-para.js index c080904aefe..a8fbab94673 100644 --- a/zombienet/tests/register-para.js +++ b/zombienet/tests/register-para.js @@ -3,7 +3,18 @@ async function run(nodeName, networkInfo, args) { const para = networkInfo.paras[paraIdStr]; const relayNode = networkInfo.relay[0]; - await zombie.registerParachain(parseInt(paraIdStr,10),para.wasmPath, para.statePath, relayNode.wsUri, "//Alice", true); + const registerParachainOptions = { + id: parseInt(paraIdStr,10), + wasmPath: para.wasmPath, + statePath: para.statePath, + apiUrl: relayNode.wsUri, + onboardAsParachain: true, + seed: "//Alice", + finalization: true + }; + + + await zombie.registerParachain(registerParachainOptions); } module.exports = { run } From 4dc50c8d89498fc24208e6c2c395ea9b47bdd0db Mon Sep 17 00:00:00 2001 From: Sebastian Kunert Date: Sat, 6 May 2023 07:58:25 +0200 Subject: [PATCH 25/60] Make zombienet tests required (#2527) Co-authored-by: parity-processbot <> --- scripts/ci/gitlab/pipeline/zombienet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ci/gitlab/pipeline/zombienet.yml b/scripts/ci/gitlab/pipeline/zombienet.yml index d76531b19e7..d5ab3e13d42 100644 --- a/scripts/ci/gitlab/pipeline/zombienet.yml +++ b/scripts/ci/gitlab/pipeline/zombienet.yml @@ -35,7 +35,7 @@ expire_in: 2 days paths: - ./zombienet-logs - allow_failure: true + allow_failure: false retry: 2 tags: - zombienet-polkadot-integration-test From c312f0b9a67c58c049dfb3b5a12e464b977c5005 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Sat, 6 May 2023 08:01:03 +0200 Subject: [PATCH 26/60] Fix Clippy (#2522) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Import Clippy config from Polkadot Signed-off-by: Oliver Tale-Yazdi * Auto clippy fix Signed-off-by: Oliver Tale-Yazdi * No tabs in comments Signed-off-by: Oliver Tale-Yazdi * Prefer matches Signed-off-by: Oliver Tale-Yazdi * Dont drop references Signed-off-by: Oliver Tale-Yazdi * Trivial Signed-off-by: Oliver Tale-Yazdi * Refactor Signed-off-by: Oliver Tale-Yazdi * fmt Signed-off-by: Oliver Tale-Yazdi * add clippy to ci * Clippy reborrow Signed-off-by: Oliver Tale-Yazdi * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher * Update client/pov-recovery/src/lib.rs Co-authored-by: Bastian Köcher * Partially revert 'Prefer matches' Using matches! instead of match does give less compiler checks as per review from @chevdor. Partially reverts 8c0609677f3ea040f77fffd5be6facf7c3fec95c Signed-off-by: Oliver Tale-Yazdi * Update .cargo/config.toml Co-authored-by: Chevdor * Revert revert 💩 Should be fine to use matches! macro since it is an explicit whitelist, not wildcard matching. --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: alvicsam Co-authored-by: Bastian Köcher Co-authored-by: Chevdor Co-authored-by: parity-processbot <> --- .cargo/config.toml | 32 ++ .../src/messages_benchmarking.rs | 12 +- .../src/parachains_benchmarking.rs | 2 +- bridges/modules/messages/src/benchmarking.rs | 12 +- bridges/modules/messages/src/mock.rs | 2 +- bridges/modules/relayers/src/benchmarking.rs | 6 +- client/cli/src/lib.rs | 4 +- client/collator/src/lib.rs | 30 +- client/consensus/aura/src/import_queue.rs | 4 +- client/consensus/common/src/level_monitor.rs | 2 +- .../common/src/parachain_consensus.rs | 10 +- client/consensus/common/src/tests.rs | 10 +- client/consensus/relay-chain/src/lib.rs | 4 +- client/network/src/tests.rs | 6 +- client/pov-recovery/src/lib.rs | 8 +- .../src/lib.rs | 6 +- .../src/collator_overseer.rs | 4 +- client/service/src/lib.rs | 2 +- .../collator-selection/src/benchmarking.rs | 6 +- pallets/collator-selection/src/lib.rs | 8 +- pallets/collator-selection/src/mock.rs | 10 +- pallets/collator-selection/src/tests.rs | 16 +- pallets/collator-selection/src/weights.rs | 94 +++--- pallets/dmp-queue/src/lib.rs | 28 +- pallets/dmp-queue/src/migration.rs | 2 +- pallets/parachain-system/src/lib.rs | 41 ++- pallets/parachain-system/src/tests.rs | 19 +- .../src/validate_block/tests.rs | 10 +- pallets/xcmp-queue/src/lib.rs | 2 +- pallets/xcmp-queue/src/migration.rs | 2 +- pallets/xcmp-queue/src/mock.rs | 2 +- pallets/xcmp-queue/src/tests.rs | 12 +- pallets/xcmp-queue/src/weights.rs | 24 +- parachain-template/node/src/command.rs | 6 +- parachain-template/runtime/src/lib.rs | 4 +- parachains/common/src/impls.rs | 1 - parachains/pallets/parachain-info/src/lib.rs | 2 +- .../assets/common/src/foreign_creators.rs | 4 +- .../runtimes/assets/common/src/matching.rs | 17 +- .../runtimes/assets/statemine/src/lib.rs | 11 +- .../assets/statemine/src/weights/xcm/mod.rs | 9 +- .../assets/statemine/src/xcm_config.rs | 277 +++++++++-------- .../runtimes/assets/statemine/tests/tests.rs | 27 +- .../runtimes/assets/statemint/src/lib.rs | 9 +- .../assets/statemint/src/weights/xcm/mod.rs | 9 +- .../assets/statemint/src/xcm_config.rs | 151 +++++----- .../runtimes/assets/statemint/tests/tests.rs | 23 +- .../runtimes/assets/test-utils/src/lib.rs | 23 +- .../assets/test-utils/src/test_cases.rs | 26 +- .../runtimes/assets/westmint/src/lib.rs | 9 +- .../assets/westmint/src/weights/xcm/mod.rs | 9 +- .../assets/westmint/src/xcm_config.rs | 282 +++++++++--------- .../runtimes/assets/westmint/tests/tests.rs | 27 +- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 8 +- .../bridge-hub-kusama/src/weights/xcm/mod.rs | 9 +- .../bridge-hub-kusama/src/xcm_config.rs | 42 ++- .../bridge-hub-polkadot/src/lib.rs | 8 +- .../src/weights/xcm/mod.rs | 11 +- .../bridge-hub-polkadot/src/xcm_config.rs | 42 ++- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 8 +- .../bridge-hub-rococo/src/weights/xcm/mod.rs | 9 +- .../xcm/pallet_xcm_benchmarks_generic.rs | 6 +- .../bridge-hub-rococo/src/xcm_config.rs | 62 ++-- .../bridge-hubs/test-utils/src/test_cases.rs | 8 +- .../src/fellowship/migration.rs | 4 +- .../src/fellowship/tracks.rs | 30 +- .../collectives-polkadot/src/impls.rs | 9 +- .../collectives-polkadot/src/lib.rs | 6 +- .../collectives-polkadot/src/xcm_config.rs | 92 +++--- .../contracts/contracts-rococo/src/lib.rs | 2 +- parachains/runtimes/starters/shell/src/lib.rs | 2 +- parachains/runtimes/testing/penpal/src/lib.rs | 2 +- .../runtimes/testing/penpal/src/xcm_config.rs | 8 +- .../testing/rococo-parachain/src/lib.rs | 14 +- .../src/chain_spec/bridge_hubs.rs | 2 +- polkadot-parachain/src/command.rs | 16 +- polkadot-parachain/src/rpc.rs | 2 +- polkadot-parachain/src/service.rs | 4 +- .../tests/benchmark_storage_works.rs | 4 +- polkadot-parachain/tests/common.rs | 4 +- polkadot-parachain/tests/purge_chain_works.rs | 2 +- .../parachain-inherent/src/client_side.rs | 25 +- primitives/parachain-inherent/src/mock.rs | 4 +- primitives/timestamp/src/lib.rs | 4 +- primitives/utility/src/lib.rs | 22 +- scripts/ci/gitlab/pipeline/test.yml | 8 + test/client/src/block_builder.rs | 6 +- test/client/src/lib.rs | 1 - test/relay-sproof-builder/src/lib.rs | 2 +- .../service/benches/transaction_throughput.rs | 22 +- test/service/src/chain_spec.rs | 3 +- test/service/src/lib.rs | 8 +- 92 files changed, 911 insertions(+), 968 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000000..66b28b3485d --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,32 @@ +# +# An auto defined `clippy` feature was introduced, +# but it was found to clash with user defined features, +# so was renamed to `cargo-clippy`. +# +# If you want standard clippy run: +# RUSTFLAGS= cargo clippy +[target.'cfg(feature = "cargo-clippy")'] +rustflags = [ + "-Aclippy::all", + "-Dclippy::correctness", + "-Aclippy::if-same-then-else", + "-Aclippy::clone-double-ref", + "-Dclippy::complexity", + "-Aclippy::zero-prefixed-literal", # 00_1000_000 + "-Aclippy::type_complexity", # raison d'etre + "-Aclippy::nonminimal-bool", # maybe + "-Aclippy::borrowed-box", # Reasonable to fix this one + "-Aclippy::too-many-arguments", # (Turning this on would lead to) + "-Aclippy::unnecessary_cast", # Types may change + "-Aclippy::identity-op", # One case where we do 0 + + "-Aclippy::useless_conversion", # Types may change + "-Aclippy::unit_arg", # styalistic. + "-Aclippy::option-map-unit-fn", # styalistic + "-Aclippy::bind_instead_of_map", # styalistic + "-Aclippy::erasing_op", # E.g. 0 * DOLLARS + "-Aclippy::eq_op", # In tests we test equality. + "-Aclippy::while_immutable_condition", # false positives + "-Aclippy::needless_option_as_deref", # false positives + "-Aclippy::derivable_impls", # false positives + "-Aclippy::stable_sort_primitive", # prefer stable sort +] diff --git a/bridges/bin/runtime-common/src/messages_benchmarking.rs b/bridges/bin/runtime-common/src/messages_benchmarking.rs index b067523c305..9d90f12ed5c 100644 --- a/bridges/bin/runtime-common/src/messages_benchmarking.rs +++ b/bridges/bin/runtime-common/src/messages_benchmarking.rs @@ -182,11 +182,7 @@ where // update runtime storage let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::(state_root); - FromBridgedChainMessagesDeliveryProof { - bridged_header_hash: bridged_header_hash.into(), - storage_proof, - lane, - } + FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane } } /// Prepare proof of messages delivery for the `receive_messages_delivery_proof` call. @@ -211,11 +207,7 @@ where let (_, bridged_header_hash) = insert_header_to_parachains_pallet::>>(state_root); - FromBridgedChainMessagesDeliveryProof { - bridged_header_hash: bridged_header_hash.into(), - storage_proof, - lane, - } + FromBridgedChainMessagesDeliveryProof { bridged_header_hash, storage_proof, lane } } /// Prepare in-memory message delivery proof, without inserting anything to the runtime storage. diff --git a/bridges/bin/runtime-common/src/parachains_benchmarking.rs b/bridges/bin/runtime-common/src/parachains_benchmarking.rs index aad53673c3a..8a9b8547fbf 100644 --- a/bridges/bin/runtime-common/src/parachains_benchmarking.rs +++ b/bridges/bin/runtime-common/src/parachains_benchmarking.rs @@ -60,7 +60,7 @@ where TrieDBMutBuilderV1::::new(&mut mdb, &mut state_root).build(); // insert parachain heads - for (i, parachain) in parachains.into_iter().enumerate() { + for (i, parachain) in parachains.iter().enumerate() { let storage_key = parachain_head_storage_key_at_source(R::ParasPalletName::get(), *parachain); let leaf_data = if i == 0 { diff --git a/bridges/modules/messages/src/benchmarking.rs b/bridges/modules/messages/src/benchmarking.rs index aab8855a729..7db3ae64352 100644 --- a/bridges/modules/messages/src/benchmarking.rs +++ b/bridges/modules/messages/src/benchmarking.rs @@ -139,7 +139,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); } @@ -172,7 +172,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 2, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 22, ); } @@ -208,7 +208,7 @@ benchmarks_instance_pallet! { }); }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { - let lane_state = crate::InboundLanes::::get(&T::bench_lane_id()); + let lane_state = crate::InboundLanes::::get(T::bench_lane_id()); assert_eq!(lane_state.last_delivered_nonce(), 21); assert_eq!(lane_state.last_confirmed_nonce, 20); } @@ -240,7 +240,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); } @@ -274,7 +274,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); } @@ -432,7 +432,7 @@ benchmarks_instance_pallet! { }: receive_messages_proof(RawOrigin::Signed(relayer_id_on_target), relayer_id_on_source, proof, 1, dispatch_weight) verify { assert_eq!( - crate::InboundLanes::::get(&T::bench_lane_id()).last_delivered_nonce(), + crate::InboundLanes::::get(T::bench_lane_id()).last_delivered_nonce(), 21, ); assert!(T::is_message_successfully_dispatched(21)); diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index 2e45d5b601f..7aab79ae4a9 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/modules/messages/src/mock.rs @@ -185,7 +185,7 @@ impl crate::benchmarking::Config<()> for TestRuntime { // in mock run we only care about benchmarks correctness, not the benchmark results // => ignore size related arguments let (messages, total_dispatch_weight) = - params.message_nonces.into_iter().map(|n| message(n, REGULAR_PAYLOAD)).fold( + params.message_nonces.map(|n| message(n, REGULAR_PAYLOAD)).fold( (Vec::new(), Weight::zero()), |(mut messages, total_dispatch_weight), message| { let weight = REGULAR_PAYLOAD.declared_weight; diff --git a/bridges/modules/relayers/src/benchmarking.rs b/bridges/modules/relayers/src/benchmarking.rs index d66a11ff06d..dfdecad31af 100644 --- a/bridges/modules/relayers/src/benchmarking.rs +++ b/bridges/modules/relayers/src/benchmarking.rs @@ -104,7 +104,7 @@ benchmarks! { // create slash destination account let lane = LaneId([0, 0, 0, 0]); let slash_destination = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain); - T::prepare_rewards_account(slash_destination.clone(), Zero::zero()); + T::prepare_rewards_account(slash_destination, Zero::zero()); }: { crate::Pallet::::slash_and_deregister(&relayer, slash_destination) } @@ -121,10 +121,10 @@ benchmarks! { let account_params = RewardsAccountParams::new(lane, *b"test", RewardsAccountOwner::ThisChain); }: { - crate::Pallet::::register_relayer_reward(account_params.clone(), &relayer, One::one()); + crate::Pallet::::register_relayer_reward(account_params, &relayer, One::one()); } verify { - assert_eq!(RelayerRewards::::get(relayer, &account_params), Some(One::one())); + assert_eq!(RelayerRewards::::get(relayer, account_params), Some(One::one())); } impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::TestRuntime) diff --git a/client/cli/src/lib.rs b/client/cli/src/lib.rs index a4daa9ee506..d77db6baedf 100644 --- a/client/cli/src/lib.rs +++ b/client/cli/src/lib.rs @@ -93,7 +93,7 @@ impl PurgeChainCmd { io::stdin().read_line(&mut input)?; let input = input.trim(); - match input.chars().nth(0) { + match input.chars().next() { Some('y') | Some('Y') => {}, _ => { println!("Aborted"); @@ -103,7 +103,7 @@ impl PurgeChainCmd { } for db_path in &db_paths { - match fs::remove_dir_all(&db_path) { + match fs::remove_dir_all(db_path) { Ok(_) => { println!("{:?} removed.", &db_path); }, diff --git a/client/collator/src/lib.rs b/client/collator/src/lib.rs index a931201f6cc..9e3b4953c0a 100644 --- a/client/collator/src/lib.rs +++ b/client/collator/src/lib.rs @@ -270,16 +270,14 @@ where let (header, extrinsics) = candidate.block.deconstruct(); - let compact_proof = match candidate - .proof - .into_compact_proof::>(last_head.state_root().clone()) - { - Ok(proof) => proof, - Err(e) => { - tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e); - return None - }, - }; + let compact_proof = + match candidate.proof.into_compact_proof::>(*last_head.state_root()) { + Ok(proof) => proof, + Err(e) => { + tracing::error!(target: "cumulus-collator", "Failed to compact proof: {:?}", e); + return None + }, + }; // Create the parachain block data for the validators. let b = ParachainBlockData::::new(header, extrinsics, compact_proof); @@ -451,7 +449,7 @@ mod tests { .build() .expect("Builds overseer"); - spawner.spawn("overseer", None, overseer.run().then(|_| async { () }).boxed()); + spawner.spawn("overseer", None, overseer.run().then(|_| async {}).boxed()); let collator_start = start_collator(StartCollatorParams { runtime_api: client.clone(), @@ -461,7 +459,7 @@ mod tests { spawner, para_id, key: CollatorPair::generate().0, - parachain_consensus: Box::new(DummyParachainConsensus { client: client.clone() }), + parachain_consensus: Box::new(DummyParachainConsensus { client }), }); block_on(collator_start); @@ -469,12 +467,10 @@ mod tests { .0 .expect("message should be send by `start_collator` above."); - let config = match msg { - CollationGenerationMessage::Initialize(config) => config, - }; + let CollationGenerationMessage::Initialize(config) = msg; - let mut validation_data = PersistedValidationData::default(); - validation_data.parent_head = header.encode().into(); + let validation_data = + PersistedValidationData { parent_head: header.encode().into(), ..Default::default() }; let relay_parent = Default::default(); let collation = block_on((config.collator)(relay_parent, &validation_data)) diff --git a/client/consensus/aura/src/import_queue.rs b/client/consensus/aura/src/import_queue.rs index 862abfb349a..725e841881c 100644 --- a/client/consensus/aura/src/import_queue.rs +++ b/client/consensus/aura/src/import_queue.rs @@ -51,7 +51,7 @@ pub struct ImportQueueParams<'a, I, C, CIDP, S> { } /// Start an import queue for the Aura consensus algorithm. -pub fn import_queue<'a, P, Block, I, C, S, CIDP>( +pub fn import_queue( ImportQueueParams { block_import, client, @@ -59,7 +59,7 @@ pub fn import_queue<'a, P, Block, I, C, S, CIDP>( spawner, registry, telemetry, - }: ImportQueueParams<'a, I, C, CIDP, S>, + }: ImportQueueParams<'_, I, C, CIDP, S>, ) -> Result, sp_consensus::Error> where Block: BlockT, diff --git a/client/consensus/common/src/level_monitor.rs b/client/consensus/common/src/level_monitor.rs index 3576ced1858..ebdfaaf26ca 100644 --- a/client/consensus/common/src/level_monitor.rs +++ b/client/consensus/common/src/level_monitor.rs @@ -22,7 +22,7 @@ use std::{ sync::Arc, }; -const LOG_TARGET: &'static str = "level-monitor"; +const LOG_TARGET: &str = "level-monitor"; /// Value good enough to be used with parachains using the current backend implementation /// that ships with Substrate. This value may change in the future. diff --git a/client/consensus/common/src/parachain_consensus.rs b/client/consensus/common/src/parachain_consensus.rs index 734f682d25b..78f4e45cd81 100644 --- a/client/consensus/common/src/parachain_consensus.rs +++ b/client/consensus/common/src/parachain_consensus.rs @@ -325,7 +325,6 @@ async fn handle_new_block_imported( match parachain.block_status(unset_hash) { Ok(BlockStatus::InChainWithState) => { - drop(unset_best_header); let unset_best_header = unset_best_header_opt .take() .expect("We checked above that the value is set; qed"); @@ -433,8 +432,11 @@ async fn handle_new_best_parachain_head( } } -async fn import_block_as_new_best(hash: Block::Hash, header: Block::Header, parachain: &P) -where +async fn import_block_as_new_best( + hash: Block::Hash, + header: Block::Header, + mut parachain: &P, +) where Block: BlockT, P: UsageProvider + Send + Sync + BlockBackend, for<'a> &'a P: BlockImport, @@ -456,7 +458,7 @@ where block_import_params.fork_choice = Some(ForkChoiceStrategy::Custom(true)); block_import_params.import_existing = true; - if let Err(err) = (&*parachain).import_block(block_import_params).await { + if let Err(err) = parachain.import_block(block_import_params).await { tracing::warn!( target: LOG_TARGET, block_hash = ?hash, diff --git a/client/consensus/common/src/tests.rs b/client/consensus/common/src/tests.rs index 23516d96388..f1bc4d42b8a 100644 --- a/client/consensus/common/src/tests.rs +++ b/client/consensus/common/src/tests.rs @@ -337,7 +337,7 @@ fn follow_new_best_with_dummy_recovery_works() { Some(recovery_chan_tx), ); - let block = build_block(&*client.clone(), None, None); + let block = build_block(&*client, None, None); let block_clone = block.clone(); let client_clone = client.clone(); @@ -547,7 +547,6 @@ fn do_not_set_best_block_to_older_block() { let client = Arc::new(TestClientBuilder::with_backend(backend).build()); let blocks = (0..NUM_BLOCKS) - .into_iter() .map(|_| build_and_import_block(client.clone(), true)) .collect::>(); @@ -559,7 +558,6 @@ fn do_not_set_best_block_to_older_block() { let consensus = run_parachain_consensus(100.into(), client.clone(), relay_chain, Arc::new(|_, _| {}), None); - let client2 = client.clone(); let work = async move { new_best_heads_sender .unbounded_send(blocks[NUM_BLOCKS - 2].header().clone()) @@ -579,7 +577,7 @@ fn do_not_set_best_block_to_older_block() { }); // Build and import a new best block. - build_and_import_block(client2.clone(), true); + build_and_import_block(client, true); } #[test] @@ -607,7 +605,6 @@ fn prune_blocks_on_level_overflow() { let id0 = block0.header.hash(); let blocks1 = (0..LEVEL_LIMIT) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -622,7 +619,6 @@ fn prune_blocks_on_level_overflow() { let id10 = blocks1[0].header.hash(); let blocks2 = (0..2) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -720,7 +716,6 @@ fn restore_limit_monitor() { let id00 = block00.header.hash(); let blocks1 = (0..LEVEL_LIMIT + 1) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, @@ -735,7 +730,6 @@ fn restore_limit_monitor() { let id10 = blocks1[0].header.hash(); let _ = (0..LEVEL_LIMIT) - .into_iter() .map(|i| { build_and_import_block_ext( &*client, diff --git a/client/consensus/relay-chain/src/lib.rs b/client/consensus/relay-chain/src/lib.rs index a31a9ec8b2a..529b78c1319 100644 --- a/client/consensus/relay-chain/src/lib.rs +++ b/client/consensus/relay-chain/src/lib.rs @@ -161,7 +161,7 @@ where relay_parent: PHash, validation_data: &PersistedValidationData, ) -> Option> { - let proposer_future = self.proposer_factory.lock().init(&parent); + let proposer_future = self.proposer_factory.lock().init(parent); let proposer = proposer_future .await @@ -171,7 +171,7 @@ where .ok()?; let inherent_data = - self.inherent_data(parent.hash(), &validation_data, relay_parent).await?; + self.inherent_data(parent.hash(), validation_data, relay_parent).await?; let Proposal { block, storage_changes, proof } = proposer .propose( diff --git a/client/network/src/tests.rs b/client/network/src/tests.rs index eefb88f2f7b..08127fe390a 100644 --- a/client/network/src/tests.rs +++ b/client/network/src/tests.rs @@ -129,7 +129,7 @@ impl RelayChainInterface for DummyRelayChainInterface { para_id: 0u32.into(), relay_parent: PHash::random(), collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), @@ -293,7 +293,7 @@ async fn make_gossip_message_and_header( para_id: 0u32.into(), relay_parent, collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), @@ -484,7 +484,7 @@ async fn check_statement_seconded() { para_id: 0u32.into(), relay_parent: PHash::random(), collator: CollatorPair::generate().0.public(), - persisted_validation_data_hash: PHash::random().into(), + persisted_validation_data_hash: PHash::random(), pov_hash: PHash::random(), erasure_root: PHash::random(), signature: sp_core::sr25519::Signature([0u8; 64]).into(), diff --git a/client/pov-recovery/src/lib.rs b/client/pov-recovery/src/lib.rs index 7d92934c784..62f31b6c061 100644 --- a/client/pov-recovery/src/lib.rs +++ b/client/pov-recovery/src/lib.rs @@ -40,7 +40,7 @@ //! 4a. After it is recovered, we restore the block and import it. //! //! 4b. Since we are trying to recover pending candidates, availability is not guaranteed. If the block -//! PoV is not yet available, we retry. +//! PoV is not yet available, we retry. //! //! If we need to recover multiple PoV blocks (which should hopefully not happen in real life), we //! make sure that the blocks are imported in the correct order. @@ -190,7 +190,7 @@ impl RecoveryQueue { /// Get the next hash for block recovery. pub async fn next_recovery(&mut self) -> Block::Hash { loop { - if let Some(_) = self.signaling_queue.next().await { + if self.signaling_queue.next().await.is_some() { if let Some(hash) = self.recovery_queue.pop_front() { return hash } else { @@ -309,10 +309,10 @@ where /// Block is no longer waiting for recovery fn clear_waiting_recovery(&mut self, block_hash: &Block::Hash) { - self.candidates.get_mut(block_hash).map(|candidate| { + if let Some(candidate) = self.candidates.get_mut(block_hash) { // Prevents triggering an already enqueued recovery request candidate.waiting_recovery = false; - }); + } } /// Handle a finalized block with the given `block_number`. diff --git a/client/relay-chain-inprocess-interface/src/lib.rs b/client/relay-chain-inprocess-interface/src/lib.rs index f230a23bd25..c1e19bd20b6 100644 --- a/client/relay-chain-inprocess-interface/src/lib.rs +++ b/client/relay-chain-inprocess-interface/src/lib.rs @@ -241,7 +241,7 @@ where self.full_client .import_notification_stream() .filter_map(|notification| async move { - notification.is_new_best.then(|| notification.header) + notification.is_new_best.then_some(notification.header) }); Ok(Box::pin(notifications_stream)) } @@ -428,7 +428,7 @@ mod tests { ( client.clone(), block, - RelayChainInProcessInterface::new(client, backend.clone(), dummy_network, mock_handle), + RelayChainInProcessInterface::new(client, backend, dummy_network, mock_handle), ) } @@ -483,7 +483,7 @@ mod tests { let hash = block.hash(); let ext = construct_transfer_extrinsic( - &*client, + &client, sp_keyring::Sr25519Keyring::Alice, sp_keyring::Sr25519Keyring::Bob, 1000, diff --git a/client/relay-chain-minimal-node/src/collator_overseer.rs b/client/relay-chain-minimal-node/src/collator_overseer.rs index a2ad87fa758..b488db962f3 100644 --- a/client/relay-chain-minimal-node/src/collator_overseer.rs +++ b/client/relay-chain-minimal-node/src/collator_overseer.rs @@ -76,7 +76,7 @@ pub(crate) struct CollatorOverseerGenArgs<'a> { pub peer_set_protocol_names: PeerSetProtocolNames, } -fn build_overseer<'a>( +fn build_overseer( connector: OverseerConnector, CollatorOverseerGenArgs { runtime_client, @@ -90,7 +90,7 @@ fn build_overseer<'a>( collator_pair, req_protocol_names, peer_set_protocol_names, - }: CollatorOverseerGenArgs<'a>, + }: CollatorOverseerGenArgs<'_>, ) -> Result< (Overseer, Arc>, OverseerHandle), RelayChainError, diff --git a/client/service/src/lib.rs b/client/service/src/lib.rs index 894db91ba8f..ac18cb39fcf 100644 --- a/client/service/src/lib.rs +++ b/client/service/src/lib.rs @@ -441,7 +441,7 @@ where ) .await .map_err(|e| format!("{e:?}"))? - .ok_or_else(|| "Could not find parachain head in relay chain")?; + .ok_or("Could not find parachain head in relay chain")?; let target_block = B::Header::decode(&mut &validation_data.parent_head.0[..]) .map_err(|e| format!("Failed to decode parachain head: {e}"))?; diff --git a/pallets/collator-selection/src/benchmarking.rs b/pallets/collator-selection/src/benchmarking.rs index 8a222511137..6b386f7d697 100644 --- a/pallets/collator-selection/src/benchmarking.rs +++ b/pallets/collator-selection/src/benchmarking.rs @@ -129,7 +129,7 @@ benchmarks! { T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: { assert_ok!( - >::set_desired_candidates(origin, max.clone()) + >::set_desired_candidates(origin, max) ); } verify { @@ -142,7 +142,7 @@ benchmarks! { T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; }: { assert_ok!( - >::set_candidacy_bond(origin, bond_amount.clone()) + >::set_candidacy_bond(origin, bond_amount) ); } verify { @@ -162,7 +162,7 @@ benchmarks! { let caller: T::AccountId = whitelisted_caller(); let bond: BalanceOf = T::Currency::minimum_balance() * 2u32.into(); - T::Currency::make_free_balance_be(&caller, bond.clone()); + T::Currency::make_free_balance_be(&caller, bond); >::set_keys( RawOrigin::Signed(caller.clone()).into(), diff --git a/pallets/collator-selection/src/lib.rs b/pallets/collator-selection/src/lib.rs index 3dba6846cc3..a727e21f0fd 100644 --- a/pallets/collator-selection/src/lib.rs +++ b/pallets/collator-selection/src/lib.rs @@ -238,8 +238,8 @@ pub mod pallet { "genesis desired_candidates are more than T::MaxCandidates", ); - >::put(&self.desired_candidates); - >::put(&self.candidacy_bond); + >::put(self.desired_candidates); + >::put(self.candidacy_bond); >::put(bounded_invulnerables); } } @@ -326,7 +326,7 @@ pub mod pallet { if max > T::MaxCandidates::get() { log::warn!("max > T::MaxCandidates; you might need to run benchmarks again"); } - >::put(&max); + >::put(max); Self::deposit_event(Event::NewDesiredCandidates { desired_candidates: max }); Ok(().into()) } @@ -339,7 +339,7 @@ pub mod pallet { bond: BalanceOf, ) -> DispatchResultWithPostInfo { T::UpdateOrigin::ensure_origin(origin)?; - >::put(&bond); + >::put(bond); Self::deposit_event(Event::NewCandidacyBond { bond_amount: bond }); Ok(().into()) } diff --git a/pallets/collator-selection/src/mock.rs b/pallets/collator-selection/src/mock.rs index ac776e3d216..5470e4037ec 100644 --- a/pallets/collator-selection/src/mock.rs +++ b/pallets/collator-selection/src/mock.rs @@ -152,12 +152,12 @@ pub struct TestSessionHandler; impl pallet_session::SessionHandler for TestSessionHandler { const KEY_TYPE_IDS: &'static [sp_runtime::KeyTypeId] = &[UintAuthorityId::ID]; fn on_genesis_session(keys: &[(u64, Ks)]) { - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_new_session(_: bool, keys: &[(u64, Ks)], _: &[(u64, Ks)]) { SessionChangeBlock::set(System::block_number()); dbg!(keys.len()); - SessionHandlerCollators::set(keys.into_iter().map(|(a, _)| *a).collect::>()) + SessionHandlerCollators::set(keys.iter().map(|(a, _)| *a).collect::>()) } fn on_before_session_ending() {} fn on_disabled(_: u32) {} @@ -195,11 +195,7 @@ parameter_types! { pub struct IsRegistered; impl ValidatorRegistration for IsRegistered { fn is_registered(id: &u64) -> bool { - if *id == 7u64 { - false - } else { - true - } + *id != 7u64 } } diff --git a/pallets/collator-selection/src/tests.rs b/pallets/collator-selection/src/tests.rs index 459b107ecc5..0ae3e3d5a18 100644 --- a/pallets/collator-selection/src/tests.rs +++ b/pallets/collator-selection/src/tests.rs @@ -45,7 +45,7 @@ fn it_should_set_invulnerables() { // cannot set with non-root. assert_noop!( - CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set.clone()), + CollatorSelection::set_invulnerables(RuntimeOrigin::signed(1), new_set), BadOrigin ); @@ -54,7 +54,7 @@ fn it_should_set_invulnerables() { assert_noop!( CollatorSelection::set_invulnerables( RuntimeOrigin::signed(RootAccount::get()), - invulnerables.clone() + invulnerables ), Error::::ValidatorNotRegistered ); @@ -184,8 +184,8 @@ fn cannot_register_dupe_candidate() { #[test] fn cannot_register_as_candidate_if_poor() { new_test_ext().execute_with(|| { - assert_eq!(Balances::free_balance(&3), 100); - assert_eq!(Balances::free_balance(&33), 0); + assert_eq!(Balances::free_balance(3), 100); + assert_eq!(Balances::free_balance(33), 0); // works assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); @@ -208,14 +208,14 @@ fn register_as_candidate_works() { assert_eq!(CollatorSelection::invulnerables(), vec![1, 2]); // take two endowed, non-invulnerables accounts. - assert_eq!(Balances::free_balance(&3), 100); - assert_eq!(Balances::free_balance(&4), 100); + assert_eq!(Balances::free_balance(3), 100); + assert_eq!(Balances::free_balance(4), 100); assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(3))); assert_ok!(CollatorSelection::register_as_candidate(RuntimeOrigin::signed(4))); - assert_eq!(Balances::free_balance(&3), 90); - assert_eq!(Balances::free_balance(&4), 90); + assert_eq!(Balances::free_balance(3), 90); + assert_eq!(Balances::free_balance(4), 90); assert_eq!(CollatorSelection::candidates().len(), 2); }); diff --git a/pallets/collator-selection/src/weights.rs b/pallets/collator-selection/src/weights.rs index 32e816b5dbe..874cec8ae36 100644 --- a/pallets/collator-selection/src/weights.rs +++ b/pallets/collator-selection/src/weights.rs @@ -39,93 +39,91 @@ pub trait WeightInfo { pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { fn set_invulnerables(b: u32) -> Weight { - Weight::from_parts(18_563_000 as u64, 0) + Weight::from_parts(18_563_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + .saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } fn set_desired_candidates() -> Weight { - Weight::from_parts(16_363_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(16_363_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } fn set_candidacy_bond() -> Weight { - Weight::from_parts(16_840_000 as u64, 0).saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(16_840_000_u64, 0).saturating_add(T::DbWeight::get().writes(1_u64)) } fn register_as_candidate(c: u32) -> Weight { - Weight::from_parts(71_196_000 as u64, 0) + Weight::from_parts(71_196_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } fn leave_intent(c: u32) -> Weight { - Weight::from_parts(55_336_000 as u64, 0) + Weight::from_parts(55_336_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } fn note_author() -> Weight { - Weight::from_parts(71_461_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(3 as u64)) - .saturating_add(T::DbWeight::get().writes(4 as u64)) + Weight::from_parts(71_461_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) } fn new_session(r: u32, c: u32) -> Weight { - Weight::from_parts(0 as u64, 0) + Weight::from_parts(0_u64, 0) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64)) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64))) - .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64))) - .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64))) - .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64))) + .saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(T::DbWeight::get().reads(1_u64.saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().reads(2_u64.saturating_mul(c as u64))) + .saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(r as u64))) + .saturating_add(T::DbWeight::get().writes(2_u64.saturating_mul(c as u64))) } } // For backwards compatibility and tests impl WeightInfo for () { fn set_invulnerables(b: u32) -> Weight { - Weight::from_parts(18_563_000 as u64, 0) + Weight::from_parts(18_563_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(68_000 as u64, 0).saturating_mul(b as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + .saturating_add(Weight::from_parts(68_000_u64, 0).saturating_mul(b as u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn set_desired_candidates() -> Weight { - Weight::from_parts(16_363_000 as u64, 0) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(16_363_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64)) } fn set_candidacy_bond() -> Weight { - Weight::from_parts(16_840_000 as u64, 0) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(16_840_000_u64, 0).saturating_add(RocksDbWeight::get().writes(1_u64)) } fn register_as_candidate(c: u32) -> Weight { - Weight::from_parts(71_196_000 as u64, 0) + Weight::from_parts(71_196_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(198_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(4 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(198_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } fn leave_intent(c: u32) -> Weight { - Weight::from_parts(55_336_000 as u64, 0) + Weight::from_parts(55_336_000_u64, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(151_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(2 as u64)) + .saturating_add(Weight::from_parts(151_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } fn note_author() -> Weight { - Weight::from_parts(71_461_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(3 as u64)) - .saturating_add(RocksDbWeight::get().writes(4 as u64)) + Weight::from_parts(71_461_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(3_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } fn new_session(r: u32, c: u32) -> Weight { - Weight::from_parts(0 as u64, 0) + Weight::from_parts(0_u64, 0) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(109_961_000 as u64, 0).saturating_mul(r as u64)) + .saturating_add(Weight::from_parts(109_961_000_u64, 0).saturating_mul(r as u64)) // Standard Error: 1_010_000 - .saturating_add(Weight::from_parts(151_952_000 as u64, 0).saturating_mul(c as u64)) - .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64))) - .saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64))) - .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64))) - .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64))) + .saturating_add(Weight::from_parts(151_952_000_u64, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(1_u64.saturating_mul(r as u64))) + .saturating_add(RocksDbWeight::get().reads(2_u64.saturating_mul(c as u64))) + .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(r as u64))) + .saturating_add(RocksDbWeight::get().writes(2_u64.saturating_mul(c as u64))) } } diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index 3b0d54c7bdb..082fceaf14c 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -766,19 +766,19 @@ mod tests { new_test_ext().execute_with(|| { let enqueued = vec![msg(1000), msg(1001)]; enqueue(&enqueued); - let weight_used = handle_messages(&vec![msg(1002)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1002)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1000, 1000)); assert_eq!(take_trace(), vec![msg_complete(1000), msg_limit_reached(1001),]); assert_eq!(pages_queued(), 2); assert_eq!(PageIndex::::get().begin_used, 0); - let weight_used = handle_messages(&vec![msg(1003)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1003)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1001, 1001)); assert_eq!(take_trace(), vec![msg_complete(1001), msg_limit_reached(1002),]); assert_eq!(pages_queued(), 2); assert_eq!(PageIndex::::get().begin_used, 1); - let weight_used = handle_messages(&vec![msg(1004)], Weight::from_parts(1500, 1500)); + let weight_used = handle_messages(&[msg(1004)], Weight::from_parts(1500, 1500)); assert_eq!(weight_used, Weight::from_parts(1002, 1002)); assert_eq!(take_trace(), vec![msg_complete(1002), msg_limit_reached(1003),]); assert_eq!(pages_queued(), 2); @@ -877,9 +877,9 @@ mod tests { #[test] fn on_idle_should_service_queue() { new_test_ext().execute_with(|| { - enqueue(&vec![msg(1000), msg(1001)]); - enqueue(&vec![msg(1002), msg(1003)]); - enqueue(&vec![msg(1004), msg(1005)]); + enqueue(&[msg(1000), msg(1001)]); + enqueue(&[msg(1002), msg(1003)]); + enqueue(&[msg(1004), msg(1005)]); let weight_used = DmpQueue::on_idle(1, Weight::from_parts(6000, 6000)); assert_eq!(weight_used, Weight::from_parts(5010, 5010)); @@ -901,20 +901,17 @@ mod tests { #[test] fn handle_max_messages_per_block() { new_test_ext().execute_with(|| { - enqueue(&vec![msg(1000), msg(1001)]); - enqueue(&vec![msg(1002), msg(1003)]); - enqueue(&vec![msg(1004), msg(1005)]); - - let incoming = (0..MAX_MESSAGES_PER_BLOCK) - .into_iter() - .map(|i| msg(1006 + i as u64)) - .collect::>(); + enqueue(&[msg(1000), msg(1001)]); + enqueue(&[msg(1002), msg(1003)]); + enqueue(&[msg(1004), msg(1005)]); + + let incoming = + (0..MAX_MESSAGES_PER_BLOCK).map(|i| msg(1006 + i as u64)).collect::>(); handle_messages(&incoming, Weight::from_parts(25000, 25000)); assert_eq!( take_trace(), (0..MAX_MESSAGES_PER_BLOCK) - .into_iter() .map(|i| msg_complete(1000 + i as u64)) .collect::>(), ); @@ -924,7 +921,6 @@ mod tests { assert_eq!( take_trace(), (MAX_MESSAGES_PER_BLOCK..MAX_MESSAGES_PER_BLOCK + 6) - .into_iter() .map(|i| msg_complete(1000 + i as u64)) .collect::>(), ); diff --git a/pallets/dmp-queue/src/migration.rs b/pallets/dmp-queue/src/migration.rs index b360f5a7bd4..5e1d357e142 100644 --- a/pallets/dmp-queue/src/migration.rs +++ b/pallets/dmp-queue/src/migration.rs @@ -74,7 +74,7 @@ pub fn migrate_to_v1() -> Weight { } }; - if let Err(_) = Configuration::::translate(|pre| pre.map(translate)) { + if Configuration::::translate(|pre| pre.map(translate)).is_err() { log::error!( target: "dmp_queue", "unexpected error when performing translation of the QueueConfig type during storage upgrade to v2" diff --git a/pallets/parachain-system/src/lib.rs b/pallets/parachain-system/src/lib.rs index 4025368904b..36ef8d57195 100644 --- a/pallets/parachain-system/src/lib.rs +++ b/pallets/parachain-system/src/lib.rs @@ -473,10 +473,7 @@ pub mod pallet { check_version: bool, ) -> DispatchResult { ensure_root(origin)?; - AuthorizedUpgrade::::put(CodeUpgradeAuthorization { - code_hash: code_hash.clone(), - check_version, - }); + AuthorizedUpgrade::::put(CodeUpgradeAuthorization { code_hash, check_version }); Self::deposit_event(Event::UpgradeAuthorized { code_hash }); Ok(()) @@ -753,7 +750,7 @@ impl Pallet { let authorization = AuthorizedUpgrade::::get().ok_or(Error::::NothingAuthorized)?; // ensure that the actual hash matches the authorized hash - let actual_hash = T::Hashing::hash(&code[..]); + let actual_hash = T::Hashing::hash(code); ensure!(actual_hash == authorization.code_hash, Error::::Unauthorized); // check versions if required as part of the authorization @@ -941,10 +938,10 @@ impl Pallet { // `running_mqc_heads`. Otherwise, in a block where no messages were sent in a channel // it won't get into next block's `last_mqc_heads` and thus will be all zeros, which // would corrupt the message queue chain. - for &(ref sender, ref channel) in ingress_channels { + for (sender, channel) in ingress_channels { let cur_head = running_mqc_heads .entry(sender) - .or_insert_with(|| last_mqc_heads.get(&sender).cloned().unwrap_or_default()) + .or_insert_with(|| last_mqc_heads.get(sender).cloned().unwrap_or_default()) .head(); let target_head = channel.mqc_head.unwrap_or_default(); @@ -1090,22 +1087,20 @@ impl Pallet { // may change so that the message is no longer valid. // // However, changing this setting is expected to be rare. - match Self::host_configuration() { - Some(cfg) => - if message.len() > cfg.max_upward_message_size as usize { - return Err(MessageSendError::TooBig) - }, - None => { - // This storage field should carry over from the previous block. So if it's None - // then it must be that this is an edge-case where a message is attempted to be - // sent at the first block. - // - // Let's pass this message through. I think it's not unreasonable to expect that - // the message is not huge and it comes through, but if it doesn't it can be - // returned back to the sender. - // - // Thus fall through here. - }, + if let Some(cfg) = Self::host_configuration() { + if message.len() > cfg.max_upward_message_size as usize { + return Err(MessageSendError::TooBig) + } + } else { + // This storage field should carry over from the previous block. So if it's None + // then it must be that this is an edge-case where a message is attempted to be + // sent at the first block. + // + // Let's pass this message through. I think it's not unreasonable to expect that + // the message is not huge and it comes through, but if it doesn't it can be + // returned back to the sender. + // + // Thus fall through here. }; >::append(message.clone()); diff --git a/pallets/parachain-system/src/tests.rs b/pallets/parachain-system/src/tests.rs index 70e4c106bf2..a4b1c275b7a 100755 --- a/pallets/parachain-system/src/tests.rs +++ b/pallets/parachain-system/src/tests.rs @@ -304,7 +304,7 @@ impl BlockTests { // begin initialization System::reset_events(); - System::initialize(&n, &Default::default(), &Default::default()); + System::initialize(n, &Default::default(), &Default::default()); // now mess with the storage the way validate_block does let mut sproof_builder = RelayStateSproofBuilder::default(); @@ -357,10 +357,8 @@ impl BlockTests { ParachainSystem::on_finalize(*n); // did block execution set new validation code? - if NewValidationCode::::exists() { - if self.pending_upgrade.is_some() { - panic!("attempted to set validation code while upgrade was pending"); - } + if NewValidationCode::::exists() && self.pending_upgrade.is_some() { + panic!("attempted to set validation code while upgrade was pending"); } // clean up @@ -404,7 +402,7 @@ fn events() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored.into()) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionStored) ); }, ) @@ -415,10 +413,9 @@ fn events() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem( - crate::Event::ValidationFunctionApplied { relay_chain_block_num: 1234 } - .into() - ) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionApplied { + relay_chain_block_num: 1234 + }) ); }, ); @@ -491,7 +488,7 @@ fn aborted_upgrade() { let events = System::events(); assert_eq!( events[0].event, - RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded.into()) + RuntimeEvent::ParachainSystem(crate::Event::ValidationFunctionDiscarded) ); }, ); diff --git a/pallets/parachain-system/src/validate_block/tests.rs b/pallets/parachain-system/src/validate_block/tests.rs index 2c39188a085..4801b62e7b5 100644 --- a/pallets/parachain-system/src/validate_block/tests.rs +++ b/pallets/parachain-system/src/validate_block/tests.rs @@ -41,7 +41,7 @@ fn call_validate_block_encoded_header( relay_parent_number: 1, relay_parent_storage_root, }, - &WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), + WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), ) .map(|v| v.head_data.0) } @@ -191,7 +191,7 @@ fn validate_block_invalid_parent_hash() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["validate_block_invalid_parent_hash", "--", "--nocapture"]) + .args(["validate_block_invalid_parent_hash", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -213,7 +213,7 @@ fn validate_block_fails_on_invalid_validation_data() { call_validate_block(parent_head, block, Hash::random()).unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"]) + .args(["validate_block_fails_on_invalid_validation_data", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -242,7 +242,7 @@ fn check_inherent_fails_on_validate_block_as_expected() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"]) + .args(["check_inherent_fails_on_validate_block_as_expected", "--", "--nocapture"]) .env("RUN_TEST", "1") .output() .expect("Runs the test"); @@ -276,7 +276,7 @@ fn check_inherents_are_unsigned_and_before_all_other_extrinsics() { .unwrap_err(); } else { let output = Command::new(env::current_exe().unwrap()) - .args(&[ + .args([ "check_inherents_are_unsigned_and_before_all_other_extrinsics", "--", "--nocapture", diff --git a/pallets/xcmp-queue/src/lib.rs b/pallets/xcmp-queue/src/lib.rs index df2b78ebc20..0dc76aa80a1 100644 --- a/pallets/xcmp-queue/src/lib.rs +++ b/pallets/xcmp-queue/src/lib.rs @@ -538,7 +538,7 @@ impl Pallet { return false } s.extend_from_slice(&data[..]); - return true + true }); if appended { Ok((details.last_index - details.first_index - 1) as u32) diff --git a/pallets/xcmp-queue/src/migration.rs b/pallets/xcmp-queue/src/migration.rs index f6ece1da1a8..fd1301b9491 100644 --- a/pallets/xcmp-queue/src/migration.rs +++ b/pallets/xcmp-queue/src/migration.rs @@ -94,7 +94,7 @@ pub fn migrate_to_v2() -> Weight { } }; - if let Err(_) = QueueConfig::::translate(|pre| pre.map(translate)) { + if QueueConfig::::translate(|pre| pre.map(translate)).is_err() { log::error!( target: super::LOG_TARGET, "unexpected error when performing translation of the QueueConfig type during storage upgrade to v2" diff --git a/pallets/xcmp-queue/src/mock.rs b/pallets/xcmp-queue/src/mock.rs index 0d7d6eda00b..2e70e65392a 100644 --- a/pallets/xcmp-queue/src/mock.rs +++ b/pallets/xcmp-queue/src/mock.rs @@ -120,7 +120,7 @@ impl cumulus_pallet_parachain_system::Config for Test { parameter_types! { pub const RelayChain: MultiLocation = MultiLocation::parent(); - pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32.into())).into(); + pub UniversalLocation: InteriorMultiLocation = X1(Parachain(1u32)); pub UnitWeightCost: Weight = Weight::from_parts(1_000_000, 1024); pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; diff --git a/pallets/xcmp-queue/src/tests.rs b/pallets/xcmp-queue/src/tests.rs index 952a2758f30..ad0fa906da3 100644 --- a/pallets/xcmp-queue/src/tests.rs +++ b/pallets/xcmp-queue/src/tests.rs @@ -23,7 +23,7 @@ use sp_runtime::traits::BadOrigin; fn one_message_does_not_panic() { new_test_ext().execute_with(|| { let message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode(); - let messages = vec![(Default::default(), 1u32.into(), message_format.as_slice())]; + let messages = vec![(Default::default(), 1u32, message_format.as_slice())]; // This shouldn't cause a panic XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -128,7 +128,7 @@ fn suspend_xcm_execution_works() { .encode(); let mut message_format = XcmpMessageFormat::ConcatenatedVersionedXcm.encode(); message_format.extend(xcm.clone()); - let messages = vec![(ParaId::from(999), 1u32.into(), message_format.as_slice())]; + let messages = vec![(ParaId::from(999), 1u32, message_format.as_slice())]; // This should have executed the incoming XCM, because it came from a system parachain XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -136,7 +136,7 @@ fn suspend_xcm_execution_works() { let queued_xcm = InboundXcmpMessages::::get(ParaId::from(999), 1u32); assert!(queued_xcm.is_empty()); - let messages = vec![(ParaId::from(2000), 1u32.into(), message_format.as_slice())]; + let messages = vec![(ParaId::from(2000), 1u32, message_format.as_slice())]; // This shouldn't have executed the incoming XCM XcmpQueue::handle_xcmp_messages(messages.into_iter(), Weight::MAX); @@ -294,7 +294,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() { // XcmpQueue - check dest is really not applicable let dest = (Parent, Parent, Parent); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert_eq!( Err(SendError::NotApplicable), @@ -302,7 +302,7 @@ fn xcmp_queue_does_not_consume_dest_or_msg_on_not_applicable() { ); // check wrapper were not consumed - assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(dest.into()), dest_wrapper.take()); assert_eq!(Some(message.clone()), msg_wrapper.take()); // another try with router chain with asserting sender @@ -322,7 +322,7 @@ fn xcmp_queue_consumes_dest_and_msg_on_ok_validate() { // XcmpQueue - check dest/msg is valid let dest = (Parent, X1(Parachain(5555))); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert!(::validate(&mut dest_wrapper, &mut msg_wrapper).is_ok()); diff --git a/pallets/xcmp-queue/src/weights.rs b/pallets/xcmp-queue/src/weights.rs index b275982b003..cbb29ac3ae3 100644 --- a/pallets/xcmp-queue/src/weights.rs +++ b/pallets/xcmp-queue/src/weights.rs @@ -18,31 +18,31 @@ pub struct SubstrateWeight(PhantomData); impl WeightInfo for SubstrateWeight { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(1 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) } } impl WeightInfo for () { // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_u32() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } // Storage: XcmpQueue QueueConfig (r:1 w:1) fn set_config_with_weight() -> Weight { - Weight::from_parts(2_717_000 as u64, 0) - .saturating_add(RocksDbWeight::get().reads(1 as u64)) - .saturating_add(RocksDbWeight::get().writes(1 as u64)) + Weight::from_parts(2_717_000_u64, 0) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(1_u64)) } } diff --git a/parachain-template/node/src/command.rs b/parachain-template/node/src/command.rs index 20ac62ec4a5..c3e79ebe387 100644 --- a/parachain-template/node/src/command.rs +++ b/parachain-template/node/src/command.rs @@ -268,13 +268,13 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let hwbench = (!cli.no_hardware_benchmarks).then_some( config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) })).flatten(); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) - .ok_or_else(|| "Could not find parachain ID in chain-spec.")?; + .ok_or("Could not find parachain ID in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, @@ -301,7 +301,7 @@ pub fn run() -> Result<()> { info!("Parachain genesis state: {}", genesis_state); info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); - if !collator_options.relay_chain_rpc_urls.is_empty() && cli.relay_chain_args.len() > 0 { + if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relay_chain_args.is_empty() { warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); } diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 61839e0a621..3c24b39d64d 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -686,13 +686,13 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( config: frame_benchmarking::BenchmarkConfig ) -> Result, sp_runtime::RuntimeString> { - use frame_benchmarking::{Benchmarking, BenchmarkBatch, TrackedStorageKey}; + use frame_benchmarking::{Benchmarking, BenchmarkBatch}; use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime {} diff --git a/parachains/common/src/impls.rs b/parachains/common/src/impls.rs index cc89a248e2e..d9998755212 100644 --- a/parachains/common/src/impls.rs +++ b/parachains/common/src/impls.rs @@ -278,7 +278,6 @@ mod tests { } let asset_location = SomeSiblingParachain::get() - .clone() .pushed_with_interior(GeneralIndex(42)) .expect("multilocation will only have 2 junctions; qed"); let asset = MultiAsset { id: Concrete(asset_location), fun: 1_000_000u128.into() }; diff --git a/parachains/pallets/parachain-info/src/lib.rs b/parachains/pallets/parachain-info/src/lib.rs index d61387aaeb6..93ef5bfcfeb 100644 --- a/parachains/pallets/parachain-info/src/lib.rs +++ b/parachains/pallets/parachain-info/src/lib.rs @@ -53,7 +53,7 @@ pub mod pallet { #[pallet::genesis_build] impl GenesisBuild for GenesisConfig { fn build(&self) { - >::put(&self.parachain_id); + >::put(self.parachain_id); } } diff --git a/parachains/runtimes/assets/common/src/foreign_creators.rs b/parachains/runtimes/assets/common/src/foreign_creators.rs index 3d7567409f6..dbdf4301d66 100644 --- a/parachains/runtimes/assets/common/src/foreign_creators.rs +++ b/parachains/runtimes/assets/common/src/foreign_creators.rs @@ -43,7 +43,7 @@ where asset_location: &MultiLocation, ) -> sp_std::result::Result { let origin_location = EnsureXcm::::try_origin(origin.clone())?; - if !IsForeign::contains(&asset_location, &origin_location) { + if !IsForeign::contains(asset_location, &origin_location) { return Err(origin) } AccountOf::convert(origin_location).map_err(|_| origin) @@ -51,6 +51,6 @@ where #[cfg(feature = "runtime-benchmarks")] fn try_successful_origin(a: &MultiLocation) -> Result { - Ok(pallet_xcm::Origin::Xcm(a.clone()).into()) + Ok(pallet_xcm::Origin::Xcm(*a).into()) } } diff --git a/parachains/runtimes/assets/common/src/matching.rs b/parachains/runtimes/assets/common/src/matching.rs index a5e030412b9..964f25cda35 100644 --- a/parachains/runtimes/assets/common/src/matching.rs +++ b/parachains/runtimes/assets/common/src/matching.rs @@ -42,10 +42,7 @@ impl> Contains for StartsWithExplicitGlobalConsensus { fn contains(t: &MultiLocation) -> bool { - match t.interior.global_consensus() { - Ok(requested_network) if requested_network.eq(&Network::get()) => true, - _ => false, - } + matches!(t.interior.global_consensus(), Ok(requested_network) if requested_network.eq(&Network::get())) } } @@ -61,7 +58,7 @@ impl> ContainsPair bool { log::trace!(target: "xcm::contains", "IsForeignConcreteAsset asset: {:?}, origin: {:?}", asset, origin); - matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, &origin)) + matches!(asset.id, Concrete(ref id) if IsForeign::contains(id, origin)) } } @@ -73,18 +70,14 @@ impl> ContainsPair { fn contains(&a: &MultiLocation, b: &MultiLocation) -> bool { // `a` needs to be from `b` at least - if !a.starts_with(&b) { + if !a.starts_with(b) { return false } // here we check if sibling match a { - MultiLocation { parents: 1, interior } => match interior.first() { - Some(Parachain(sibling_para_id)) - if sibling_para_id.ne(&u32::from(SelfParaId::get())) => - true, - _ => false, - }, + MultiLocation { parents: 1, interior } => + matches!(interior.first(), Some(Parachain(sibling_para_id)) if sibling_para_id.ne(&u32::from(SelfParaId::get()))), _ => false, } } diff --git a/parachains/runtimes/assets/statemine/src/lib.rs b/parachains/runtimes/assets/statemine/src/lib.rs index 961a9300a56..eacd865200b 100644 --- a/parachains/runtimes/assets/statemine/src/lib.rs +++ b/parachains/runtimes/assets/statemine/src/lib.rs @@ -213,7 +213,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -1026,7 +1026,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -1062,7 +1062,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -1082,7 +1081,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( KsmLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; @@ -1097,7 +1096,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(KsmLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } @@ -1201,7 +1200,7 @@ cumulus_pallet_parachain_system::register_validate_block! { #[cfg(feature = "state-trie-version-1")] parameter_types! { // The deposit configuration for the singed migration. Specially if you want to allow any signed account to do the migration (see `SignedFilter`, these deposits should be high) - pub const MigrationSignedDepositPerItem: Balance = 1 * CENTS; + pub const MigrationSignedDepositPerItem: Balance = CENTS; pub const MigrationSignedDepositBase: Balance = 2_000 * CENTS; pub const MigrationMaxKeyLen: u32 = 512; } diff --git a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs index 877a54ba848..23322418d2a 100644 --- a/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for StatemineXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for StatemineXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index eb99e2fb709..ac830e76408 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -197,151 +197,146 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Assets( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Assets( + pallet_assets::Call::create { .. } | + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::ForeignAssets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::ForeignAssets( - pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::set_metadata { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Nfts( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Nfts( pallet_nfts::Call::create { .. } | - pallet_nfts::Call::force_create { .. } | - pallet_nfts::Call::destroy { .. } | - pallet_nfts::Call::mint { .. } | - pallet_nfts::Call::force_mint { .. } | - pallet_nfts::Call::burn { .. } | - pallet_nfts::Call::transfer { .. } | - pallet_nfts::Call::lock_item_transfer { .. } | - pallet_nfts::Call::unlock_item_transfer { .. } | - pallet_nfts::Call::lock_collection { .. } | - pallet_nfts::Call::transfer_ownership { .. } | - pallet_nfts::Call::set_team { .. } | - pallet_nfts::Call::force_collection_owner { .. } | - pallet_nfts::Call::force_collection_config { .. } | - pallet_nfts::Call::approve_transfer { .. } | - pallet_nfts::Call::cancel_approval { .. } | - pallet_nfts::Call::clear_all_transfer_approvals { .. } | - pallet_nfts::Call::lock_item_properties { .. } | - pallet_nfts::Call::set_attribute { .. } | - pallet_nfts::Call::force_set_attribute { .. } | - pallet_nfts::Call::clear_attribute { .. } | - pallet_nfts::Call::approve_item_attributes { .. } | - pallet_nfts::Call::cancel_item_attributes_approval { .. } | - pallet_nfts::Call::set_metadata { .. } | - pallet_nfts::Call::clear_metadata { .. } | - pallet_nfts::Call::set_collection_metadata { .. } | - pallet_nfts::Call::clear_collection_metadata { .. } | - pallet_nfts::Call::set_accept_ownership { .. } | - pallet_nfts::Call::set_collection_max_supply { .. } | - pallet_nfts::Call::update_mint_settings { .. } | - pallet_nfts::Call::set_price { .. } | - pallet_nfts::Call::buy_item { .. } | - pallet_nfts::Call::pay_tips { .. } | - pallet_nfts::Call::create_swap { .. } | - pallet_nfts::Call::cancel_swap { .. } | - pallet_nfts::Call::claim_swap { .. }, - ) | - RuntimeCall::Uniques( + pallet_nfts::Call::force_create { .. } | + pallet_nfts::Call::destroy { .. } | + pallet_nfts::Call::mint { .. } | + pallet_nfts::Call::force_mint { .. } | + pallet_nfts::Call::burn { .. } | + pallet_nfts::Call::transfer { .. } | + pallet_nfts::Call::lock_item_transfer { .. } | + pallet_nfts::Call::unlock_item_transfer { .. } | + pallet_nfts::Call::lock_collection { .. } | + pallet_nfts::Call::transfer_ownership { .. } | + pallet_nfts::Call::set_team { .. } | + pallet_nfts::Call::force_collection_owner { .. } | + pallet_nfts::Call::force_collection_config { .. } | + pallet_nfts::Call::approve_transfer { .. } | + pallet_nfts::Call::cancel_approval { .. } | + pallet_nfts::Call::clear_all_transfer_approvals { .. } | + pallet_nfts::Call::lock_item_properties { .. } | + pallet_nfts::Call::set_attribute { .. } | + pallet_nfts::Call::force_set_attribute { .. } | + pallet_nfts::Call::clear_attribute { .. } | + pallet_nfts::Call::approve_item_attributes { .. } | + pallet_nfts::Call::cancel_item_attributes_approval { .. } | + pallet_nfts::Call::set_metadata { .. } | + pallet_nfts::Call::clear_metadata { .. } | + pallet_nfts::Call::set_collection_metadata { .. } | + pallet_nfts::Call::clear_collection_metadata { .. } | + pallet_nfts::Call::set_accept_ownership { .. } | + pallet_nfts::Call::set_collection_max_supply { .. } | + pallet_nfts::Call::update_mint_settings { .. } | + pallet_nfts::Call::set_price { .. } | + pallet_nfts::Call::buy_item { .. } | + pallet_nfts::Call::pay_tips { .. } | + pallet_nfts::Call::create_swap { .. } | + pallet_nfts::Call::cancel_swap { .. } | + pallet_nfts::Call::claim_swap { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. } + ) + ) } } diff --git a/parachains/runtimes/assets/statemine/tests/tests.rs b/parachains/runtimes/assets/statemine/tests/tests.rs index b9001a35a99..57cd502857c 100644 --- a/parachains/runtimes/assets/statemine/tests/tests.rs +++ b/parachains/runtimes/assets/statemine/tests/tests.rs @@ -77,19 +77,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -150,7 +147,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -224,7 +221,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -277,11 +274,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); @@ -416,7 +413,7 @@ fn test_assets_balances_api_works() { let foreign_asset_minimum_asset_balance = 3333333_u128; assert_ok!(ForeignAssets::force_create( RuntimeHelper::::root_origin(), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(SOME_ASSET_ADMIN).into(), false, foreign_asset_minimum_asset_balance @@ -425,7 +422,7 @@ fn test_assets_balances_api_works() { // We first mint enough asset for the account to exist for assets assert_ok!(ForeignAssets::mint( RuntimeHelper::::origin_of(AccountId::from(SOME_ASSET_ADMIN)), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(ALICE).into(), 6 * foreign_asset_minimum_asset_balance )); diff --git a/parachains/runtimes/assets/statemint/src/lib.rs b/parachains/runtimes/assets/statemint/src/lib.rs index aa90ca7a157..b697a7902a7 100644 --- a/parachains/runtimes/assets/statemint/src/lib.rs +++ b/parachains/runtimes/assets/statemint/src/lib.rs @@ -223,7 +223,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -925,7 +925,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -960,7 +960,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -980,7 +979,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( DotLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(DotLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -994,7 +993,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(DotLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs index 1b4a2bcfdd7..768f2b152cd 100644 --- a/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/statemint/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for StatemintXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for StatemintXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/statemint/src/xcm_config.rs b/parachains/runtimes/assets/statemint/src/xcm_config.rs index 19fb96c3027..c12631dd414 100644 --- a/parachains/runtimes/assets/statemint/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemint/src/xcm_config.rs @@ -166,85 +166,82 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. } | - pallet_collator_selection::Call::set_invulnerables { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Assets( - pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Uniques( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Assets( + pallet_assets::Call::create { .. } | + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. }, + ) + ) } } diff --git a/parachains/runtimes/assets/statemint/tests/tests.rs b/parachains/runtimes/assets/statemint/tests/tests.rs index 7bbed6bb54a..87242682b15 100644 --- a/parachains/runtimes/assets/statemint/tests/tests.rs +++ b/parachains/runtimes/assets/statemint/tests/tests.rs @@ -80,19 +80,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -156,7 +153,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -233,7 +230,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -286,11 +283,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); diff --git a/parachains/runtimes/assets/test-utils/src/lib.rs b/parachains/runtimes/assets/test-utils/src/lib.rs index 1e0b31f18a3..4a67e661322 100644 --- a/parachains/runtimes/assets/test-utils/src/lib.rs +++ b/parachains/runtimes/assets/test-utils/src/lib.rs @@ -134,12 +134,12 @@ impl< .unwrap(); } - pallet_balances::GenesisConfig:: { balances: self.balances.into() } + pallet_balances::GenesisConfig:: { balances: self.balances } .assimilate_storage(&mut t) .unwrap(); pallet_collator_selection::GenesisConfig:: { - invulnerables: self.collators.clone().into(), + invulnerables: self.collators.clone(), candidacy_bond: Default::default(), desired_candidates: Default::default(), } @@ -303,11 +303,10 @@ impl RuntimeHelper .find_map(|e| match e { pallet_xcm::Event::Attempted(outcome) => Some(outcome), _ => None, - }); - match outcome { - Some(outcome) => assert_outcome(outcome), - None => assert!(false, "No `pallet_xcm::Event::Attempted(outcome)` event found!"), - } + }) + .expect("No `pallet_xcm::Event::Attempted(outcome)` event found!"); + + assert_outcome(outcome); } } @@ -362,8 +361,11 @@ pub fn mock_open_hrmp_channel< recipient: ParaId, ) { let n = 1_u32; - let mut sproof_builder = RelayStateSproofBuilder::default(); - sproof_builder.para_id = sender; + let mut sproof_builder = RelayStateSproofBuilder { + para_id: sender, + hrmp_egress_channel_index: Some(vec![recipient]), + ..Default::default() + }; sproof_builder.hrmp_channels.insert( HrmpChannelId { sender, recipient }, AbridgedHrmpChannel { @@ -375,7 +377,6 @@ pub fn mock_open_hrmp_channel< mqc_head: None, }, ); - sproof_builder.hrmp_egress_channel_index = Some(vec![recipient]); let (relay_parent_storage_root, relay_chain_state) = sproof_builder.into_state_root_and_proof(); let vfp = PersistedValidationData { @@ -388,7 +389,7 @@ pub fn mock_open_hrmp_channel< let inherent_data = { let mut inherent_data = InherentData::default(); let system_inherent_data = ParachainInherentData { - validation_data: vfp.clone(), + validation_data: vfp, relay_chain_state, downward_messages: Default::default(), horizontal_messages: Default::default(), diff --git a/parachains/runtimes/assets/test-utils/src/test_cases.rs b/parachains/runtimes/assets/test-utils/src/test_cases.rs index 954ff0d7589..a599db82713 100644 --- a/parachains/runtimes/assets/test-utils/src/test_cases.rs +++ b/parachains/runtimes/assets/test-utils/src/test_cases.rs @@ -134,7 +134,7 @@ pub fn teleports_for_native_asset_works< BuyExecution { fees: MultiAsset { id: Concrete(native_asset_id), - fun: Fungible(buy_execution_fee_amount_eta.into()), + fun: Fungible(buy_execution_fee_amount_eta), }, weight_limit: Limited(Weight::from_parts(303531000, 65536)), }, @@ -190,7 +190,7 @@ pub fn teleports_for_native_asset_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (native_asset_id, native_asset_to_teleport_away.clone().into()), + (native_asset_id, native_asset_to_teleport_away.into()), None, )); // check balances @@ -235,7 +235,7 @@ pub fn teleports_for_native_asset_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (native_asset_id, native_asset_to_teleport_away.clone().into()), + (native_asset_id, native_asset_to_teleport_away.into()), Some((runtime_para_id, other_para_id)), )); @@ -366,7 +366,7 @@ pub fn teleports_for_foreign_assets_works< WeightToFee::weight_to_fee(&Weight::from_parts(90_000_000_000, 0)); let buy_execution_fee = MultiAsset { id: Concrete(MultiLocation::parent()), - fun: Fungible(buy_execution_fee_amount.into()), + fun: Fungible(buy_execution_fee_amount), }; let teleported_foreign_asset_amount = 10000000000000; @@ -376,7 +376,7 @@ pub fn teleports_for_foreign_assets_works< .with_session_keys(collator_session_keys.session_keys()) .with_balances(vec![ ( - foreign_creator_as_account_id.clone(), + foreign_creator_as_account_id, existential_deposit + (buy_execution_fee_amount * 2).into(), ), (target_account.clone(), existential_deposit), @@ -441,7 +441,7 @@ pub fn teleports_for_foreign_assets_works< BuyExecution { fees: MultiAsset { id: Concrete(MultiLocation::parent()), - fun: Fungible(buy_execution_fee_amount.into()), + fun: Fungible(buy_execution_fee_amount), }, weight_limit: Limited(Weight::from_parts(403531000, 65536)), }, @@ -536,7 +536,7 @@ pub fn teleports_for_foreign_assets_works< RuntimeHelper::::origin_of(target_account.clone()), dest, dest_beneficiary, - (foreign_asset_id_multilocation, asset_to_teleport_away.clone().into()), + (foreign_asset_id_multilocation, asset_to_teleport_away), Some((runtime_para_id, foreign_para_id)), )); @@ -788,7 +788,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< .execute_with(|| { // create some asset class let asset_minimum_asset_balance = 3333333_u128; - let asset_id_as_multilocation = AssetIdConverter::reverse_ref(&asset_id).unwrap(); + let asset_id_as_multilocation = AssetIdConverter::reverse_ref(asset_id).unwrap(); assert_ok!(>::force_create( RuntimeHelper::::root_origin(), asset_id.into(), @@ -869,7 +869,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< id: charlie_account.clone().into() }), }, - (asset_id_as_multilocation, 1 * asset_minimum_asset_balance), + (asset_id_as_multilocation, asset_minimum_asset_balance), ), XcmError::FailedToTransactAsset(Into::<&str>::into( sp_runtime::TokenError::CannotCreate @@ -890,7 +890,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< parents: 0, interior: X1(AccountId32 { network: None, id: bob_account.clone().into() }), }, - (asset_id_as_multilocation, 1 * asset_minimum_asset_balance), + (asset_id_as_multilocation, asset_minimum_asset_balance), ), Ok(_) )); @@ -908,7 +908,7 @@ pub fn asset_transactor_transfer_with_pallet_assets_instance_works< asset_id.into(), &bob_account ), - (1 * asset_minimum_asset_balance).into() + asset_minimum_asset_balance.into() ); assert_eq!( >::balance( @@ -1130,7 +1130,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor // lets simulate this was triggered by relay chain from local consensus sibling parachain let xcm = Xcm(vec![ WithdrawAsset(buy_execution_fee.clone().into()), - BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited }, + BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited }, Transact { origin_kind: OriginKind::Xcm, require_weight_at_most: Weight::from_parts(40_000_000_000, 8000), @@ -1247,7 +1247,7 @@ pub fn create_and_manage_foreign_assets_for_local_consensus_parachain_assets_wor }); let xcm = Xcm(vec![ WithdrawAsset(buy_execution_fee.clone().into()), - BuyExecution { fees: buy_execution_fee.clone().into(), weight_limit: Unlimited }, + BuyExecution { fees: buy_execution_fee.clone(), weight_limit: Unlimited }, Transact { origin_kind: OriginKind::Xcm, require_weight_at_most: Weight::from_parts(20_000_000_000, 8000), diff --git a/parachains/runtimes/assets/westmint/src/lib.rs b/parachains/runtimes/assets/westmint/src/lib.rs index c237c8dc5cf..d5ac6103d97 100644 --- a/parachains/runtimes/assets/westmint/src/lib.rs +++ b/parachains/runtimes/assets/westmint/src/lib.rs @@ -199,7 +199,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -1038,7 +1038,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -1073,7 +1073,6 @@ impl_runtime_apis! { id: Concrete(GeneralIndex(i as u128).into()), fun: Fungible(fungibles_amount * i as u128), } - .into() }) .chain(core::iter::once(MultiAsset { id: Concrete(Here.into()), fun: Fungible(u128::MAX) })) .chain((0..holding_non_fungibles).map(|i| MultiAsset { @@ -1093,7 +1092,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( WestendLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(WestendLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(WestendLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; @@ -1108,7 +1107,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(WestendLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs index 5daa3acbcce..8247f75d5dd 100644 --- a/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs +++ b/parachains/runtimes/assets/westmint/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for WestmintXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for WestmintXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index a834180bd29..53750a4a810 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -191,155 +191,149 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility( - pallet_utility::Call::as_derivative { .. } | - pallet_utility::Call::batch { .. } | - pallet_utility::Call::batch_all { .. }, - ) | - RuntimeCall::Assets( + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility( + pallet_utility::Call::as_derivative { .. } | + pallet_utility::Call::batch { .. } | + pallet_utility::Call::batch_all { .. }, + ) | RuntimeCall::Assets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::ForeignAssets( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::ForeignAssets( pallet_assets::Call::create { .. } | - pallet_assets::Call::force_create { .. } | - pallet_assets::Call::start_destroy { .. } | - pallet_assets::Call::destroy_accounts { .. } | - pallet_assets::Call::destroy_approvals { .. } | - pallet_assets::Call::finish_destroy { .. } | - pallet_assets::Call::mint { .. } | - pallet_assets::Call::burn { .. } | - pallet_assets::Call::transfer { .. } | - pallet_assets::Call::transfer_keep_alive { .. } | - pallet_assets::Call::force_transfer { .. } | - pallet_assets::Call::freeze { .. } | - pallet_assets::Call::thaw { .. } | - pallet_assets::Call::freeze_asset { .. } | - pallet_assets::Call::thaw_asset { .. } | - pallet_assets::Call::transfer_ownership { .. } | - pallet_assets::Call::set_team { .. } | - pallet_assets::Call::set_metadata { .. } | - pallet_assets::Call::clear_metadata { .. } | - pallet_assets::Call::force_clear_metadata { .. } | - pallet_assets::Call::force_asset_status { .. } | - pallet_assets::Call::approve_transfer { .. } | - pallet_assets::Call::cancel_approval { .. } | - pallet_assets::Call::force_cancel_approval { .. } | - pallet_assets::Call::transfer_approved { .. } | - pallet_assets::Call::touch { .. } | - pallet_assets::Call::refund { .. }, - ) | - RuntimeCall::Nfts( + pallet_assets::Call::force_create { .. } | + pallet_assets::Call::start_destroy { .. } | + pallet_assets::Call::destroy_accounts { .. } | + pallet_assets::Call::destroy_approvals { .. } | + pallet_assets::Call::finish_destroy { .. } | + pallet_assets::Call::mint { .. } | + pallet_assets::Call::burn { .. } | + pallet_assets::Call::transfer { .. } | + pallet_assets::Call::transfer_keep_alive { .. } | + pallet_assets::Call::force_transfer { .. } | + pallet_assets::Call::freeze { .. } | + pallet_assets::Call::thaw { .. } | + pallet_assets::Call::freeze_asset { .. } | + pallet_assets::Call::thaw_asset { .. } | + pallet_assets::Call::transfer_ownership { .. } | + pallet_assets::Call::set_team { .. } | + pallet_assets::Call::set_metadata { .. } | + pallet_assets::Call::clear_metadata { .. } | + pallet_assets::Call::force_clear_metadata { .. } | + pallet_assets::Call::force_asset_status { .. } | + pallet_assets::Call::approve_transfer { .. } | + pallet_assets::Call::cancel_approval { .. } | + pallet_assets::Call::force_cancel_approval { .. } | + pallet_assets::Call::transfer_approved { .. } | + pallet_assets::Call::touch { .. } | + pallet_assets::Call::refund { .. }, + ) | RuntimeCall::Nfts( pallet_nfts::Call::create { .. } | - pallet_nfts::Call::force_create { .. } | - pallet_nfts::Call::destroy { .. } | - pallet_nfts::Call::mint { .. } | - pallet_nfts::Call::force_mint { .. } | - pallet_nfts::Call::burn { .. } | - pallet_nfts::Call::transfer { .. } | - pallet_nfts::Call::lock_item_transfer { .. } | - pallet_nfts::Call::unlock_item_transfer { .. } | - pallet_nfts::Call::lock_collection { .. } | - pallet_nfts::Call::transfer_ownership { .. } | - pallet_nfts::Call::set_team { .. } | - pallet_nfts::Call::force_collection_owner { .. } | - pallet_nfts::Call::force_collection_config { .. } | - pallet_nfts::Call::approve_transfer { .. } | - pallet_nfts::Call::cancel_approval { .. } | - pallet_nfts::Call::clear_all_transfer_approvals { .. } | - pallet_nfts::Call::lock_item_properties { .. } | - pallet_nfts::Call::set_attribute { .. } | - pallet_nfts::Call::force_set_attribute { .. } | - pallet_nfts::Call::clear_attribute { .. } | - pallet_nfts::Call::approve_item_attributes { .. } | - pallet_nfts::Call::cancel_item_attributes_approval { .. } | - pallet_nfts::Call::set_metadata { .. } | - pallet_nfts::Call::clear_metadata { .. } | - pallet_nfts::Call::set_collection_metadata { .. } | - pallet_nfts::Call::clear_collection_metadata { .. } | - pallet_nfts::Call::set_accept_ownership { .. } | - pallet_nfts::Call::set_collection_max_supply { .. } | - pallet_nfts::Call::update_mint_settings { .. } | - pallet_nfts::Call::set_price { .. } | - pallet_nfts::Call::buy_item { .. } | - pallet_nfts::Call::pay_tips { .. } | - pallet_nfts::Call::create_swap { .. } | - pallet_nfts::Call::cancel_swap { .. } | - pallet_nfts::Call::claim_swap { .. }, - ) | - RuntimeCall::Uniques( + pallet_nfts::Call::force_create { .. } | + pallet_nfts::Call::destroy { .. } | + pallet_nfts::Call::mint { .. } | + pallet_nfts::Call::force_mint { .. } | + pallet_nfts::Call::burn { .. } | + pallet_nfts::Call::transfer { .. } | + pallet_nfts::Call::lock_item_transfer { .. } | + pallet_nfts::Call::unlock_item_transfer { .. } | + pallet_nfts::Call::lock_collection { .. } | + pallet_nfts::Call::transfer_ownership { .. } | + pallet_nfts::Call::set_team { .. } | + pallet_nfts::Call::force_collection_owner { .. } | + pallet_nfts::Call::force_collection_config { .. } | + pallet_nfts::Call::approve_transfer { .. } | + pallet_nfts::Call::cancel_approval { .. } | + pallet_nfts::Call::clear_all_transfer_approvals { .. } | + pallet_nfts::Call::lock_item_properties { .. } | + pallet_nfts::Call::set_attribute { .. } | + pallet_nfts::Call::force_set_attribute { .. } | + pallet_nfts::Call::clear_attribute { .. } | + pallet_nfts::Call::approve_item_attributes { .. } | + pallet_nfts::Call::cancel_item_attributes_approval { .. } | + pallet_nfts::Call::set_metadata { .. } | + pallet_nfts::Call::clear_metadata { .. } | + pallet_nfts::Call::set_collection_metadata { .. } | + pallet_nfts::Call::clear_collection_metadata { .. } | + pallet_nfts::Call::set_accept_ownership { .. } | + pallet_nfts::Call::set_collection_max_supply { .. } | + pallet_nfts::Call::update_mint_settings { .. } | + pallet_nfts::Call::set_price { .. } | + pallet_nfts::Call::buy_item { .. } | + pallet_nfts::Call::pay_tips { .. } | + pallet_nfts::Call::create_swap { .. } | + pallet_nfts::Call::cancel_swap { .. } | + pallet_nfts::Call::claim_swap { .. }, + ) | RuntimeCall::Uniques( pallet_uniques::Call::create { .. } | - pallet_uniques::Call::force_create { .. } | - pallet_uniques::Call::destroy { .. } | - pallet_uniques::Call::mint { .. } | - pallet_uniques::Call::burn { .. } | - pallet_uniques::Call::transfer { .. } | - pallet_uniques::Call::freeze { .. } | - pallet_uniques::Call::thaw { .. } | - pallet_uniques::Call::freeze_collection { .. } | - pallet_uniques::Call::thaw_collection { .. } | - pallet_uniques::Call::transfer_ownership { .. } | - pallet_uniques::Call::set_team { .. } | - pallet_uniques::Call::approve_transfer { .. } | - pallet_uniques::Call::cancel_approval { .. } | - pallet_uniques::Call::force_item_status { .. } | - pallet_uniques::Call::set_attribute { .. } | - pallet_uniques::Call::clear_attribute { .. } | - pallet_uniques::Call::set_metadata { .. } | - pallet_uniques::Call::clear_metadata { .. } | - pallet_uniques::Call::set_collection_metadata { .. } | - pallet_uniques::Call::clear_collection_metadata { .. } | - pallet_uniques::Call::set_accept_ownership { .. } | - pallet_uniques::Call::set_collection_max_supply { .. } | - pallet_uniques::Call::set_price { .. } | - pallet_uniques::Call::buy_item { .. }, - ) => true, - _ => false, - } + pallet_uniques::Call::force_create { .. } | + pallet_uniques::Call::destroy { .. } | + pallet_uniques::Call::mint { .. } | + pallet_uniques::Call::burn { .. } | + pallet_uniques::Call::transfer { .. } | + pallet_uniques::Call::freeze { .. } | + pallet_uniques::Call::thaw { .. } | + pallet_uniques::Call::freeze_collection { .. } | + pallet_uniques::Call::thaw_collection { .. } | + pallet_uniques::Call::transfer_ownership { .. } | + pallet_uniques::Call::set_team { .. } | + pallet_uniques::Call::approve_transfer { .. } | + pallet_uniques::Call::cancel_approval { .. } | + pallet_uniques::Call::force_item_status { .. } | + pallet_uniques::Call::set_attribute { .. } | + pallet_uniques::Call::clear_attribute { .. } | + pallet_uniques::Call::set_metadata { .. } | + pallet_uniques::Call::clear_metadata { .. } | + pallet_uniques::Call::set_collection_metadata { .. } | + pallet_uniques::Call::clear_collection_metadata { .. } | + pallet_uniques::Call::set_accept_ownership { .. } | + pallet_uniques::Call::set_collection_max_supply { .. } | + pallet_uniques::Call::set_price { .. } | + pallet_uniques::Call::buy_item { .. }, + ) + ) } } diff --git a/parachains/runtimes/assets/westmint/tests/tests.rs b/parachains/runtimes/assets/westmint/tests/tests.rs index 3ef09d14e52..740edc0c20b 100644 --- a/parachains/runtimes/assets/westmint/tests/tests.rs +++ b/parachains/runtimes/assets/westmint/tests/tests.rs @@ -84,19 +84,16 @@ fn test_asset_xcm_trader() { // Lets pay with: asset_amount_needed + asset_amount_extra let asset_amount_extra = 100_u128; let asset: MultiAsset = - (asset_multilocation.clone(), asset_amount_needed + asset_amount_extra).into(); + (asset_multilocation, asset_amount_needed + asset_amount_extra).into(); let mut trader = ::Trader::new(); // Lets buy_weight and make sure buy_weight does not return an error - match trader.buy_weight(bought, asset.into()) { - Ok(unused_assets) => { - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(asset_multilocation, asset_amount_extra).into())); - }, - Err(e) => assert!(false, "Expected Ok(_). Got {:#?}", e), - } + let unused_assets = trader.buy_weight(bought, asset.into()).expect("Expected Ok"); + // Check whether a correct amount of unused assets is returned + assert_ok!( + unused_assets.ensure_contains(&(asset_multilocation, asset_amount_extra).into()) + ); // Drop trader drop(trader); @@ -156,7 +153,7 @@ fn test_asset_xcm_trader_with_refund() { // lets calculate amount needed let amount_bought = WeightToFee::weight_to_fee(&bought); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Make sure buy_weight does not return an error assert_ok!(trader.buy_weight(bought, asset.clone().into())); @@ -230,7 +227,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() { "we are testing what happens when the amount does not exceed ED" ); - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); // Buy weight should return an error assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); @@ -282,11 +279,11 @@ fn test_that_buying_ed_refund_does_not_refund() { // We know we will have to buy at least ED, so lets make sure first it will // fail with a payment of less than ED - let asset: MultiAsset = (asset_multilocation.clone(), amount_bought).into(); + let asset: MultiAsset = (asset_multilocation, amount_bought).into(); assert_noop!(trader.buy_weight(bought, asset.into()), XcmError::TooExpensive); // Now lets buy ED at least - let asset: MultiAsset = (asset_multilocation.clone(), ExistentialDeposit::get()).into(); + let asset: MultiAsset = (asset_multilocation, ExistentialDeposit::get()).into(); // Buy weight should work assert_ok!(trader.buy_weight(bought, asset.into())); @@ -421,7 +418,7 @@ fn test_assets_balances_api_works() { let foreign_asset_minimum_asset_balance = 3333333_u128; assert_ok!(ForeignAssets::force_create( RuntimeHelper::::root_origin(), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(SOME_ASSET_ADMIN).into(), false, foreign_asset_minimum_asset_balance @@ -430,7 +427,7 @@ fn test_assets_balances_api_works() { // We first mint enough asset for the account to exist for assets assert_ok!(ForeignAssets::mint( RuntimeHelper::::origin_of(AccountId::from(SOME_ASSET_ADMIN)), - foreign_asset_id_multilocation.clone().into(), + foreign_asset_id_multilocation, AccountId::from(ALICE).into(), 6 * foreign_asset_minimum_asset_balance )); diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index 952c3147306..ec9d9f09e41 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -254,7 +254,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -615,7 +615,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -653,7 +653,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( KsmRelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmRelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(KsmRelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -667,7 +667,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(KsmRelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs index 7cf23e0610b..9d11b07e54e 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for BridgeHubKusamaXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for BridgeHubKusamaXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index 0e3ce655349..f432a345b32 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -129,29 +129,27 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) + ) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs index dfc08b4c184..b701645ed17 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -254,7 +254,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -615,7 +615,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -653,7 +653,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( DotRelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(DotRelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(DotRelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -667,7 +667,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(DotRelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs index e9b1c70bf6a..27bdb510ba0 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/weights/xcm/mod.rs @@ -33,8 +33,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -53,7 +52,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -65,7 +64,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -123,7 +122,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } @@ -150,7 +149,7 @@ impl XcmWeightInfo for BridgeHubPolkadotXcmWeight { _xcm: &Xcm<()>, ) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(200_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(200_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::initiate_teleport()); hardcoded_weight.min(weight) } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index 3cd79a8324b..22b7edffffb 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -132,29 +132,27 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) => true, - _ => false, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) + ) } } 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 21f02ce4765..15e34472fc6 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -274,7 +274,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -888,7 +888,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -926,7 +926,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( RelayLocation::get(), - MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(RelayLocation::get()) }, + MultiAsset { fun: Fungible(UNITS), id: Concrete(RelayLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; } @@ -940,7 +940,7 @@ impl_runtime_apis! { fn get_multi_asset() -> MultiAsset { MultiAsset { id: Concrete(RelayLocation::get()), - fun: Fungible(1 * UNITS), + fun: Fungible(UNITS), } } } 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 a0aaac56f5a..9efbef18363 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 @@ -34,8 +34,7 @@ const MAX_ASSETS: u64 = 100; impl WeighMultiAssets for MultiAssetFilter { fn weigh_multi_assets(&self, weight: Weight) -> Weight { match self { - Self::Definite(assets) => - weight.saturating_mul(assets.inner().into_iter().count() as u64), + Self::Definite(assets) => weight.saturating_mul(assets.inner().iter().count() as u64), Self::Wild(asset) => match asset { All => weight.saturating_mul(MAX_ASSETS), AllOf { fun, .. } => match fun { @@ -54,7 +53,7 @@ impl WeighMultiAssets for MultiAssetFilter { impl WeighMultiAssets for MultiAssets { fn weigh_multi_assets(&self, weight: Weight) -> Weight { - weight.saturating_mul(self.inner().into_iter().count() as u64) + weight.saturating_mul(self.inner().iter().count() as u64) } } @@ -66,7 +65,7 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { // Currently there is no trusted reserve fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight { // TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974 - Weight::from_parts(1_000_000_000 as u64, 0) + Weight::from_parts(1_000_000_000_u64, 0) } fn receive_teleported_asset(assets: &MultiAssets) -> Weight { assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset()) @@ -124,7 +123,7 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight { fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight { // Hardcoded till the XCM pallet is fixed - let hardcoded_weight = Weight::from_parts(1_000_000_000 as u64, 0); + let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0); let weight = assets.weigh_multi_assets(XcmFungibleWeight::::deposit_asset()); hardcoded_weight.min(weight) } 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 0773dca274e..fe5873f7e11 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 @@ -347,11 +347,11 @@ impl WeightInfo { // 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) + Weight::from_parts(31_677_716_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)) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: 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 cd915a99313..945d0636ac7 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 @@ -152,41 +152,35 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::System( - frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - 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, - } + RuntimeCall::System( + frame_system::Call::set_heap_pages { .. } | + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + 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 { .. }) + ) } } 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 5cdc2af9968..5f419fe789f 100644 --- a/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs +++ b/parachains/runtimes/bridge-hubs/test-utils/src/test_cases.rs @@ -166,7 +166,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< // check queue before assert_eq!( pallet_bridge_messages::OutboundLanes::::try_get( - &expected_lane_id + expected_lane_id ), Err(()) ); @@ -190,7 +190,7 @@ pub fn handle_export_message_from_system_parachain_to_outbound_queue_works< // check queue after assert_eq!( pallet_bridge_messages::OutboundLanes::::try_get( - &expected_lane_id + expected_lane_id ), Ok(OutboundLaneData { oldest_unpruned_nonce: 1, @@ -243,8 +243,8 @@ macro_rules! include_handle_export_message_from_system_parachain_to_outbound_que /// 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 +/// 1. to Parent (relay chain) +/// 2. to Sibling parachain pub fn message_dispatch_routing_works< Runtime, XcmConfig, diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs index 5056abb2e22..71ad62f70b3 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/migration.rs @@ -27,7 +27,7 @@ pub(crate) mod import_kusama_fellowship { #[cfg(feature = "try-runtime")] use sp_std::vec::Vec; - const TARGET: &'static str = "runtime::migration::import_fellowship"; + const TARGET: &str = "runtime::migration::import_fellowship"; parameter_types! { // The Fellowship addresses from Kusama state. @@ -250,7 +250,7 @@ pub mod tests { assert!(IdToIndex::::get(0, &who).is_some()); assert!(IdToIndex::::get(rank + 1, &who).is_none()); let index = IdToIndex::::get(rank, &who).unwrap(); - assert_eq!(IndexToId::::get(rank, &index).unwrap(), who); + assert_eq!(IndexToId::::get(rank, index).unwrap(), who); assert_eq!( Members::::get(&who).unwrap(), MemberRecord::new(rank) diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs index 5d75bde9e18..1f728279485 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -54,7 +54,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -76,7 +76,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -98,7 +98,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -120,7 +120,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -142,7 +142,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -160,11 +160,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -182,11 +182,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -204,11 +204,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -226,11 +226,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), @@ -248,11 +248,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: DOLLARS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, - min_enactment_period: 1 * MINUTES, + min_enactment_period: MINUTES, min_approval: pallet_referenda::Curve::LinearDecreasing { length: Perbill::from_percent(100), floor: Perbill::from_percent(50), diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs index f70fb30bff7..3b45d2824d9 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/impls.rs @@ -59,7 +59,7 @@ where let pallet_acc: AccountIdOf = PalletAccount::get(); let treasury_acc: AccountIdOf = TreasuryAccount::get(); - >::resolve_creating(&pallet_acc.clone(), amount); + >::resolve_creating(&pallet_acc, amount); let result = >::teleport_assets( <::RuntimeOrigin>::signed(pallet_acc.into()), @@ -73,10 +73,9 @@ where 0, ); - match result { - Err(err) => log::warn!("Failed to teleport slashed assets: {:?}", err), - _ => (), - }; + if let Err(err) = result { + log::warn!("Failed to teleport slashed assets: {:?}", err); + } } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index e0f95cb052b..b902e694a15 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -216,7 +216,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { /// Relay Chain `TransactionByteFee` / 10 - pub const TransactionByteFee: Balance = 1 * MILLICENTS; + pub const TransactionByteFee: Balance = MILLICENTS; } impl pallet_transaction_payment::Config for Runtime { @@ -843,7 +843,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( @@ -899,7 +899,7 @@ impl cumulus_pallet_parachain_system::CheckInherents for CheckInherents { .create_inherent_data() .expect("Could not create the timestamp inherent data"); - inherent_data.check_extrinsics(&block) + inherent_data.check_extrinsics(block) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs index 7749877a52f..b54f6ede5f2 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs @@ -137,58 +137,54 @@ impl Contains for SafeCallFilter { } } - match call { + matches!( + call, RuntimeCall::System( frame_system::Call::set_heap_pages { .. } | - frame_system::Call::set_code { .. } | - frame_system::Call::set_code_without_checks { .. } | - frame_system::Call::kill_prefix { .. }, - ) | - RuntimeCall::ParachainSystem(..) | - RuntimeCall::Timestamp(..) | - RuntimeCall::Balances(..) | - RuntimeCall::CollatorSelection( - pallet_collator_selection::Call::set_desired_candidates { .. } | - pallet_collator_selection::Call::set_candidacy_bond { .. } | - pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, - ) | - RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | - RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | - RuntimeCall::XcmpQueue(..) | - RuntimeCall::DmpQueue(..) | - RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | - RuntimeCall::Alliance( - // `init_members` accepts unbounded vecs as arguments, - // but the call can be initiated only by root origin. - pallet_alliance::Call::init_members { .. } | - pallet_alliance::Call::vote { .. } | - pallet_alliance::Call::disband { .. } | - pallet_alliance::Call::set_rule { .. } | - pallet_alliance::Call::announce { .. } | - pallet_alliance::Call::remove_announcement { .. } | - pallet_alliance::Call::join_alliance { .. } | - pallet_alliance::Call::nominate_ally { .. } | - pallet_alliance::Call::elevate_ally { .. } | - pallet_alliance::Call::give_retirement_notice { .. } | - pallet_alliance::Call::retire { .. } | - pallet_alliance::Call::kick_member { .. } | - pallet_alliance::Call::close { .. } | - pallet_alliance::Call::abdicate_fellow_status { .. }, - ) | - RuntimeCall::AllianceMotion( + frame_system::Call::set_code { .. } | + frame_system::Call::set_code_without_checks { .. } | + frame_system::Call::kill_prefix { .. }, + ) | RuntimeCall::ParachainSystem(..) | + RuntimeCall::Timestamp(..) | + RuntimeCall::Balances(..) | + RuntimeCall::CollatorSelection( + pallet_collator_selection::Call::set_desired_candidates { .. } | + pallet_collator_selection::Call::set_candidacy_bond { .. } | + pallet_collator_selection::Call::register_as_candidate { .. } | + pallet_collator_selection::Call::leave_intent { .. }, + ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | + RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | + RuntimeCall::XcmpQueue(..) | + RuntimeCall::DmpQueue(..) | + RuntimeCall::Utility(pallet_utility::Call::as_derivative { .. }) | + RuntimeCall::Alliance( + // `init_members` accepts unbounded vecs as arguments, + // but the call can be initiated only by root origin. + pallet_alliance::Call::init_members { .. } | + pallet_alliance::Call::vote { .. } | + pallet_alliance::Call::disband { .. } | + pallet_alliance::Call::set_rule { .. } | + pallet_alliance::Call::announce { .. } | + pallet_alliance::Call::remove_announcement { .. } | + pallet_alliance::Call::join_alliance { .. } | + pallet_alliance::Call::nominate_ally { .. } | + pallet_alliance::Call::elevate_ally { .. } | + pallet_alliance::Call::give_retirement_notice { .. } | + pallet_alliance::Call::retire { .. } | + pallet_alliance::Call::kick_member { .. } | + pallet_alliance::Call::close { .. } | + pallet_alliance::Call::abdicate_fellow_status { .. }, + ) | RuntimeCall::AllianceMotion( pallet_collective::Call::vote { .. } | - pallet_collective::Call::disapprove_proposal { .. } | - pallet_collective::Call::close { .. }, - ) | - RuntimeCall::FellowshipCollective( + pallet_collective::Call::disapprove_proposal { .. } | + pallet_collective::Call::close { .. }, + ) | RuntimeCall::FellowshipCollective( pallet_ranked_collective::Call::add_member { .. } | - pallet_ranked_collective::Call::promote_member { .. } | - pallet_ranked_collective::Call::demote_member { .. } | - pallet_ranked_collective::Call::remove_member { .. }, - ) => true, - _ => false, - } + pallet_ranked_collective::Call::promote_member { .. } | + pallet_ranked_collective::Call::demote_member { .. } | + pallet_ranked_collective::Call::remove_member { .. }, + ) + ) } } diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index adeee2b5229..2718484fed6 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -639,7 +639,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( diff --git a/parachains/runtimes/starters/shell/src/lib.rs b/parachains/runtimes/starters/shell/src/lib.rs index a05a78863c4..fc87a26f8ee 100644 --- a/parachains/runtimes/starters/shell/src/lib.rs +++ b/parachains/runtimes/starters/shell/src/lib.rs @@ -222,7 +222,7 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned { info: &DispatchInfoOf, len: usize, ) -> Result { - Ok(self.validate(who, call, info, len).map(|_| ())?) + self.validate(who, call, info, len).map(|_| ()) } fn validate( &self, diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index 7ade3bd2f63..5a5cb423d43 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -783,7 +783,7 @@ impl_runtime_apis! { list_benchmarks!(list, extra); let storage_info = AllPalletsWithSystem::storage_info(); - return (list, storage_info) + (list, storage_info) } fn dispatch_benchmark( diff --git a/parachains/runtimes/testing/penpal/src/xcm_config.rs b/parachains/runtimes/testing/penpal/src/xcm_config.rs index 89236aa93a9..849b0a690a9 100644 --- a/parachains/runtimes/testing/penpal/src/xcm_config.rs +++ b/parachains/runtimes/testing/penpal/src/xcm_config.rs @@ -225,12 +225,12 @@ pub trait Reserve { // Takes the chain part of a MultiAsset impl Reserve for MultiAsset { fn reserve(&self) -> Option { - if let AssetId::Concrete(location) = self.id.clone() { + if let AssetId::Concrete(location) = self.id { let first_interior = location.first_interior(); let parents = location.parent_count(); - match (parents, first_interior.clone()) { - (0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(id.clone())))), - (1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(id.clone())))), + match (parents, first_interior) { + (0, Some(Parachain(id))) => Some(MultiLocation::new(0, X1(Parachain(*id)))), + (1, Some(Parachain(id))) => Some(MultiLocation::new(1, X1(Parachain(*id)))), (1, _) => Some(MultiLocation::parent()), _ => None, } diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 0147c28335c..4d539f050e1 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -219,10 +219,10 @@ impl pallet_timestamp::Config for Runtime { } parameter_types! { - pub const ExistentialDeposit: u128 = 1 * MILLIROC; - pub const TransferFee: u128 = 1 * MILLIROC; - pub const CreationFee: u128 = 1 * MILLIROC; - pub const TransactionByteFee: u128 = 1 * MICROROC; + pub const ExistentialDeposit: u128 = MILLIROC; + pub const TransferFee: u128 = MILLIROC; + pub const CreationFee: u128 = MILLIROC; + pub const TransactionByteFee: u128 = MICROROC; } impl pallet_balances::Config for Runtime { @@ -505,11 +505,11 @@ impl cumulus_ping::Config for Runtime { } parameter_types! { - pub const AssetDeposit: Balance = 1 * ROC; - pub const AssetAccountDeposit: Balance = 1 * ROC; + pub const AssetDeposit: Balance = ROC; + pub const AssetAccountDeposit: Balance = ROC; pub const ApprovalDeposit: Balance = 100 * MILLIROC; pub const AssetsStringLimit: u32 = 50; - pub const MetadataDepositBase: Balance = 1 * ROC; + pub const MetadataDepositBase: Balance = ROC; pub const MetadataDepositPerByte: Balance = 10 * MILLIROC; pub const UnitBody: BodyId = BodyId::Unit; } diff --git a/polkadot-parachain/src/chain_spec/bridge_hubs.rs b/polkadot-parachain/src/chain_spec/bridge_hubs.rs index e11f7f6e53f..e8f7d9d065d 100644 --- a/polkadot-parachain/src/chain_spec/bridge_hubs.rs +++ b/polkadot-parachain/src/chain_spec/bridge_hubs.rs @@ -272,7 +272,7 @@ pub mod rococo { para_id, bridges_pallet_owner_seed .as_ref() - .map(|seed| get_account_id_from_seed::(&seed)), + .map(|seed| get_account_id_from_seed::(seed)), ) }, Vec::new(), diff --git a/polkadot-parachain/src/command.rs b/polkadot-parachain/src/command.rs index 52a742f1527..32986b522ca 100644 --- a/polkadot-parachain/src/command.rs +++ b/polkadot-parachain/src/command.rs @@ -85,7 +85,7 @@ impl RuntimeResolver for PathBuf { } fn runtime(id: &str) -> Runtime { - let id = id.replace("_", "-"); + let id = id.replace('_', "-"); let (_, id, para_id) = extract_parachain_id(&id); if id.starts_with("shell") { @@ -240,7 +240,7 @@ fn load_spec(id: &str) -> std::result::Result, String> { Runtime::ContractsRococo => Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?), Runtime::BridgeHub(bridge_hub_runtime_type) => - bridge_hub_runtime_type.chain_spec_from_json_file(path.into())?, + bridge_hub_runtime_type.chain_spec_from_json_file(path)?, Runtime::Penpal(_para_id) => Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?), Runtime::Default => Box::new( @@ -258,12 +258,10 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option) { const KUSAMA_TEST_PARA_PREFIX: &str = "penpal-kusama-"; const POLKADOT_TEST_PARA_PREFIX: &str = "penpal-polkadot-"; - let (norm_id, orig_id, para) = if id.starts_with(KUSAMA_TEST_PARA_PREFIX) { - let suffix = &id[KUSAMA_TEST_PARA_PREFIX.len()..]; + let (norm_id, orig_id, para) = if let Some(suffix) = id.strip_prefix(KUSAMA_TEST_PARA_PREFIX) { let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); (&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id)) - } else if id.starts_with(POLKADOT_TEST_PARA_PREFIX) { - let suffix = &id[POLKADOT_TEST_PARA_PREFIX.len()..]; + } else if let Some(suffix) = id.strip_prefix(POLKADOT_TEST_PARA_PREFIX) { let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix"); (&id[..POLKADOT_TEST_PARA_PREFIX.len() - 1], id, Some(para_id)) } else { @@ -813,13 +811,13 @@ pub fn run() -> Result<()> { runner.run_node_until_exit(|config| async move { let hwbench = (!cli.no_hardware_benchmarks).then_some( config.database.path().map(|database_path| { - let _ = std::fs::create_dir_all(&database_path); + let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) })).flatten(); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) .map(|e| e.para_id) - .ok_or_else(|| "Could not find parachain extension in chain-spec.")?; + .ok_or("Could not find parachain extension in chain-spec.")?; let polkadot_cli = RelayChainCli::new( &config, @@ -848,7 +846,7 @@ pub fn run() -> Result<()> { info!("Parachain genesis state: {}", genesis_state); info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); - if !collator_options.relay_chain_rpc_urls.is_empty() && cli.relaychain_args.len() > 0 { + if !collator_options.relay_chain_rpc_urls.is_empty() && !cli.relaychain_args.is_empty() { warn!("Detected relay chain node arguments together with --relay-chain-rpc-url. This command starts a minimal Polkadot node that only uses a network-related subset of all relay chain CLI options."); } diff --git a/polkadot-parachain/src/rpc.rs b/polkadot-parachain/src/rpc.rs index 43752fd8d12..c2eeaf38608 100644 --- a/polkadot-parachain/src/rpc.rs +++ b/polkadot-parachain/src/rpc.rs @@ -70,7 +70,7 @@ where module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?; module.merge(TransactionPayment::new(client.clone()).into_rpc())?; - module.merge(StateMigration::new(client.clone(), backend, deny_unsafe).into_rpc())?; + module.merge(StateMigration::new(client, backend, deny_unsafe).into_rpc())?; Ok(module) } diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 803d0987844..c8370d070a6 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -858,7 +858,7 @@ where sc_client_api::StateBackendFor: sp_api::StateBackend, { cumulus_client_consensus_relay_chain::import_queue( - client.clone(), + client, block_import, |_, _| async { Ok(()) }, &task_manager.spawn_essential_handle(), @@ -1103,7 +1103,7 @@ where Box::new(RelayChainVerifier::new(client.clone(), |_, _| async { Ok(()) })) as Box<_>; let verifier = Verifier { - client: client.clone(), + client, relay_chain_verifier, aura_verifier: BuildOnAccess::Uninitialized(Some(Box::new(aura_verifier))), _phantom: PhantomData, diff --git a/polkadot-parachain/tests/benchmark_storage_works.rs b/polkadot-parachain/tests/benchmark_storage_works.rs index 916d65c0a1b..b1c05609217 100644 --- a/polkadot-parachain/tests/benchmark_storage_works.rs +++ b/polkadot-parachain/tests/benchmark_storage_works.rs @@ -8,7 +8,7 @@ use std::{ use tempfile::tempdir; /// The runtimes that this command supports. -static RUNTIMES: [&'static str; 3] = ["westmint", "statemine", "statemint"]; +static RUNTIMES: [&str; 3] = ["westmint", "statemine", "statemint"]; /// The `benchmark storage` command works for the dev runtimes. #[test] @@ -31,7 +31,7 @@ fn benchmark_storage_works() { /// Invoke the `benchmark storage` sub-command for the given database and runtime. fn benchmark_storage(db: &str, runtime: &str, base_path: &Path) -> ExitStatus { Command::new(cargo_bin("polkadot-parachain")) - .args(&["benchmark", "storage", "--chain", runtime]) + .args(["benchmark", "storage", "--chain", runtime]) .arg("--db") .arg(db) .arg("--weight-path") diff --git a/polkadot-parachain/tests/common.rs b/polkadot-parachain/tests/common.rs index 71b7fb42cd2..d8ecfe9bcbe 100644 --- a/polkadot-parachain/tests/common.rs +++ b/polkadot-parachain/tests/common.rs @@ -117,12 +117,12 @@ pub fn find_ws_url_from_output(read: impl Read + Send) -> (String, String) { line.expect("failed to obtain next line from stdout for WS address discovery"); data.push_str(&line); - data.push_str("\n"); + data.push('\n'); // does the line contain our port (we expect this specific output from substrate). let sock_addr = match line.split_once("Running JSON-RPC server: addr=") { None => return None, - Some((_, after)) => after.split_once(",").unwrap().0, + Some((_, after)) => after.split_once(',').unwrap().0, }; Some(format!("ws://{}", sock_addr)) diff --git a/polkadot-parachain/tests/purge_chain_works.rs b/polkadot-parachain/tests/purge_chain_works.rs index 34a51dcff84..2f4609273da 100644 --- a/polkadot-parachain/tests/purge_chain_works.rs +++ b/polkadot-parachain/tests/purge_chain_works.rs @@ -38,7 +38,7 @@ async fn purge_chain_works() { assert!(base_dir.path().join("polkadot/chains/dev/db/full").exists()); let status = Command::new(cargo_bin("polkadot-parachain")) - .args(&["purge-chain", "-d"]) + .args(["purge-chain", "-d"]) .arg(base_dir.path()) .arg("-y") .status() diff --git a/primitives/parachain-inherent/src/client_side.rs b/primitives/parachain-inherent/src/client_side.rs index 6f2cd5eb504..1a1506dcbbd 100644 --- a/primitives/parachain-inherent/src/client_side.rs +++ b/primitives/parachain-inherent/src/client_side.rs @@ -92,18 +92,19 @@ async fn collect_relay_storage_proof( .ok()? .unwrap_or_default(); - let mut relevant_keys = Vec::new(); - relevant_keys.push(relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec()); - relevant_keys.push(relay_well_known_keys::CURRENT_SLOT.to_vec()); - relevant_keys.push(relay_well_known_keys::ACTIVE_CONFIG.to_vec()); - relevant_keys.push(relay_well_known_keys::dmq_mqc_head(para_id)); - relevant_keys.push(relay_well_known_keys::relay_dispatch_queue_size(para_id)); - relevant_keys.push(relay_well_known_keys::hrmp_ingress_channel_index(para_id)); - relevant_keys.push(relay_well_known_keys::hrmp_egress_channel_index(para_id)); - relevant_keys.push(relay_well_known_keys::upgrade_go_ahead_signal(para_id)); - relevant_keys.push(relay_well_known_keys::upgrade_restriction_signal(para_id)); + let mut relevant_keys = vec![ + relay_well_known_keys::CURRENT_BLOCK_RANDOMNESS.to_vec(), + relay_well_known_keys::ONE_EPOCH_AGO_RANDOMNESS.to_vec(), + relay_well_known_keys::TWO_EPOCHS_AGO_RANDOMNESS.to_vec(), + relay_well_known_keys::CURRENT_SLOT.to_vec(), + relay_well_known_keys::ACTIVE_CONFIG.to_vec(), + relay_well_known_keys::dmq_mqc_head(para_id), + relay_well_known_keys::relay_dispatch_queue_size(para_id), + relay_well_known_keys::hrmp_ingress_channel_index(para_id), + relay_well_known_keys::hrmp_egress_channel_index(para_id), + relay_well_known_keys::upgrade_go_ahead_signal(para_id), + relay_well_known_keys::upgrade_restriction_signal(para_id), + ]; relevant_keys.extend(ingress_channels.into_iter().map(|sender| { relay_well_known_keys::hrmp_channels(HrmpChannelId { sender, recipient: para_id }) })); diff --git a/primitives/parachain-inherent/src/mock.rs b/primitives/parachain-inherent/src/mock.rs index a26ee114ef7..00dff40800f 100644 --- a/primitives/parachain-inherent/src/mock.rs +++ b/primitives/parachain-inherent/src/mock.rs @@ -160,8 +160,8 @@ impl> InherentDataProvider self.relay_offset + self.relay_blocks_per_para_block * self.current_para_block; // Use the "sproof" (spoof proof) builder to build valid mock state root and proof. - let mut sproof_builder = RelayStateSproofBuilder::default(); - sproof_builder.para_id = self.xcm_config.para_id; + let mut sproof_builder = + RelayStateSproofBuilder { para_id: self.xcm_config.para_id, ..Default::default() }; // Process the downward messages and set up the correct head let mut downward_messages = Vec::new(); diff --git a/primitives/timestamp/src/lib.rs b/primitives/timestamp/src/lib.rs index ddc2fe340dd..932656d9b0f 100644 --- a/primitives/timestamp/src/lib.rs +++ b/primitives/timestamp/src/lib.rs @@ -99,7 +99,7 @@ mod tests { relay_parent_number: 1, relay_parent_storage_root, }, - &WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), + WASM_BINARY.expect("You need to build the WASM binaries to run the tests!"), ) .map(|v| Header::decode(&mut &v.head_data.0[..]).expect("Decodes `Header`.")) } @@ -175,7 +175,7 @@ mod tests { (slot_timestamp * 10, false), ] { let output = Command::new(env::current_exe().unwrap()) - .args(&["check_timestamp_inherent_works", "--", "--nocapture"]) + .args(["check_timestamp_inherent_works", "--", "--nocapture"]) .env("RUN_TEST", "1") .env("TIMESTAMP", timestamp.to_string()) .output() diff --git a/primitives/utility/src/lib.rs b/primitives/utility/src/lib.rs index d3a7c77aed2..e71eab178a8 100644 --- a/primitives/utility/src/lib.rs +++ b/primitives/utility/src/lib.rs @@ -163,7 +163,7 @@ impl< // Get the local asset id in which we can pay for fees let (local_asset_id, _) = - Matcher::matches_fungibles(&first).map_err(|_| XcmError::AssetNotFound)?; + Matcher::matches_fungibles(first).map_err(|_| XcmError::AssetNotFound)?; // Calculate how much we should charge in the asset_id for such amount of weight // Require at least a payment of minimum_balance @@ -181,7 +181,7 @@ impl< .map_err(|_| XcmError::Overflow)?; // Convert to the same kind of multiasset, with the required fungible balance - let required = first.id.clone().into_multiasset(asset_balance.into()); + let required = first.id.into_multiasset(asset_balance.into()); // Substract payment let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?; @@ -204,7 +204,7 @@ impl< { // Get the local asset id in which we can refund fees let (local_asset_id, outstanding_balance) = - Matcher::matches_fungibles(&(id.clone(), fun).into()).ok()?; + Matcher::matches_fungibles(&(id, fun).into()).ok()?; let minimum_balance = ConcreteAssets::minimum_balance(local_asset_id); @@ -233,8 +233,7 @@ impl< let asset_balance: u128 = asset_balance.saturated_into(); // Construct outstanding_concrete_asset with the same location id and substracted balance - let outstanding_concrete_asset: MultiAsset = - (id.clone(), outstanding_minus_substracted).into(); + let outstanding_concrete_asset: MultiAsset = (id, outstanding_minus_substracted).into(); // Substract from existing weight and balance weight_outstanding = weight_outstanding.saturating_sub(weight); @@ -365,7 +364,7 @@ mod tests { // ParentAsUmp - check dest is really not applicable let dest = (Parent, Parent, Parent); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert_eq!( Err(SendError::NotApplicable), @@ -373,7 +372,7 @@ mod tests { ); // check wrapper were not consumed - assert_eq!(Some(dest.clone().into()), dest_wrapper.take()); + assert_eq!(Some(dest.into()), dest_wrapper.take()); assert_eq!(Some(message.clone()), msg_wrapper.take()); // another try with router chain with asserting sender @@ -393,7 +392,7 @@ mod tests { // ParentAsUmp - check dest/msg is valid let dest = (Parent, Here); - let mut dest_wrapper = Some(dest.clone().into()); + let mut dest_wrapper = Some(dest.into()); let mut msg_wrapper = Some(message.clone()); assert!( as SendXcm>::validate( &mut dest_wrapper, @@ -529,16 +528,13 @@ mod tests { // prepare test data let asset: MultiAsset = (Here, AMOUNT).into(); - let payment = Assets::from(asset.clone()); + let payment = Assets::from(asset); let weight_to_buy = Weight::from_parts(1_000, 1_000); // lets do first call (success) assert_ok!(trader.buy_weight(weight_to_buy, payment.clone())); // lets do second call (error) - assert_eq!( - trader.buy_weight(weight_to_buy, payment.clone()), - Err(XcmError::NotWithdrawable) - ); + assert_eq!(trader.buy_weight(weight_to_buy, payment), Err(XcmError::NotWithdrawable)); } } diff --git a/scripts/ci/gitlab/pipeline/test.yml b/scripts/ci/gitlab/pipeline/test.yml index 0ef51ae2e6d..a67c15eec6b 100644 --- a/scripts/ci/gitlab/pipeline/test.yml +++ b/scripts/ci/gitlab/pipeline/test.yml @@ -97,3 +97,11 @@ cargo-check-benches: artifacts: false script: - time cargo check --all --benches + +cargo-clippy: + stage: test + extends: + - .docker-env + - .common-refs + script: + - SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --locked --all-targets diff --git a/test/client/src/block_builder.rs b/test/client/src/block_builder.rs index 13b20df6be6..0c0c5c4e9c7 100644 --- a/test/client/src/block_builder.rs +++ b/test/client/src/block_builder.rs @@ -64,13 +64,13 @@ pub trait InitBlockBuilder { ) -> sc_block_builder::BlockBuilder; } -fn init_block_builder<'a>( - client: &'a Client, +fn init_block_builder( + client: &Client, at: Hash, validation_data: Option>, relay_sproof_builder: RelayStateSproofBuilder, timestamp: u64, -) -> BlockBuilder<'a, Block, Client, Backend> { +) -> BlockBuilder<'_, Block, Client, Backend> { let mut block_builder = client .new_block_at(at, Default::default(), true) .expect("Creates new block builder for test runtime"); diff --git a/test/client/src/lib.rs b/test/client/src/lib.rs index 4008dca350d..4027a056d55 100644 --- a/test/client/src/lib.rs +++ b/test/client/src/lib.rs @@ -199,5 +199,4 @@ pub fn validate_block( &validation_params.encode(), ) .map(|v| ValidationResult::decode(&mut &v[..]).expect("Decode `ValidationResult`.")) - .map_err(|err| err.into()) } diff --git a/test/relay-sproof-builder/src/lib.rs b/test/relay-sproof-builder/src/lib.rs index decc6ee3aa0..b5fc0c7f08f 100644 --- a/test/relay-sproof-builder/src/lib.rs +++ b/test/relay-sproof-builder/src/lib.rs @@ -171,7 +171,7 @@ impl RelayStateSproofBuilder { } } - let root = backend.root().clone(); + let root = *backend.root(); let proof = sp_state_machine::prove_read(backend, relevant_keys).expect("prove read"); (root, proof) } diff --git a/test/service/benches/transaction_throughput.rs b/test/service/benches/transaction_throughput.rs index 1c3f841fe23..48bf49487e6 100644 --- a/test/service/benches/transaction_throughput.rs +++ b/test/service/benches/transaction_throughput.rs @@ -46,7 +46,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec accounts .iter() .enumerate() - .map(|(i, a)| { + .flat_map(|(i, a)| { vec![ // Reset the nonce by removing any funds construct_extrinsic( @@ -54,7 +54,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec SudoCall::sudo { call: Box::new( BalancesCall::force_set_balance { - who: AccountId::from(a.public()).into(), + who: AccountId::from(a.public()), new_free: 0, } .into(), @@ -69,7 +69,7 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec SudoCall::sudo { call: Box::new( BalancesCall::force_set_balance { - who: AccountId::from(a.public()).into(), + who: AccountId::from(a.public()), new_free: 1_000_000_000_000 * ExistentialDeposit::get(), } .into(), @@ -80,7 +80,6 @@ fn create_account_extrinsics(client: &Client, accounts: &[sr25519::Pair]) -> Vec ), ] }) - .flatten() .map(OpaqueExtrinsic::from) .collect() } @@ -92,20 +91,19 @@ fn create_benchmark_extrinsics( ) -> Vec { accounts .iter() - .map(|account| { + .flat_map(|account| { (0..extrinsics_per_account).map(move |nonce| { construct_extrinsic( client, BalancesCall::transfer_allow_death { - dest: Bob.to_account_id().into(), - value: 1 * ExistentialDeposit::get(), + dest: Bob.to_account_id(), + value: ExistentialDeposit::get(), }, account.clone(), Some(nonce as u32), ) }) }) - .flatten() .map(OpaqueExtrinsic::from) .collect() } @@ -208,27 +206,27 @@ fn transaction_throughput_benchmarks(c: &mut Criterion) { |b| { b.iter_batched( || { - let prepare_extrinsics = create_account_extrinsics(&*dave.client, &accounts); + let prepare_extrinsics = create_account_extrinsics(&dave.client, &accounts); benchmark_handle.block_on(future::join_all( prepare_extrinsics.into_iter().map(|tx| { submit_tx_and_wait_for_inclusion( &dave.transaction_pool, tx, - &*dave.client, + &dave.client, true, ) }), )); - create_benchmark_extrinsics(&*dave.client, &accounts, extrinsics_per_account) + create_benchmark_extrinsics(&dave.client, &accounts, extrinsics_per_account) }, |extrinsics| { benchmark_handle.block_on(future::join_all(extrinsics.into_iter().map(|tx| { submit_tx_and_wait_for_inclusion( &dave.transaction_pool, tx, - &*dave.client, + &dave.client, false, ) }))); diff --git a/test/service/src/chain_spec.rs b/test/service/src/chain_spec.rs index e1399e97a36..5ae77084b6c 100644 --- a/test/service/src/chain_spec.rs +++ b/test/service/src/chain_spec.rs @@ -39,7 +39,7 @@ pub struct GenesisExt { impl sp_runtime::BuildStorage for GenesisExt { fn assimilate_storage(&self, storage: &mut sp_core::storage::Storage) -> Result<(), String> { sp_state_machine::BasicExternalities::execute_with_storage(storage, || { - sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &vec![1, 2, 3, 4]); + sp_io::storage::set(cumulus_test_runtime::TEST_RUNTIME_UPGRADE_KEY, &[1, 2, 3, 4]); cumulus_test_runtime::ParachainId::set(&self.para_id); }); @@ -125,7 +125,6 @@ fn testnet_genesis( code: cumulus_test_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), - ..Default::default() }, parachain_system: Default::default(), balances: cumulus_test_runtime::BalancesConfig { diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index 662f04487aa..b24e71936a0 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -630,7 +630,7 @@ impl TestNodeBuilder { let parachain_config = node_config( self.storage_update_func_parachain.unwrap_or_else(|| Box::new(|| ())), self.tokio_handle.clone(), - self.key.clone(), + self.key, self.parachain_nodes, self.parachain_nodes_exclusive, self.para_id, @@ -667,7 +667,7 @@ impl TestNodeBuilder { .await .expect("could not create Cumulus test service"); - let peer_id = network.local_peer_id().clone(); + let peer_id = network.local_peer_id(); let addr = MultiaddrWithPeerId { multiaddr, peer_id }; TestNode { task_manager, client, network, addr, rpc_handlers, transaction_pool } @@ -690,7 +690,7 @@ pub fn node_config( is_collator: bool, ) -> Result { let base_path = BasePath::new_temp_dir()?; - let root = base_path.path().join(format!("cumulus_test_service_{}", key.to_string())); + let root = base_path.path().join(format!("cumulus_test_service_{}", key)); let role = if is_collator { Role::Authority } else { Role::Full }; let key_seed = key.to_seed(); let mut spec = Box::new(chain_spec::get_chain_spec(para_id)); @@ -786,7 +786,7 @@ impl TestNode { function: impl Into, caller: Sr25519Keyring, ) -> Result { - let extrinsic = construct_extrinsic(&*self.client, function, caller.pair(), Some(0)); + let extrinsic = construct_extrinsic(&self.client, function, caller.pair(), Some(0)); self.rpc_handlers.send_transaction(extrinsic.into()).await } From b11de13257a744df95a13dc469ae668ceacb6019 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sat, 6 May 2023 16:02:34 +0200 Subject: [PATCH 27/60] relay chain with types --- .../xcm-emulator/common/src/lib.rs | 2 +- xcm/xcm-emulator/src/lib.rs | 512 +++++++++--------- 2 files changed, 261 insertions(+), 253 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 793150efed9..83ecd2def2f 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -8,7 +8,7 @@ use frame_support::{ traits::{fungibles::Inspect, GenesisBuild}, }; use xcm::prelude::*; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, Network, Relay, Parachain}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, Network, RelayChain, Parachain}; use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 4bbb25c99cb..b65be27b47d 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -50,6 +50,27 @@ pub use xcm::{v3::prelude::*, VersionedXcm}; pub use xcm_executor::XcmExecutor; pub use std::{thread::LocalKey, collections::HashMap}; +thread_local! { + /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` + #[allow(clippy::type_complexity)] + pub static DOWNWARD_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); + #[allow(clippy::type_complexity)] + /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` + pub static DMP_DONE: RefCell)>>> + = RefCell::new(HashMap::new()); + /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` + #[allow(clippy::type_complexity)] + pub static HORIZONTAL_MESSAGES: RefCell)>)>>> + = RefCell::new(HashMap::new()); + /// Upward messages, each message is: `(from_para_id, msg) + pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); + /// Global incremental relay chain block number + pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); + /// Flag indicating if global variables have been initialized for a certain Network + pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); +} + pub trait TestExt { // fn ext_wrapper(func: impl FnOnce() -> R) -> R; fn ext_wrapper(func: R) -> R; @@ -59,61 +80,15 @@ pub trait TestExt { fn execute_with(execute: impl FnOnce() -> R) -> R; // fn get_ext() -> &'static sp_io::TestExternalities; } - -pub trait Network { - fn network_name() -> String { Default::default() } - - fn init() {} - - // fn relay_block_number() -> &'static LocalKey>> { &RELAY_BLOCK_NUMBER } - - fn relay_block_number() -> u32 { Default::default() } // { &RELAY_BLOCK_NUMBER } - - fn set_relay_block_number(block_number: u32) {} // { &RELAY_BLOCK_NUMBER } - - fn hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> ParachainInherentData { - ParachainInherentData { - validation_data: PersistedValidationData { - parent_head: Default::default(), - relay_parent_number: Default::default(), - relay_parent_storage_root: Default::default(), - max_pov_size: Default::default(), - }, - relay_chain_state: StorageProof::new(Vec::new()), - downward_messages: Default::default(), - horizontal_messages: Default::default(), - } - } - - fn process_messages() {} -} - -pub trait Relay: Network { - fn para_ids() -> Vec { Default::default() } - - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) {} -} - -pub trait Parachain: Network { +// Relay Chain Implementation +pub trait RelayChain: Network { type Runtime; - type Origin; - type XcmpMessageHandler; - type DmpMessageHandler; + type XcmConfig; type System; - type ParachainSystem; - - fn para_id() -> ParaId { - Default::default() - } - fn send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) {} + fn para_ids() -> Vec { Default::default() } - fn send_upward_message(from_para_id: u32, msg: Vec) {} + fn send_downward_messages(_to_para_id: u32, _iter: impl Iterator)>) {} } #[macro_export] @@ -134,9 +109,13 @@ macro_rules! decl_test_relay_chains { pub struct $name; impl Network for $name {} - impl Relay for $name {} + impl RelayChain for $name { + type Runtime = $runtime; + type XcmConfig = $xcm_config; + type System = $system; + } - $crate::__impl_ext_for_relay_chain!($name, $runtime, $system, $genesis, $on_init); + $crate::__impl_ext_for_relay_chain!($name, $genesis, $on_init); impl $crate::UmpSink for $name { fn process_upward_message( @@ -147,7 +126,7 @@ macro_rules! decl_test_relay_chains { use $crate::{TestExt, UmpSink}; Self::execute_with(|| { - $crate::XcmSink::<$crate::XcmExecutor<$xcm_config>, $runtime>::process_upward_message(origin, msg, max_weight) + $crate::XcmSink::<$crate::XcmExecutor<::XcmConfig>, ::Runtime>::process_upward_message(origin, msg, max_weight) }) } } @@ -155,93 +134,16 @@ macro_rules! decl_test_relay_chains { }; } -#[macro_export] -macro_rules! decl_test_parachains { - ( - $( - pub struct $name:ident { - Runtime = $runtime:path, - RuntimeOrigin = $origin:path, - XcmpMessageHandler = $xcmp_message_handler:path, - DmpMessageHandler = $dmp_message_handler:path, - System = $system:path, - ParachainSystem = $parachain_system:path, - genesis = $genesis:expr, - on_init = $on_init:expr, - para_id = $para_id:expr, - } - ), - + - ) => { - $( - pub struct $name; - - impl Network for $name {} - impl Parachain for $name { - // fn para_id() -> $crate::ParaId { - // $para_id - // } - - type Runtime = $runtime; - type Origin = $origin; - type XcmpMessageHandler = $xcmp_message_handler; - type DmpMessageHandler = $dmp_message_handler; - type System = $system; - type ParachainSystem = $parachain_system; - } - - $crate::__impl_ext_for_parachain!($name, $genesis, $on_init, $para_id); - $crate::__impl_xcm_handlers_for_parachain!($name); - - - )+ - }; -} - -#[macro_export] -macro_rules! __impl_xcm_handlers_for_parachain { - ($name:ident) => { - impl $crate::XcmpMessageHandler for $name { - fn handle_xcmp_messages< - 'a, - I: Iterator, - >( - iter: I, - max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{TestExt, XcmpMessageHandler}; - - $name::execute_with(|| { - ::XcmpMessageHandler::handle_xcmp_messages(iter, max_weight) - }) - } - } - - impl $crate::DmpMessageHandler for $name { - fn handle_dmp_messages( - iter: impl Iterator)>, - max_weight: $crate::Weight, - ) -> $crate::Weight { - use $crate::{DmpMessageHandler, TestExt}; - - $name::execute_with(|| { - ::DmpMessageHandler::handle_dmp_messages(iter, max_weight) - }) - } - } - } -} - #[macro_export] macro_rules! __impl_ext_for_relay_chain { // entry point: generate ext name - ($name:ident, $runtime:path, $system:path, $genesis:expr, $on_init:expr) => { + ($name:ident, $genesis:expr, $on_init:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_relay_chain!(@impl $name, $runtime, $system, $genesis, $on_init, []); + $crate::__impl_ext_for_relay_chain!(@impl $name, $genesis, $on_init, []); } }; // impl - (@impl $name:ident, $runtime:path, $system:path, $genesis:expr, $on_init:expr, $ext_name:ident) => { + (@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> = $crate::RefCell::new(<$name>::build_new_ext($genesis)); @@ -265,7 +167,7 @@ macro_rules! __impl_ext_for_relay_chain { ext.execute_with(|| { $on_init; sp_tracing::try_init_simple(); - <$system>::set_block_number(1); + ::System::set_block_number(1); }); ext } @@ -292,7 +194,7 @@ macro_rules! __impl_ext_for_relay_chain { //TODO: mark sent count & filter out sent msg for para_id in <$name>::para_ids() { // downward messages - let downward_messages = <$runtime>::dmq_contents(para_id.into()) + let downward_messages = ::Runtime::dmq_contents(para_id.into()) .into_iter() .map(|inbound| (inbound.sent_at, inbound.msg)); if downward_messages.len() == 0 { @@ -318,6 +220,149 @@ macro_rules! __impl_ext_for_relay_chain { }; } +#[macro_export] +macro_rules! __impl_relay { + ($network_name:ident, $relay_chain:ty) => { + + impl $relay_chain { + fn network_name() -> String { + <$network_name>::_network_name() + } + + fn init() { + <$network_name>::_init(); + } + + // fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + // <$network_name>::_relay_block_number() + // } + + fn relay_block_number() -> u32 { + <$network_name>::_relay_block_number() + } + + fn set_relay_block_number(block_number: u32) { + <$network_name>::_set_relay_block_number(block_number); + } + + fn para_ids() -> Vec { + // panic!("{:?}", <$network_name>::_para_ids()); + <$network_name>::_para_ids() + } + + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { + <$network_name>::_send_downward_messages(to_para_id, iter) + } + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> $crate::ParachainInherentData { + <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) + } + + fn process_messages() { + <$network_name>::_process_messages(); + } + } + } +} + +// Parachain Implementation +pub trait Parachain: Network { + type Runtime; + type Origin; + type XcmpMessageHandler; + type DmpMessageHandler; + type System; + type ParachainSystem; + + fn para_id() -> ParaId { + Default::default() + } + + fn send_horizontal_messages< + I: Iterator)>, + >(_to_para_id: u32, _iter: I) {} + + fn send_upward_message(_from_para_id: u32, _msg: Vec) {} +} + +#[macro_export] +macro_rules! decl_test_parachains { + ( + $( + pub struct $name:ident { + Runtime = $runtime:path, + RuntimeOrigin = $origin:path, + XcmpMessageHandler = $xcmp_message_handler:path, + DmpMessageHandler = $dmp_message_handler:path, + System = $system:path, + ParachainSystem = $parachain_system:path, + genesis = $genesis:expr, + on_init = $on_init:expr, + para_id = $para_id:expr, + } + ), + + + ) => { + $( + pub struct $name; + + impl Network for $name {} + impl Parachain for $name { + // fn para_id() -> $crate::ParaId { + // $para_id + // } + + type Runtime = $runtime; + type Origin = $origin; + type XcmpMessageHandler = $xcmp_message_handler; + type DmpMessageHandler = $dmp_message_handler; + type System = $system; + type ParachainSystem = $parachain_system; + } + + $crate::__impl_ext_for_parachain!($name, $genesis, $on_init, $para_id); + $crate::__impl_xcm_handlers_for_parachain!($name); + )+ + }; +} + +#[macro_export] +macro_rules! __impl_xcm_handlers_for_parachain { + ($name:ident) => { + impl $crate::XcmpMessageHandler for $name { + fn handle_xcmp_messages< + 'a, + I: Iterator, + >( + iter: I, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{TestExt, XcmpMessageHandler}; + + $name::execute_with(|| { + ::XcmpMessageHandler::handle_xcmp_messages(iter, max_weight) + }) + } + } + + impl $crate::DmpMessageHandler for $name { + fn handle_dmp_messages( + iter: impl Iterator)>, + max_weight: $crate::Weight, + ) -> $crate::Weight { + use $crate::{DmpMessageHandler, TestExt}; + + $name::execute_with(|| { + ::DmpMessageHandler::handle_dmp_messages(iter, max_weight) + }) + } + } + } +} + #[macro_export] macro_rules! __impl_ext_for_parachain { // entry point: generate ext name @@ -518,25 +563,85 @@ macro_rules! __impl_ext_for_parachain { }; } -thread_local! { - /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` - #[allow(clippy::type_complexity)] - pub static DOWNWARD_MESSAGES: RefCell)>)>>> - = RefCell::new(HashMap::new()); - #[allow(clippy::type_complexity)] - /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` - pub static DMP_DONE: RefCell)>>> - = RefCell::new(HashMap::new()); - /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` - #[allow(clippy::type_complexity)] - pub static HORIZONTAL_MESSAGES: RefCell)>)>>> - = RefCell::new(HashMap::new()); - /// Upward messages, each message is: `(from_para_id, msg) - pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); - /// Global incremental relay chain block number - pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); - /// Flag indicating if global variables have been initialized for a certain Network - pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); +#[macro_export] +macro_rules! __impl_parachain { + ($network_name:ident, $parachain:ty) => { + + impl $parachain { + fn network_name() -> String { + <$network_name>::_network_name() + } + + fn init() { + <$network_name>::_init(); + } + + // pub fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { + // <$network_name>::_relay_block_number() + // } + + fn relay_block_number() -> u32 { + <$network_name>::_relay_block_number() + } + + fn set_relay_block_number(block_number: u32) { + <$network_name>::_set_relay_block_number(block_number); + } + + fn send_horizontal_messages< + I: Iterator)>, + >(to_para_id: u32, iter: I) { + <$network_name>::_send_horizontal_messages(to_para_id, iter); + } + + fn send_upward_message(from_para_id: u32, msg: Vec) { + <$network_name>::_send_upward_message(from_para_id, msg); + } + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> $crate::ParachainInherentData { + <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) + } + + fn process_messages() { + <$network_name>::_process_messages(); + } + } + } +} + +// Network Implementation +pub trait Network { + fn network_name() -> String { Default::default() } + + fn init() {} + + // fn relay_block_number() -> &'static LocalKey>> { &RELAY_BLOCK_NUMBER } + + fn relay_block_number() -> u32 { Default::default() } // { &RELAY_BLOCK_NUMBER } + + fn set_relay_block_number(_block_number: u32) {} // { &RELAY_BLOCK_NUMBER } + + fn hrmp_channel_parachain_inherent_data( + _para_id: u32, + _relay_parent_number: u32, + ) -> ParachainInherentData { + ParachainInherentData { + validation_data: PersistedValidationData { + parent_head: Default::default(), + relay_parent_number: Default::default(), + relay_parent_storage_root: Default::default(), + max_pov_size: Default::default(), + }, + relay_chain_state: StorageProof::new(Vec::new()), + downward_messages: Default::default(), + horizontal_messages: Default::default(), + } + } + + fn process_messages() {} } #[macro_export] @@ -754,103 +859,6 @@ macro_rules! decl_test_networks { }; } -#[macro_export] -macro_rules! __impl_relay { - ($network_name:ident, $relay_chain:ty) => { - - impl $relay_chain { - fn network_name() -> String { - <$network_name>::_network_name() - } - - fn init() { - <$network_name>::_init(); - } - - // fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { - // <$network_name>::_relay_block_number() - // } - - fn relay_block_number() -> u32 { - <$network_name>::_relay_block_number() - } - - fn set_relay_block_number(block_number: u32) { - <$network_name>::_set_relay_block_number(block_number); - } - - fn para_ids() -> Vec { - // panic!("{:?}", <$network_name>::_para_ids()); - <$network_name>::_para_ids() - } - - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - <$network_name>::_send_downward_messages(to_para_id, iter) - } - - fn hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> $crate::ParachainInherentData { - <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) - } - - fn process_messages() { - <$network_name>::_process_messages(); - } - } - } -} - -#[macro_export] -macro_rules! __impl_parachain { - ($network_name:ident, $parachain:ty) => { - - impl $parachain { - fn network_name() -> String { - <$network_name>::_network_name() - } - - fn init() { - <$network_name>::_init(); - } - - // pub fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { - // <$network_name>::_relay_block_number() - // } - - fn relay_block_number() -> u32 { - <$network_name>::_relay_block_number() - } - - fn set_relay_block_number(block_number: u32) { - <$network_name>::_set_relay_block_number(block_number); - } - - fn send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) { - <$network_name>::_send_horizontal_messages(to_para_id, iter); - } - - fn send_upward_message(from_para_id: u32, msg: Vec) { - <$network_name>::_send_upward_message(from_para_id, msg); - } - - fn hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> $crate::ParachainInherentData { - <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) - } - - fn process_messages() { - <$network_name>::_process_messages(); - } - } - } -} - #[macro_export] macro_rules! bx { ($e:expr) => { From 0aae05bfe3c7cdc49c9a2a1ed3df62da593221cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 6 May 2023 14:30:15 +0000 Subject: [PATCH 28/60] Bump serde from 1.0.160 to 1.0.162 (#2534) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.160 to 1.0.162. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.160...1.0.162) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: parity-processbot <> --- Cargo.lock | 8 ++++---- client/relay-chain-rpc-interface/Cargo.toml | 2 +- parachain-template/node/Cargo.toml | 2 +- .../runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml | 2 +- .../runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml | 2 +- .../runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml | 2 +- polkadot-parachain/Cargo.toml | 2 +- test/service/Cargo.toml | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3bb509f77b2..99c1a4e512c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12201,18 +12201,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.162" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" dependencies = [ "proc-macro2", "quote", diff --git a/client/relay-chain-rpc-interface/Cargo.toml b/client/relay-chain-rpc-interface/Cargo.toml index b23ef658f75..962377874c1 100644 --- a/client/relay-chain-rpc-interface/Cargo.toml +++ b/client/relay-chain-rpc-interface/Cargo.toml @@ -31,5 +31,5 @@ tracing = "0.1.37" async-trait = "0.1.68" url = "2.3.1" serde_json = "1.0.96" -serde = "1.0.160" +serde = "1.0.162" lru = "0.9.0" diff --git a/parachain-template/node/Cargo.toml b/parachain-template/node/Cargo.toml index a1734127c11..3ded5c15bf7 100644 --- a/parachain-template/node/Cargo.toml +++ b/parachain-template/node/Cargo.toml @@ -13,7 +13,7 @@ build = "build.rs" clap = { version = "4.2.7", features = ["derive"] } log = "0.4.17" codec = { package = "parity-scale-codec", version = "3.0.0" } -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.162", features = ["derive"] } jsonrpsee = { version = "0.16.2", features = ["server"] } # Local diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml index 4f7338a8e81..d8cce46eadd 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml @@ -13,7 +13,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +serde = { version = "1.0.162", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml index 3b42507b1da..0412e56112c 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml @@ -13,7 +13,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +serde = { version = "1.0.162", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index 5722136abb0..adcc2c02813 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -13,7 +13,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features = hex-literal = { version = "0.4.1" } log = { version = "0.4.17", default-features = false } scale-info = { version = "2.6.0", default-features = false, features = ["derive"] } -serde = { version = "1.0.160", optional = true, features = ["derive"] } +serde = { version = "1.0.162", optional = true, features = ["derive"] } smallvec = "1.8.1" # Substrate diff --git a/polkadot-parachain/Cargo.toml b/polkadot-parachain/Cargo.toml index 7dc9d6e27f0..78f5fc83dab 100644 --- a/polkadot-parachain/Cargo.toml +++ b/polkadot-parachain/Cargo.toml @@ -17,7 +17,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" } futures = "0.3.28" hex-literal = "0.4.1" log = "0.4.17" -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.162", features = ["derive"] } # Local rococo-parachain-runtime = { path = "../parachains/runtimes/testing/rococo-parachain" } diff --git a/test/service/Cargo.toml b/test/service/Cargo.toml index d36ae55688d..4f0fc627bad 100644 --- a/test/service/Cargo.toml +++ b/test/service/Cargo.toml @@ -15,7 +15,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" } criterion = { version = "0.4.0", features = [ "async_tokio" ] } jsonrpsee = { version = "0.16.2", features = ["server"] } rand = "0.8.5" -serde = { version = "1.0.160", features = ["derive"] } +serde = { version = "1.0.162", features = ["derive"] } tokio = { version = "1.28.0", features = ["macros"] } tracing = "0.1.37" url = "2.3.1" From fd295d03d2686ecaed66c6c7b13b07fd74cd4a0b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sat, 6 May 2023 23:18:59 +0200 Subject: [PATCH 29/60] restructure --- .../xcm-emulator/common/src/lib.rs | 2 +- xcm/xcm-emulator/src/lib.rs | 243 ++++-------------- 2 files changed, 47 insertions(+), 198 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 83ecd2def2f..c4d7ba4dd27 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -8,7 +8,7 @@ use frame_support::{ traits::{fungibles::Inspect, GenesisBuild}, }; use xcm::prelude::*; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, Network, RelayChain, Parachain}; +use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, RelayChain, Parachain}; use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index b65be27b47d..add45e9a517 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -78,19 +78,24 @@ pub trait TestExt { fn new_ext() -> sp_io::TestExternalities; fn reset_ext(); fn execute_with(execute: impl FnOnce() -> R) -> R; - // fn get_ext() -> &'static sp_io::TestExternalities; } -// Relay Chain Implementation -pub trait RelayChain: Network { + +pub trait RelayChain: TestExt + UmpSink { type Runtime; type XcmConfig; type System; +} - fn para_ids() -> Vec { Default::default() } - - fn send_downward_messages(_to_para_id: u32, _iter: impl Iterator)>) {} +pub trait Parachain: TestExt + XcmpMessageHandler + DmpMessageHandler { + type Runtime; + type Origin; + type XcmpMessageHandler; + type DmpMessageHandler; + type System; + type ParachainSystem; } +// Relay Chain Implementation #[macro_export] macro_rules! decl_test_relay_chains { ( @@ -108,38 +113,43 @@ macro_rules! decl_test_relay_chains { $( pub struct $name; - impl Network for $name {} impl RelayChain for $name { type Runtime = $runtime; type XcmConfig = $xcm_config; type System = $system; } - $crate::__impl_ext_for_relay_chain!($name, $genesis, $on_init); + $crate::__impl_test_ext_for_relay_chain!($name, $genesis, $on_init); + $crate::__impl_xcm_handlers_for_relay_chain!($name); + )+ + }; +} - impl $crate::UmpSink for $name { - fn process_upward_message( - origin: $crate::ParaId, - msg: &[u8], - max_weight: $crate::Weight, - ) -> Result<$crate::Weight, ($crate::MessageId, $crate::Weight)> { - use $crate::{TestExt, UmpSink}; +#[macro_export] +macro_rules! __impl_xcm_handlers_for_relay_chain { + ($name:ident) => { + impl $crate::UmpSink for $name { + fn process_upward_message( + origin: $crate::ParaId, + msg: &[u8], + max_weight: $crate::Weight, + ) -> Result<$crate::Weight, ($crate::MessageId, $crate::Weight)> { + use $crate::{TestExt, UmpSink}; - Self::execute_with(|| { - $crate::XcmSink::<$crate::XcmExecutor<::XcmConfig>, ::Runtime>::process_upward_message(origin, msg, max_weight) - }) - } + Self::execute_with(|| { + $crate::XcmSink::<$crate::XcmExecutor<::XcmConfig>, ::Runtime>::process_upward_message(origin, msg, max_weight) + }) } - )+ - }; + } + } } #[macro_export] -macro_rules! __impl_ext_for_relay_chain { +macro_rules! __impl_test_ext_for_relay_chain { // entry point: generate ext name ($name:ident, $genesis:expr, $on_init:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_relay_chain!(@impl $name, $genesis, $on_init, []); + $crate::__impl_test_ext_for_relay_chain!(@impl $name, $genesis, $on_init, []); } }; // impl @@ -212,10 +222,6 @@ macro_rules! __impl_ext_for_relay_chain { r } - - // fn get_ext() -> &'static $crate::TestExternalities { - // $ext_name.with(|v| &*v.clone().borrow()) - // } } }; } @@ -225,40 +231,24 @@ macro_rules! __impl_relay { ($network_name:ident, $relay_chain:ty) => { impl $relay_chain { - fn network_name() -> String { - <$network_name>::_network_name() + pub fn network_name() -> &'static str { + stringify!($network_name) } fn init() { <$network_name>::_init(); } - // fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { - // <$network_name>::_relay_block_number() - // } - - fn relay_block_number() -> u32 { + pub fn relay_block_number() -> u32 { <$network_name>::_relay_block_number() } - fn set_relay_block_number(block_number: u32) { - <$network_name>::_set_relay_block_number(block_number); - } - fn para_ids() -> Vec { - // panic!("{:?}", <$network_name>::_para_ids()); <$network_name>::_para_ids() } fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - <$network_name>::_send_downward_messages(to_para_id, iter) - } - - fn hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> $crate::ParachainInherentData { - <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) + $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); } fn process_messages() { @@ -269,25 +259,6 @@ macro_rules! __impl_relay { } // Parachain Implementation -pub trait Parachain: Network { - type Runtime; - type Origin; - type XcmpMessageHandler; - type DmpMessageHandler; - type System; - type ParachainSystem; - - fn para_id() -> ParaId { - Default::default() - } - - fn send_horizontal_messages< - I: Iterator)>, - >(_to_para_id: u32, _iter: I) {} - - fn send_upward_message(_from_para_id: u32, _msg: Vec) {} -} - #[macro_export] macro_rules! decl_test_parachains { ( @@ -309,12 +280,7 @@ macro_rules! decl_test_parachains { $( pub struct $name; - impl Network for $name {} impl Parachain for $name { - // fn para_id() -> $crate::ParaId { - // $para_id - // } - type Runtime = $runtime; type Origin = $origin; type XcmpMessageHandler = $xcmp_message_handler; @@ -323,14 +289,14 @@ macro_rules! decl_test_parachains { type ParachainSystem = $parachain_system; } - $crate::__impl_ext_for_parachain!($name, $genesis, $on_init, $para_id); - $crate::__impl_xcm_handlers_for_parachain!($name); + $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init, $para_id); + $crate::__impl_xcm_for_parachain!($name); )+ }; } #[macro_export] -macro_rules! __impl_xcm_handlers_for_parachain { +macro_rules! __impl_xcm_for_parachain { ($name:ident) => { impl $crate::XcmpMessageHandler for $name { fn handle_xcmp_messages< @@ -364,11 +330,11 @@ macro_rules! __impl_xcm_handlers_for_parachain { } #[macro_export] -macro_rules! __impl_ext_for_parachain { +macro_rules! __impl_test_ext_for_parachain { // entry point: generate ext name ($name:ident, $genesis:expr, $on_init:expr, $para_id:expr) => { $crate::paste::paste! { - $crate::__impl_ext_for_parachain!(@impl $name, $genesis, $on_init, $para_id, []); + $crate::__impl_test_ext_for_parachain!(@impl $name, $genesis, $on_init, $para_id, []); } }; // impl @@ -380,12 +346,6 @@ macro_rules! __impl_ext_for_parachain { impl $name { fn para_id() -> $crate::ParaId { - // $ext_name.with(|v| { - // $para_id - // }) - // let a = Self::ext_wrapper($para_id); - - // panic!("{:?}", $para_id); $para_id } @@ -393,15 +353,9 @@ macro_rules! __impl_ext_for_parachain { $ext_name.with(|v| { v.borrow_mut().execute_with(|| { use $crate::{Get, Hooks}; - // type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; - // let block_number = $crate::frame_system::Pallet::<$runtime>::block_number(); - // let block_number = <$system>::block_number(); let block_number = ::System::block_number(); - // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - // let para_id = <$name>::para_id(); let para_id = Self::para_id(); - // panic!("{:?}", para_id); let _ = ::ParachainSystem::set_validation_data( ::Origin::none(), @@ -451,37 +405,10 @@ macro_rules! __impl_ext_for_parachain { // Make sure the Network is initialized <$name>::init(); - // type ParachainSystem = $crate::cumulus_pallet_parachain_system::Pallet<$runtime>; - - let network_name = <$name>::network_name(); - - // <$name>::relay_block_number().with(|v| { - // *v.borrow_mut().get_mut(&network_name).unwrap() += 1; - // }); - - // let para_id = <$name>::para_id().into(); - let mut relay_block_number = <$name>::relay_block_number(); - relay_block_number += 1; - <$name>::set_relay_block_number(relay_block_number); - // $ext_name.with(|v| { - // v.borrow_mut().execute_with(|| { - // // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); - // let para_id = <$name>::para_id(); - // <$name>::relay_block_number().with(|v| { - // let relay_block_number = *v.borrow().get(&network_name).unwrap(); - // // let relay_block_number = *hash_map.get(stringify!($name)).unwrap(); - // let _ = ParachainSystem::set_validation_data( - // <$origin>::none(), - // <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), relay_block_number), - // ); - // }); - // }) - // }); - $ext_name.with(|v| { v.borrow_mut().execute_with(|| { // Make sure it has been recorded properly @@ -518,7 +445,6 @@ macro_rules! __impl_ext_for_parachain { let collation_info = ::ParachainSystem::collect_collation_info(&mock_header); // send upward messages - // let para_id = $crate::parachain_info::Pallet::<$runtime>::get(); let relay_block_number = <$name>::relay_block_number(); let para_id = <$name>::para_id().into(); @@ -526,17 +452,6 @@ macro_rules! __impl_ext_for_parachain { <$name>::send_upward_message(para_id, msg); } - // send horizontal messages - // for msg in collation_info.horizontal_messages { - // <$name>::relay_block_number().with(|v| { - // let relay_block_number = *v.borrow().get(&network_name).unwrap(); - // <$name>::send_horizontal_messages( - // msg.recipient.into(), - // vec![(para_id.into(), relay_block_number, msg.data)].into_iter(), - // ); - // }); - // } - // send horizontal messages for msg in collation_info.horizontal_messages { <$name>::send_horizontal_messages( @@ -545,7 +460,6 @@ macro_rules! __impl_ext_for_parachain { ); } - // clean messages ::ParachainSystem::on_initialize(block_number); }) @@ -555,10 +469,6 @@ macro_rules! __impl_ext_for_parachain { r } - - // fn get_ext() -> &'static $crate::TestExternalities { - // $ext_name.with(|v| &*v.borrow()) - // } } }; } @@ -568,18 +478,14 @@ macro_rules! __impl_parachain { ($network_name:ident, $parachain:ty) => { impl $parachain { - fn network_name() -> String { - <$network_name>::_network_name() + pub fn network_name() -> &'static str { + stringify!($network_name) } fn init() { <$network_name>::_init(); } - // pub fn relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { - // <$network_name>::_relay_block_number() - // } - fn relay_block_number() -> u32 { <$network_name>::_relay_block_number() } @@ -591,11 +497,11 @@ macro_rules! __impl_parachain { fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { - <$network_name>::_send_horizontal_messages(to_para_id, iter); + $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); } fn send_upward_message(from_para_id: u32, msg: Vec) { - <$network_name>::_send_upward_message(from_para_id, msg); + $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((from_para_id, msg))); } fn hrmp_channel_parachain_inherent_data( @@ -613,37 +519,6 @@ macro_rules! __impl_parachain { } // Network Implementation -pub trait Network { - fn network_name() -> String { Default::default() } - - fn init() {} - - // fn relay_block_number() -> &'static LocalKey>> { &RELAY_BLOCK_NUMBER } - - fn relay_block_number() -> u32 { Default::default() } // { &RELAY_BLOCK_NUMBER } - - fn set_relay_block_number(_block_number: u32) {} // { &RELAY_BLOCK_NUMBER } - - fn hrmp_channel_parachain_inherent_data( - _para_id: u32, - _relay_parent_number: u32, - ) -> ParachainInherentData { - ParachainInherentData { - validation_data: PersistedValidationData { - parent_head: Default::default(), - relay_parent_number: Default::default(), - relay_parent_storage_root: Default::default(), - max_pov_size: Default::default(), - }, - relay_chain_state: StorageProof::new(Vec::new()), - downward_messages: Default::default(), - horizontal_messages: Default::default(), - } - } - - fn process_messages() {} -} - #[macro_export] macro_rules! decl_test_networks { ( @@ -675,10 +550,6 @@ macro_rules! decl_test_networks { $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); } - fn _network_name() -> String { - stringify!($name).to_string() - } - fn _init() { // If Network has not been itialized yet, it gets initialized if $crate::INITIALIZED.with(|b| b.borrow_mut().get(stringify!($name)).is_none()) { @@ -691,40 +562,18 @@ macro_rules! decl_test_networks { } } - fn _send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, iter.collect()))); - } - - fn _send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) { - $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, iter.collect()))); - } - - fn _send_upward_message(from_para_id: u32, msg: Vec) { - $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((from_para_id, msg))); - } - fn _para_ids() -> Vec { - // vec![$( $para_id, )*] - // vec![] // vec![$( <$parachain>::para_id().into(), )*] vec![$( <$parachain>::execute_with(|| { <$parachain>::para_id().into() }), )*] } - // fn _relay_block_number() -> &'static $crate::LocalKey<$crate::RefCell<$crate::HashMap>> { - // &$crate::RELAY_BLOCK_NUMBER - // } - fn _relay_block_number() -> u32 { - // $crate::RELAY_BLOCK_NUMBER.with(|v| *(v.borrow()).clone().get(stringify!($name)).unwrap()) $crate::RELAY_BLOCK_NUMBER.with(|v| *v.clone().borrow().get(stringify!($name)).unwrap()) } fn _set_relay_block_number(block_number: u32) { - // $crate::RELAY_BLOCK_NUMBER.with(|v| *(v.borrow()).clone().get(stringify!($name)).unwrap()) $crate::RELAY_BLOCK_NUMBER.with(|v| v.borrow_mut().insert(stringify!($name).to_string(), block_number)); } From 75ceebe22bba7b8f79bfe24fcab53444f26e2b6b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sun, 7 May 2023 12:04:30 +0200 Subject: [PATCH 30/60] para_ids working --- .../xcm-emulator/common/src/lib.rs | 8 +- xcm/xcm-emulator/src/lib.rs | 123 ++++++++---------- 2 files changed, 60 insertions(+), 71 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index c4d7ba4dd27..0cbc185266f 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -87,15 +87,15 @@ decl_test_networks! { pub struct PolkadotMockNet { relay_chain = Polkadot, parachains = vec![ - (1000, Statemint), - (2000, PenpalPolkadot), + Statemint, + PenpalPolkadot, ], }, pub struct KusamaMockNet { relay_chain = Kusama, parachains = vec![ - (1000, Statemine), - (2000, PenpalKusama), + Statemine, + PenpalKusama, ], } } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index add45e9a517..c15aae19831 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -66,18 +66,19 @@ thread_local! { /// Upward messages, each message is: `(from_para_id, msg) pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); /// Global incremental relay chain block number - pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); // RefCell::new(1); + pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); + /// Parachains Ids in the Network + pub static PARA_IDS: RefCell>> = RefCell::new(HashMap::new()); /// Flag indicating if global variables have been initialized for a certain Network pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); } pub trait TestExt { - // fn ext_wrapper(func: impl FnOnce() -> R) -> R; - fn ext_wrapper(func: R) -> R; fn build_new_ext(storage: Storage) -> sp_io::TestExternalities; fn new_ext() -> sp_io::TestExternalities; fn reset_ext(); fn execute_with(execute: impl FnOnce() -> R) -> R; + fn ext_wrapper(func: impl FnOnce() -> R) -> R; } pub trait RelayChain: TestExt + UmpSink { @@ -119,8 +120,8 @@ macro_rules! decl_test_relay_chains { type System = $system; } - $crate::__impl_test_ext_for_relay_chain!($name, $genesis, $on_init); $crate::__impl_xcm_handlers_for_relay_chain!($name); + $crate::__impl_test_ext_for_relay_chain!($name, $genesis, $on_init); )+ }; } @@ -160,18 +161,6 @@ macro_rules! __impl_test_ext_for_relay_chain { } impl $crate::TestExt for $name { - // fn ext_wrapper(func: impl FnOnce() -> R) -> R { - // $ext_name.with(|v| { - // func() - // }) - // } - - fn ext_wrapper(func: R) -> R { - $ext_name.with(|v| { - func - }) - } - fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { @@ -222,6 +211,14 @@ macro_rules! __impl_test_ext_for_relay_chain { r } + + fn ext_wrapper(func: impl FnOnce() -> R) -> R { + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + func() + }) + }) + } } }; } @@ -289,8 +286,8 @@ macro_rules! decl_test_parachains { type ParachainSystem = $parachain_system; } - $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init, $para_id); $crate::__impl_xcm_for_parachain!($name); + $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init, $para_id); )+ }; } @@ -369,18 +366,6 @@ macro_rules! __impl_test_ext_for_parachain { } impl $crate::TestExt for $name { - // fn ext_wrapper(func: impl FnOnce() -> R) -> R { - // $ext_name.with(|v| { - // func() - // }) - // } - - fn ext_wrapper(func: R) -> R { - $ext_name.with(|v| { - func - }) - } - fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { @@ -414,8 +399,6 @@ macro_rules! __impl_test_ext_for_parachain { // Make sure it has been recorded properly let relay_block_number = <$name>::relay_block_number(); let para_id = <$name>::para_id().into(); - // panic!("{}", relay_block_number); - let _ = ::ParachainSystem::set_validation_data( ::Origin::none(), <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), @@ -469,6 +452,14 @@ macro_rules! __impl_test_ext_for_parachain { r } + + fn ext_wrapper(func: impl FnOnce() -> R) -> R { + $ext_name.with(|v| { + v.borrow_mut().execute_with(|| { + func() + }) + }) + } } }; } @@ -525,7 +516,7 @@ macro_rules! decl_test_networks { $( pub struct $name:ident { relay_chain = $relay_chain:ty, - parachains = vec![ $( ($para_id:expr, $parachain:ty), )* ], + parachains = vec![ $( $parachain:ty, )* ], } ), + @@ -559,14 +550,16 @@ macro_rules! decl_test_networks { $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), $crate::VecDeque::new())); $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), 1)); + $crate::PARA_IDS.with(|b| b.borrow_mut().insert(stringify!($name).to_string(), Self::_para_ids())); } } fn _para_ids() -> Vec { - // vec![$( <$parachain>::para_id().into(), )*] - vec![$( <$parachain>::execute_with(|| { - <$parachain>::para_id().into() - }), )*] + vec![$( + <$parachain>::ext_wrapper( + || <$parachain>::para_id().into() + ), + )*] } fn _relay_block_number() -> u32 { @@ -597,28 +590,27 @@ macro_rules! decl_test_networks { while let Some((to_para_id, messages)) = $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { - match to_para_id { - $( - $para_id => { - let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); - for m in messages { - msg_dedup.push((m.0, m.1.clone())); - } - msg_dedup.dedup(); - - let msgs = msg_dedup.clone().into_iter().filter(|m| { - !$crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap_or(&mut $crate::VecDeque::new()).contains(&(to_para_id, m.0, m.1.clone()))) - }).collect::)>>(); - if msgs.len() != 0 { - <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); - for m in msgs { - $crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, m.0, m.1))); - } + $( + if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) { + let mut msg_dedup: Vec<(RelayChainBlockNumber, Vec)> = Vec::new(); + for m in &messages { + msg_dedup.push((m.0, m.1.clone())); + } + msg_dedup.dedup(); + + let msgs = msg_dedup.clone().into_iter().filter(|m| { + !$crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap_or(&mut $crate::VecDeque::new()).contains(&(to_para_id, m.0, m.1.clone()))) + }).collect::)>>(); + if msgs.len() != 0 { + <$parachain>::handle_dmp_messages(msgs.clone().into_iter(), $crate::Weight::max_value()); + for m in msgs { + $crate::DMP_DONE.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().push_back((to_para_id, m.0, m.1))); } - }, - )* - _ => unreachable!(), - } + } + } else { + unreachable!(); + } + )* } } @@ -628,14 +620,11 @@ macro_rules! decl_test_networks { while let Some((to_para_id, messages)) = $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().pop_front()) { let iter = messages.iter().map(|(p, b, m)| (*p, *b, &m[..])).collect::>().into_iter(); - match to_para_id { - $( - $para_id => { - <$parachain>::handle_xcmp_messages(iter, $crate::Weight::max_value()); - }, - )* - _ => unreachable!(), - } + $( + if $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().contains(&to_para_id)) { + <$parachain>::handle_xcmp_messages(iter.clone(), $crate::Weight::max_value()); + } + )* } } @@ -661,8 +650,8 @@ macro_rules! decl_test_networks { // egress channel let e_index = sproof.hrmp_egress_channel_index.get_or_insert_with(Vec::new); - for recipient_para_id in &[ $( $para_id, )* ] { - let recipient_para_id = $crate::ParaId::from(*recipient_para_id); + for recipient_para_id in $crate::PARA_IDS.with(|b| b.borrow_mut().get_mut(stringify!($name)).unwrap().clone()) { + let recipient_para_id = $crate::ParaId::from(recipient_para_id); if let Err(idx) = e_index.binary_search(&recipient_para_id) { e_index.insert(idx, recipient_para_id); } From 694722dc9421b35c928d6a33f19a17452feff9e2 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sun, 7 May 2023 12:13:55 +0200 Subject: [PATCH 31/60] replace para_id getter --- .../xcm-emulator/common/src/lib.rs | 8 ++++---- xcm/xcm-emulator/src/lib.rs | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 0cbc185266f..ac5efb0a70b 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -43,9 +43,9 @@ decl_test_parachains! { DmpMessageHandler = statemint_runtime::DmpQueue, System = statemint_runtime::System, ParachainSystem = statemint_runtime::ParachainSystem, + ParachainInfo = statemint_runtime::ParachainInfo, genesis = statemint_storage(), on_init = (), - para_id = statemint_runtime::ParachainInfo::get(), }, pub struct PenpalPolkadot { Runtime = penpal_runtime::Runtime, @@ -54,9 +54,9 @@ decl_test_parachains! { DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, ParachainSystem = penpal_runtime::ParachainSystem, + ParachainInfo = penpal_runtime::ParachainInfo, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), - para_id = penpal_runtime::ParachainInfo::get(), }, // Kusama pub struct Statemine { @@ -66,9 +66,9 @@ decl_test_parachains! { DmpMessageHandler = statemine_runtime::DmpQueue, System = statemine_runtime::System, ParachainSystem = statemine_runtime::ParachainSystem, + ParachainInfo = statemine_runtime::ParachainInfo, genesis = statemine::genesis(), on_init = (), - para_id = statemine_runtime::ParachainInfo::get(), }, pub struct PenpalKusama { Runtime = penpal_runtime::Runtime, @@ -77,9 +77,9 @@ decl_test_parachains! { DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, ParachainSystem = penpal_runtime::ParachainSystem, + ParachainInfo = penpal_runtime::ParachainInfo, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), - para_id = penpal_runtime::ParachainInfo::get(), } } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index c15aae19831..c23adf93981 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -94,6 +94,7 @@ pub trait Parachain: TestExt + XcmpMessageHandler + DmpMessageHandler { type DmpMessageHandler; type System; type ParachainSystem; + type ParachainInfo; } // Relay Chain Implementation @@ -267,9 +268,9 @@ macro_rules! decl_test_parachains { DmpMessageHandler = $dmp_message_handler:path, System = $system:path, ParachainSystem = $parachain_system:path, + ParachainInfo = $parachain_info:path, genesis = $genesis:expr, on_init = $on_init:expr, - para_id = $para_id:expr, } ), + @@ -284,10 +285,11 @@ macro_rules! decl_test_parachains { type DmpMessageHandler = $dmp_message_handler; type System = $system; type ParachainSystem = $parachain_system; + type ParachainInfo = $parachain_info; } $crate::__impl_xcm_for_parachain!($name); - $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init, $para_id); + $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init); )+ }; } @@ -329,13 +331,13 @@ macro_rules! __impl_xcm_for_parachain { #[macro_export] macro_rules! __impl_test_ext_for_parachain { // entry point: generate ext name - ($name:ident, $genesis:expr, $on_init:expr, $para_id:expr) => { + ($name:ident, $genesis:expr, $on_init:expr) => { $crate::paste::paste! { - $crate::__impl_test_ext_for_parachain!(@impl $name, $genesis, $on_init, $para_id, []); + $crate::__impl_test_ext_for_parachain!(@impl $name, $genesis, $on_init, []); } }; // impl - (@impl $name:ident, $genesis:expr, $on_init:expr, $para_id:expr, $ext_name:ident) => { + (@impl $name:ident, $genesis:expr, $on_init:expr, $ext_name:ident) => { thread_local! { pub static $ext_name: $crate::RefCell<$crate::TestExternalities> = $crate::RefCell::new(<$name>::build_new_ext($genesis)); @@ -343,7 +345,7 @@ macro_rules! __impl_test_ext_for_parachain { impl $name { fn para_id() -> $crate::ParaId { - $para_id + ::ParachainInfo::get() } fn prepare_for_xcmp() { From 1e99b42703a28e9a0af90f37f67fba736ff9ace9 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sun, 7 May 2023 12:24:50 +0200 Subject: [PATCH 32/60] replace para_id getter 2 --- .../assets/statemint/tests/statemint.rs | 2 +- xcm/xcm-emulator/src/lib.rs | 48 +++++++++---------- 2 files changed, 23 insertions(+), 27 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs index 4f29278ec98..eee63254dee 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs @@ -92,7 +92,7 @@ fn force_xcm_version() { mod dmp { use super::*; use xcm::latest::Error; - use xcm_emulator::cumulus_pallet_dmp_queue; + use xcm_emulator::{cumulus_pallet_dmp_queue, Parachain}; fn get_balances() -> (Balance, Balance) { let mut relay_balance = Default::default(); diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index c23adf93981..c826c2fb12b 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -55,8 +55,8 @@ thread_local! { #[allow(clippy::type_complexity)] pub static DOWNWARD_MESSAGES: RefCell)>)>>> = RefCell::new(HashMap::new()); - #[allow(clippy::type_complexity)] /// Downward messages that already processed by parachains, each message is: `(to_para_id, relay_block_number, Vec)` + #[allow(clippy::type_complexity)] pub static DMP_DONE: RefCell)>>> = RefCell::new(HashMap::new()); /// Horizontal messages, each message is: `(to_para_id, [(from_para_id, relay_block_number, msg)])` @@ -67,7 +67,7 @@ thread_local! { pub static UPWARD_MESSAGES: RefCell)>>> = RefCell::new(HashMap::new()); /// Global incremental relay chain block number pub static RELAY_BLOCK_NUMBER: RefCell> = RefCell::new(HashMap::new()); - /// Parachains Ids in the Network + /// Parachains Ids a the Network pub static PARA_IDS: RefCell>> = RefCell::new(HashMap::new()); /// Flag indicating if global variables have been initialized for a certain Network pub static INITIALIZED: RefCell> = RefCell::new(HashMap::new()); @@ -343,30 +343,6 @@ macro_rules! __impl_test_ext_for_parachain { = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } - impl $name { - fn para_id() -> $crate::ParaId { - ::ParachainInfo::get() - } - - fn prepare_for_xcmp() { - $ext_name.with(|v| { - v.borrow_mut().execute_with(|| { - use $crate::{Get, Hooks}; - - let block_number = ::System::block_number(); - let para_id = Self::para_id(); - - let _ = ::ParachainSystem::set_validation_data( - ::Origin::none(), - <$name>::hrmp_channel_parachain_inherent_data(para_id.into(), 1), - ); - // set `AnnouncedHrmpMessagesPerCandidate` - ::ParachainSystem::on_initialize(block_number); - }) - }); - } - } - impl $crate::TestExt for $name { fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); @@ -479,6 +455,10 @@ macro_rules! __impl_parachain { <$network_name>::_init(); } + pub fn para_id() -> $crate::ParaId { + ::ParachainInfo::get() + } + fn relay_block_number() -> u32 { <$network_name>::_relay_block_number() } @@ -504,6 +484,22 @@ macro_rules! __impl_parachain { <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) } + fn prepare_for_xcmp() { + ::ext_wrapper(|| { + use $crate::{Get, Hooks}; + + let block_number = ::System::block_number(); + let para_id = Self::para_id(); + + let _ = ::ParachainSystem::set_validation_data( + ::Origin::none(), + Self::hrmp_channel_parachain_inherent_data(para_id.into(), 1), + ); + // set `AnnouncedHrmpMessagesPerCandidate` + ::ParachainSystem::on_initialize(block_number); + }); + } + fn process_messages() { <$network_name>::_process_messages(); } From 8904a44b96ed11cb539d4216d8a792ee6ea64e1e Mon Sep 17 00:00:00 2001 From: Bulat Saifullin Date: Sun, 7 May 2023 20:45:52 +0100 Subject: [PATCH 33/60] Update westmint bootnodes (#2521) Co-authored-by: parity-processbot <> --- parachains/chain-specs/westmint.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/parachains/chain-specs/westmint.json b/parachains/chain-specs/westmint.json index 3516fbfaa56..a700e5ddd61 100644 --- a/parachains/chain-specs/westmint.json +++ b/parachains/chain-specs/westmint.json @@ -3,10 +3,10 @@ "id": "westmint", "chainType": "Live", "bootNodes": [ - "/ip4/35.204.21.205/tcp/30334/p2p/12D3KooWLjaXWhNTSiRVFbTJCKLRWt9XXHLGVnAFtxvnExKkVPqn", - "/ip4/34.141.171.170/tcp/30334/p2p/12D3KooWBNy2Jdrjv2P7sdfb1mzH1AGzwjip5rW4N2Ft1T3Hdq5c", - "/ip4/34.141.221.252/tcp/30334/p2p/12D3KooWC9YYdjQLwxTNVda6t4nmjAZG37gaRZLNi4Zuhr9xUveW", - "/ip4/34.90.92.174/tcp/30334/p2p/12D3KooWQcXpUyVqwC2zJkwECCC7ttLCUCLTjnbGxTVfhSgmH2sD", + "/dns/westend-westmint-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWJaAfPyiye7ZQBuHengTJJoMrcaz7Jj1UzHiKdNxA1Nkd", + "/dns/westend-westmint-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWGL3hpWycWyeqyL9gHNnmmsL474WkPZdqraBHu4L6fQrW", + "/dns/westend-westmint-collator-node-2.parity-testnet.parity.io./tcp/30333/p2p/12D3KooWBkKDWhHzu6Hhe492adEpVV7wzuaWGxUfEnr6g5JCr7Gr", + "/dns/westend-westmint-collator-node-3.parity-testnet.parity.io./tcp/30333/p2p/12D3KooWMGpzCmhD6np6eKqxL7AAunKn1dN86Dr7a9E2xgZ2rt6G", "/dns/boot.stake.plus/tcp/33333/p2p/12D3KooWNiB27rpXX7EYongoWWUeRKzLQxWGms6MQU2B9LX7Ztzo", "/dns/boot.stake.plus/tcp/33334/wss/p2p/12D3KooWNiB27rpXX7EYongoWWUeRKzLQxWGms6MQU2B9LX7Ztzo", "/dns/boot.metaspan.io/tcp/36052/p2p/12D3KooWBCqfNb6Y39DXTr4UBWXyjuS3hcZM1qTbHhDXxF6HkAJJ", @@ -49,4 +49,4 @@ "childrenDefault": {} } } -} \ No newline at end of file +} From 35a443d0c62abedd452343beebb0ce08a0d73123 Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Sun, 7 May 2023 23:46:00 +0200 Subject: [PATCH 34/60] companion for #14088 (#2539) * companion for #14088 * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> --- Cargo.lock | 516 ++++++++++++++++++++-------------------- test/service/src/lib.rs | 1 + 2 files changed, 259 insertions(+), 258 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 99c1a4e512c..5c5386ec04c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -585,7 +585,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "hash-db", "log", @@ -3761,7 +3761,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", ] @@ -3784,7 +3784,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-support-procedural", @@ -3809,7 +3809,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3856,7 +3856,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3867,7 +3867,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3884,7 +3884,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -3913,7 +3913,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-recursion", "futures", @@ -3933,7 +3933,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "bitflags", "environmental", @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "Inflector", "cfg-expr", @@ -3982,7 +3982,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3994,7 +3994,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro2", "quote", @@ -4004,7 +4004,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "log", @@ -4022,7 +4022,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -4037,7 +4037,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "sp-api", @@ -4046,7 +4046,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "parity-scale-codec", @@ -5063,7 +5063,7 @@ checksum = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" [[package]] name = "kusama-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -5161,7 +5161,7 @@ dependencies = [ [[package]] name = "kusama-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -6015,7 +6015,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "log", @@ -6034,7 +6034,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "anyhow", "jsonrpsee", @@ -6539,7 +6539,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -6560,7 +6560,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6578,7 +6578,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6593,7 +6593,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -6609,7 +6609,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -6625,7 +6625,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -6639,7 +6639,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6663,7 +6663,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6683,7 +6683,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6698,7 +6698,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -6717,7 +6717,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -6741,7 +6741,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6847,7 +6847,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6891,7 +6891,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6908,7 +6908,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "bitflags", "environmental", @@ -6938,7 +6938,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "bitflags", "parity-scale-codec", @@ -6951,7 +6951,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro2", "quote", @@ -6961,7 +6961,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6978,7 +6978,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -6996,7 +6996,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7019,7 +7019,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7032,7 +7032,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7050,7 +7050,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7068,7 +7068,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7091,7 +7091,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7107,7 +7107,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7127,7 +7127,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7144,7 +7144,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -7158,7 +7158,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7175,7 +7175,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7192,7 +7192,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7208,7 +7208,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7226,7 +7226,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "pallet-nfts", @@ -7237,7 +7237,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7253,7 +7253,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -7270,7 +7270,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7290,7 +7290,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -7301,7 +7301,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -7318,7 +7318,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7342,7 +7342,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7359,7 +7359,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7374,7 +7374,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7392,7 +7392,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7407,7 +7407,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7426,7 +7426,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7443,7 +7443,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -7464,7 +7464,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7480,7 +7480,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -7494,7 +7494,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7517,7 +7517,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7528,7 +7528,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "log", "sp-arithmetic", @@ -7537,7 +7537,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "sp-api", @@ -7546,7 +7546,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7563,7 +7563,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -7592,7 +7592,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7610,7 +7610,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7629,7 +7629,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-support", "frame-system", @@ -7645,7 +7645,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7661,7 +7661,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7673,7 +7673,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7690,7 +7690,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7705,7 +7705,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7721,7 +7721,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7736,7 +7736,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-benchmarking", "frame-support", @@ -7751,7 +7751,7 @@ dependencies = [ [[package]] name = "pallet-xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-collections", "frame-benchmarking", @@ -7772,7 +7772,7 @@ dependencies = [ [[package]] name = "pallet-xcm-benchmarks" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-benchmarking", "frame-support", @@ -8350,7 +8350,7 @@ dependencies = [ [[package]] name = "polkadot-approval-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-jaeger", @@ -8366,7 +8366,7 @@ dependencies = [ [[package]] name = "polkadot-availability-bitfield-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-network-protocol", @@ -8380,7 +8380,7 @@ dependencies = [ [[package]] name = "polkadot-availability-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "derive_more", "fatality", @@ -8403,7 +8403,7 @@ dependencies = [ [[package]] name = "polkadot-availability-recovery" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "fatality", "futures", @@ -8424,7 +8424,7 @@ dependencies = [ [[package]] name = "polkadot-cli" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "clap 4.2.7", "frame-benchmarking-cli", @@ -8453,7 +8453,7 @@ dependencies = [ [[package]] name = "polkadot-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "frame-benchmarking", @@ -8496,7 +8496,7 @@ dependencies = [ [[package]] name = "polkadot-collator-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "always-assert", "bitvec", @@ -8518,7 +8518,7 @@ dependencies = [ [[package]] name = "polkadot-core-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "scale-info", @@ -8530,7 +8530,7 @@ dependencies = [ [[package]] name = "polkadot-dispute-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "derive_more", "fatality", @@ -8555,7 +8555,7 @@ dependencies = [ [[package]] name = "polkadot-erasure-coding" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "polkadot-node-primitives", @@ -8569,7 +8569,7 @@ dependencies = [ [[package]] name = "polkadot-gossip-support" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "futures-timer", @@ -8589,7 +8589,7 @@ dependencies = [ [[package]] name = "polkadot-network-bridge" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "always-assert", "async-trait", @@ -8612,7 +8612,7 @@ dependencies = [ [[package]] name = "polkadot-node-collation-generation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "parity-scale-codec", @@ -8630,7 +8630,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-approval-voting" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "derive_more", @@ -8659,7 +8659,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-av-store" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "futures", @@ -8680,7 +8680,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-backing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "fatality", @@ -8699,7 +8699,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-bitfield-signing" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-subsystem", @@ -8714,7 +8714,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-candidate-validation" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -8734,7 +8734,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-metrics", @@ -8749,7 +8749,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-chain-selection" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "futures-timer", @@ -8766,7 +8766,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-dispute-coordinator" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "fatality", "futures", @@ -8785,7 +8785,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-parachains-inherent" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -8802,7 +8802,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-provisioner" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "fatality", @@ -8820,7 +8820,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "always-assert", "futures", @@ -8847,7 +8847,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-checker" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "polkadot-node-primitives", @@ -8863,7 +8863,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-pvf-worker" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "assert_matches", "cpu-time", @@ -8892,7 +8892,7 @@ dependencies = [ [[package]] name = "polkadot-node-core-runtime-api" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "futures", "lru 0.9.0", @@ -8907,7 +8907,7 @@ dependencies = [ [[package]] name = "polkadot-node-jaeger" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "lazy_static", "log", @@ -8925,7 +8925,7 @@ dependencies = [ [[package]] name = "polkadot-node-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bs58", "futures", @@ -8944,7 +8944,7 @@ dependencies = [ [[package]] name = "polkadot-node-network-protocol" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "derive_more", @@ -8966,7 +8966,7 @@ dependencies = [ [[package]] name = "polkadot-node-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-vec", "futures", @@ -8988,7 +8988,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "polkadot-node-jaeger", "polkadot-node-subsystem-types", @@ -8998,7 +8998,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-test-helpers" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -9016,7 +9016,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-types" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "derive_more", @@ -9039,7 +9039,7 @@ dependencies = [ [[package]] name = "polkadot-node-subsystem-util" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "derive_more", @@ -9072,7 +9072,7 @@ dependencies = [ [[package]] name = "polkadot-overseer" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "futures", @@ -9095,7 +9095,7 @@ dependencies = [ [[package]] name = "polkadot-parachain" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-collections", "derive_more", @@ -9193,7 +9193,7 @@ dependencies = [ [[package]] name = "polkadot-performance-test" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "env_logger 0.9.0", "kusama-runtime", @@ -9211,7 +9211,7 @@ dependencies = [ [[package]] name = "polkadot-primitives" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "hex-literal 0.4.1", @@ -9237,7 +9237,7 @@ dependencies = [ [[package]] name = "polkadot-rpc" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "jsonrpsee", "mmr-rpc", @@ -9269,7 +9269,7 @@ dependencies = [ [[package]] name = "polkadot-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -9363,7 +9363,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-common" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -9409,7 +9409,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -9423,7 +9423,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-metrics" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bs58", "parity-scale-codec", @@ -9435,7 +9435,7 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitflags", "bitvec", @@ -9479,7 +9479,7 @@ dependencies = [ [[package]] name = "polkadot-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "async-trait", "frame-benchmarking-cli", @@ -9589,7 +9589,7 @@ dependencies = [ [[package]] name = "polkadot-statement-distribution" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "arrayvec 0.5.2", "fatality", @@ -9610,7 +9610,7 @@ dependencies = [ [[package]] name = "polkadot-statement-table" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "polkadot-primitives", @@ -9620,7 +9620,7 @@ dependencies = [ [[package]] name = "polkadot-test-client" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "parity-scale-codec", "polkadot-node-subsystem", @@ -9645,7 +9645,7 @@ dependencies = [ [[package]] name = "polkadot-test-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-election-provider-support", @@ -9706,7 +9706,7 @@ dependencies = [ [[package]] name = "polkadot-test-service" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-benchmarking", "frame-system", @@ -10479,7 +10479,7 @@ dependencies = [ [[package]] name = "rococo-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "binary-merkle-tree", "frame-benchmarking", @@ -10565,7 +10565,7 @@ dependencies = [ [[package]] name = "rococo-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -10812,7 +10812,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "log", "sp-core", @@ -10823,7 +10823,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures", @@ -10851,7 +10851,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "futures-timer", @@ -10874,7 +10874,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10889,7 +10889,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10908,7 +10908,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10919,7 +10919,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10959,7 +10959,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "fnv", "futures", @@ -10986,7 +10986,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "hash-db", "kvdb", @@ -11012,7 +11012,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures", @@ -11037,7 +11037,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures", @@ -11066,7 +11066,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "fork-tree", @@ -11102,7 +11102,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "jsonrpsee", @@ -11124,7 +11124,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11159,7 +11159,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "jsonrpsee", @@ -11178,7 +11178,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "fork-tree", "parity-scale-codec", @@ -11191,7 +11191,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "ahash 0.8.2", "array-bytes 4.2.0", @@ -11231,7 +11231,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "finality-grandpa", "futures", @@ -11251,7 +11251,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures", @@ -11274,7 +11274,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -11298,7 +11298,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -11311,7 +11311,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "log", "sc-allocator", @@ -11324,7 +11324,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "anyhow", "cfg-if", @@ -11342,7 +11342,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "ansi_term", "futures", @@ -11358,7 +11358,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11373,7 +11373,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -11418,7 +11418,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "cid", "futures", @@ -11438,7 +11438,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11466,7 +11466,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "ahash 0.8.2", "futures", @@ -11485,7 +11485,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11507,7 +11507,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11541,7 +11541,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11561,7 +11561,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11592,7 +11592,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "libp2p", @@ -11605,7 +11605,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11614,7 +11614,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "jsonrpsee", @@ -11645,7 +11645,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11664,7 +11664,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "http", "jsonrpsee", @@ -11679,7 +11679,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11705,7 +11705,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "directories", @@ -11771,7 +11771,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "log", "parity-scale-codec", @@ -11782,7 +11782,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "clap 4.2.7", "fs4", @@ -11798,7 +11798,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11817,7 +11817,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "libc", @@ -11836,7 +11836,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "chrono", "futures", @@ -11855,7 +11855,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "ansi_term", "atty", @@ -11886,7 +11886,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11897,7 +11897,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures", @@ -11924,7 +11924,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures", @@ -11938,7 +11938,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-channel", "futures", @@ -12419,7 +12419,7 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "slot-range-helper" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "enumn", "parity-scale-codec", @@ -12496,7 +12496,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "hash-db", "log", @@ -12516,7 +12516,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "Inflector", "blake2", @@ -12530,7 +12530,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "scale-info", @@ -12543,7 +12543,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "integer-sqrt", "num-traits", @@ -12557,7 +12557,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "scale-info", @@ -12570,7 +12570,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "sp-api", @@ -12582,7 +12582,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "log", @@ -12600,7 +12600,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures", @@ -12615,7 +12615,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "parity-scale-codec", @@ -12633,7 +12633,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "parity-scale-codec", @@ -12654,7 +12654,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "lazy_static", "parity-scale-codec", @@ -12673,7 +12673,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "finality-grandpa", "log", @@ -12691,7 +12691,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "scale-info", @@ -12703,7 +12703,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -12747,7 +12747,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "blake2b_simd", "byteorder", @@ -12761,7 +12761,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro2", "quote", @@ -12772,7 +12772,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12781,7 +12781,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro2", "quote", @@ -12791,7 +12791,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "environmental", "parity-scale-codec", @@ -12802,7 +12802,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12817,7 +12817,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "bytes", "ed25519", @@ -12843,7 +12843,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "lazy_static", "sp-core", @@ -12854,7 +12854,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "parity-scale-codec", @@ -12868,7 +12868,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -12877,7 +12877,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -12888,7 +12888,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -12906,7 +12906,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "scale-info", @@ -12920,7 +12920,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "sp-api", "sp-core", @@ -12930,7 +12930,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "backtrace", "lazy_static", @@ -12940,7 +12940,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "rustc-hash", "serde", @@ -12950,7 +12950,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "either", "hash256-std-hasher", @@ -12972,7 +12972,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -12990,7 +12990,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "Inflector", "proc-macro-crate", @@ -13002,7 +13002,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "serde", "serde_json", @@ -13011,7 +13011,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "scale-info", @@ -13025,7 +13025,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "scale-info", @@ -13038,7 +13038,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "hash-db", "log", @@ -13058,7 +13058,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "log", "parity-scale-codec", @@ -13076,12 +13076,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13094,7 +13094,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "futures-timer", @@ -13109,7 +13109,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "sp-std", @@ -13121,7 +13121,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "sp-api", "sp-runtime", @@ -13130,7 +13130,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "log", @@ -13146,7 +13146,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "ahash 0.8.2", "hash-db", @@ -13169,7 +13169,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13186,7 +13186,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -13197,7 +13197,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13211,7 +13211,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "parity-scale-codec", "scale-info", @@ -13546,7 +13546,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "platforms 2.0.0", ] @@ -13554,7 +13554,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -13573,7 +13573,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "hyper", "log", @@ -13585,7 +13585,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "jsonrpsee", @@ -13598,7 +13598,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "jsonrpsee", "log", @@ -13617,7 +13617,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -13643,7 +13643,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "futures", "substrate-test-utils-derive", @@ -13653,7 +13653,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -13664,7 +13664,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "ansi_term", "build-helper", @@ -13791,7 +13791,7 @@ checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" [[package]] name = "test-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -14177,7 +14177,7 @@ dependencies = [ [[package]] name = "tracing-gum" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "polkadot-node-jaeger", "polkadot-primitives", @@ -14188,7 +14188,7 @@ dependencies = [ [[package]] name = "tracing-gum-proc-macro" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "expander 2.0.0", "proc-macro-crate", @@ -14318,7 +14318,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#bc8a35079546efd12673294fc66b0143a1c5f468" +source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" dependencies = [ "async-trait", "clap 4.2.7", @@ -15251,7 +15251,7 @@ dependencies = [ [[package]] name = "westend-runtime" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bitvec", "frame-benchmarking", @@ -15343,7 +15343,7 @@ dependencies = [ [[package]] name = "westend-runtime-constants" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "polkadot-primitives", @@ -15845,7 +15845,7 @@ dependencies = [ [[package]] name = "xcm" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "bounded-collections", "derivative", @@ -15861,7 +15861,7 @@ dependencies = [ [[package]] name = "xcm-builder" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "frame-support", "frame-system", @@ -15882,7 +15882,7 @@ dependencies = [ [[package]] name = "xcm-executor" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "environmental", "frame-benchmarking", @@ -15902,7 +15902,7 @@ dependencies = [ [[package]] name = "xcm-procedural" version = "0.9.41" -source = "git+https://github.com/paritytech/polkadot?branch=master#5e7103ddbade47af93d6b038cda88b89025a2073" +source = "git+https://github.com/paritytech/polkadot?branch=master#eb8dee045a75db91b7f4cb6a187f0bdd5e92ab47" dependencies = [ "Inflector", "proc-macro2", diff --git a/test/service/src/lib.rs b/test/service/src/lib.rs index b24e71936a0..5138a58bd80 100644 --- a/test/service/src/lib.rs +++ b/test/service/src/lib.rs @@ -753,6 +753,7 @@ pub fn node_config( rpc_max_response_size: Default::default(), rpc_id_provider: None, rpc_max_subs_per_conn: Default::default(), + rpc_port: 9945, prometheus_config: None, telemetry_endpoints: None, default_heap_pages: None, From c94d64cf27ac07a240ccaa6a9606c1d6405e3966 Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Mon, 8 May 2023 11:16:40 +0200 Subject: [PATCH 35/60] add set_invulnerables to SafeCallFilter (#2537) --- parachains/runtimes/assets/statemine/src/xcm_config.rs | 3 ++- parachains/runtimes/assets/westmint/src/xcm_config.rs | 3 ++- .../runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs | 3 ++- .../runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs | 3 ++- .../runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs | 3 ++- .../collectives/collectives-polkadot/src/xcm_config.rs | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/parachains/runtimes/assets/statemine/src/xcm_config.rs b/parachains/runtimes/assets/statemine/src/xcm_config.rs index ac830e76408..76bc685fd9c 100644 --- a/parachains/runtimes/assets/statemine/src/xcm_config.rs +++ b/parachains/runtimes/assets/statemine/src/xcm_config.rs @@ -212,7 +212,8 @@ impl Contains for SafeCallFilter { pallet_collator_selection::Call::set_desired_candidates { .. } | pallet_collator_selection::Call::set_candidacy_bond { .. } | pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::XcmpQueue(..) | RuntimeCall::DmpQueue(..) | diff --git a/parachains/runtimes/assets/westmint/src/xcm_config.rs b/parachains/runtimes/assets/westmint/src/xcm_config.rs index 53750a4a810..4b626fb8f30 100644 --- a/parachains/runtimes/assets/westmint/src/xcm_config.rs +++ b/parachains/runtimes/assets/westmint/src/xcm_config.rs @@ -206,7 +206,8 @@ impl Contains for SafeCallFilter { pallet_collator_selection::Call::set_desired_candidates { .. } | pallet_collator_selection::Call::set_candidacy_bond { .. } | pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::XcmpQueue(..) | RuntimeCall::DmpQueue(..) | diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs index f432a345b32..5957b2ebbae 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/xcm_config.rs @@ -144,7 +144,8 @@ impl Contains for SafeCallFilter { pallet_collator_selection::Call::set_desired_candidates { .. } | pallet_collator_selection::Call::set_candidacy_bond { .. } | pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::XcmpQueue(..) | RuntimeCall::DmpQueue(..) | diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs index 22b7edffffb..7b34b5e135b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/xcm_config.rs @@ -147,7 +147,8 @@ impl Contains for SafeCallFilter { pallet_collator_selection::Call::set_desired_candidates { .. } | pallet_collator_selection::Call::set_candidacy_bond { .. } | pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::XcmpQueue(..) | RuntimeCall::DmpQueue(..) | 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 945d0636ac7..c8a4c42af0e 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 @@ -167,7 +167,8 @@ impl Contains for SafeCallFilter { pallet_collator_selection::Call::set_desired_candidates { .. } | pallet_collator_selection::Call::set_candidacy_bond { .. } | pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::XcmpQueue(..) | RuntimeCall::DmpQueue(..) | diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs index b54f6ede5f2..5bc781c6aae 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/xcm_config.rs @@ -151,7 +151,8 @@ impl Contains for SafeCallFilter { pallet_collator_selection::Call::set_desired_candidates { .. } | pallet_collator_selection::Call::set_candidacy_bond { .. } | pallet_collator_selection::Call::register_as_candidate { .. } | - pallet_collator_selection::Call::leave_intent { .. }, + pallet_collator_selection::Call::leave_intent { .. } | + pallet_collator_selection::Call::set_invulnerables { .. }, ) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) | RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) | RuntimeCall::XcmpQueue(..) | From fe5f5c253c1d740c730ce59445d51b2ace6e835b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 8 May 2023 12:56:46 +0200 Subject: [PATCH 36/60] tests restructure + common variables --- Cargo.lock | 3 + .../xcm-emulator/assets/statemint/src/lib.rs | 8 + .../assets/statemint/tests/mod.rs | 1 + .../assets/statemint/tests/statemint.rs | 245 ---------------- .../assets/statemint/tests/teleports.rs | 225 +++++++++++++++ .../xcm-emulator/common/src/constants.rs | 38 ++- .../xcm-emulator/common/src/lib.rs | 265 ++++++++++-------- xcm/xcm-emulator/Cargo.toml | 3 + xcm/xcm-emulator/src/lib.rs | 21 +- 9 files changed, 433 insertions(+), 376 deletions(-) create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs delete mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs diff --git a/Cargo.lock b/Cargo.lock index 55f3007ce03..b3fd743d777 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15334,9 +15334,12 @@ dependencies = [ "cumulus-primitives-core", "cumulus-primitives-parachain-inherent", "cumulus-test-relay-sproof-builder", + "cumulus-test-service", "frame-support", "frame-system", + "pallet-balances", "parachain-info", + "parachains-common", "parity-scale-codec", "paste", "polkadot-primitives", diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs index 5c6016f6a14..7493b71f9f4 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -1,2 +1,10 @@ +pub use integration_tests_common::{ + AccountId, + PolkadotMockNet, KusamaMockNet, PolkadotRelay, KusamaRelay, Statemint, Statemine, PenpalPolkadot, PenpalKusama, + PolkadotSender, PolkadotReceiver, KusamaSender, KusamaReceiver, + StatemintSender, StatemintReceiver, StatemineSender, StatemineReceiver, + PenpalPolkadotSender, PenpalPolkadotReceiver, PenpalKusamaSender, PenpalKusamaReceiver, + constants::accounts::{ALICE, BOB}, +}; #[cfg(test)] mod tests {} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs new file mode 100644 index 00000000000..baa4880e2dc --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs @@ -0,0 +1 @@ +pub mod teleports; diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs deleted file mode 100644 index eee63254dee..00000000000 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/statemint.rs +++ /dev/null @@ -1,245 +0,0 @@ -use frame_support::{ - assert_ok, - instances::Instance1, - pallet_prelude::Hooks, - sp_io, sp_tracing, - traits::{fungibles::Inspect, GenesisBuild}, -}; - -use codec::Encode; -use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_core::parameter_types; -use statemint_runtime::constants::currency::DOLLARS; -use xcm::prelude::*; -use xcm_emulator::TestExt; - -use xcm_executor::traits::Convert; - -use parachains_common::Balance; -use polkadot_core_primitives::InboundDownwardMessage; -use polkadot_parachain::primitives::DmpMessageHandler; -use sp_weights::Weight; -use xcm::{ - latest::{Ancestor, MultiLocation}, - prelude::{AccountId32, Here, Parachain}, - v3::Outcome, - VersionedMultiAssets, -}; - -use integration_tests_common::{PolkadotMockNet, Polkadot, Statemint, PenpalPolkadot, constants::accounts::{ALICE, BOB}}; - -pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; - -pub type RelayChainPalletXcm = pallet_xcm::Pallet; -pub type StatemintPalletXcm = pallet_xcm::Pallet; -pub type PenpalPolkadotPalletXcm = pallet_xcm::Pallet; - -parameter_types! { - pub StatemintLocation: MultiLocation = (Ancestor(0), Parachain(1000)).into(); -} - -#[test] -// NOTE: This needs to be run before every other test to ensure that chains can communicate with one -// another. -fn force_xcm_version() { - let xcm_version = 3; - Polkadot::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, System}; - - let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); - let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); - - // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. - for location in [statemint_location, penpal_location] { - assert_ok!(RelayChainPalletXcm::force_xcm_version( - polkadot_runtime::RuntimeOrigin::root(), - Box::new(location), - xcm_version, - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - } - }); - - // PenpalPolkadot forces Polkadot xcm version. - PenpalPolkadot::execute_with(|| { - use penpal_runtime::{RuntimeEvent, System}; - - let location: MultiLocation = (Parent).into(); - - assert_ok!(PenpalPolkadotPalletXcm::force_xcm_version( - penpal_runtime::RuntimeOrigin::root(), - Box::new(location), - xcm_version, - )); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - }); -} - -// Direct message passing tests. -mod dmp { - use super::*; - use xcm::latest::Error; - use xcm_emulator::{cumulus_pallet_dmp_queue, Parachain}; - - fn get_balances() -> (Balance, Balance) { - let mut relay_balance = Default::default(); - Polkadot::execute_with(|| { - relay_balance = - polkadot_runtime::System::account::(ALICE.into()) - .data - .free; - }); - let mut assets_para_balance = Default::default(); - - Statemint::execute_with(|| { - assets_para_balance = - statemint_runtime::System::account::(ALICE.into()) - .data - .free; - }); - - (relay_balance, assets_para_balance) - } - - fn get_benf() -> Junction { - AccountId32 { network: None, id: ALICE.into() } - } - - const AP_DEST: (Ancestor, Junction) = (Ancestor(0), Parachain(1000)); - - #[test] - fn teleport_native_assets_relay_to_assets_para() { - force_xcm_version(); - let amount = 1000_000_000; - let assets: VersionedMultiAssets = (Here, amount).into(); - - let mut messages: Vec = Vec::new(); - - let (relay_balance, ap_balance) = get_balances(); - - Polkadot::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - - assert_ok!(RelayChainPalletXcm::limited_teleport_assets( - RuntimeOrigin::signed(ALICE.into()), - Box::new(AP_DEST.into()), - Box::new(get_benf().into()), - Box::new(assets), - 0, - WeightLimit::Unlimited, - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) - ))); - }); - - Statemint::execute_with(|| { - use statemint_runtime::{Runtime, RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) - if *who == ALICE.into() - ))); - }); - - let (relay_balance_after, ap_balance_after) = get_balances(); - assert_eq!(relay_balance - amount, relay_balance_after); - assert!(ap_balance_after > ap_balance); - } - - #[test] - fn transact_sudo_relay_to_assets_para_works() { - force_xcm_version(); - - Polkadot::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - - let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< - statemint_runtime::Runtime, - Instance1, - >::force_create { - id: 1.into(), - is_sufficient: true, - min_balance: 1000, - owner: ALICE.into(), - }); - let xcm = Xcm(vec![ - UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, - Transact { - require_weight_at_most: Weight::from_parts(1000000000, 200000), - origin_kind: OriginKind::Superuser, - call: call.encode().into(), - }, - ]); - assert_ok!(RelayChainPalletXcm::send( - RuntimeOrigin::root(), - Box::new(AP_DEST.into()), - Box::new(VersionedXcm::from(xcm)), - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) - ))); - }); - - Statemint::execute_with(|| { - assert!(statemint_runtime::Assets::asset_exists(1)); - }); - } - - #[test] - fn reserved_transfer_native_relay_to_assets_para_fails() { - force_xcm_version(); - let (relay_balance, ap_balance) = get_balances(); - let amount = 1000_000_000; - let assets: VersionedMultiAssets = (Here, amount).into(); - - Polkadot::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - - assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( - RuntimeOrigin::signed(ALICE.into()), - Box::new(AP_DEST.into()), - Box::new(get_benf().into()), - Box::new(assets), - 0, - WeightLimit::Unlimited, - )); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) - ))); - }); - - Statemint::execute_with(|| { - use statemint_runtime::{RuntimeEvent, System}; - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { - outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), - .. - }) - ))); - }); - - let (relay_balance_after, ap_balance_after) = get_balances(); - assert_eq!(relay_balance - amount, relay_balance_after); - assert_eq!(ap_balance_after, ap_balance); - } -} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs new file mode 100644 index 00000000000..87057766040 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs @@ -0,0 +1,225 @@ +// use crate::PolkadotMockNet; +use statemint_it::*; +use frame_support::{ + assert_ok, + instances::Instance1, + pallet_prelude::Hooks, + sp_io, sp_tracing, + traits::{fungibles::Inspect, GenesisBuild}, +}; + +use codec::Encode; +use polkadot_runtime_parachains::configuration::HostConfiguration; +use sp_core::parameter_types; +use statemint_runtime::constants::currency::DOLLARS; +use xcm::prelude::*; +use xcm_emulator::{TestExt, Parachain as Para, RelayChain as Relay}; + +use xcm_executor::traits::Convert; +use xcm::latest::Error; +use xcm_emulator::{cumulus_pallet_dmp_queue, bx}; +use parachains_common::Balance; +use polkadot_core_primitives::InboundDownwardMessage; +use polkadot_parachain::primitives::DmpMessageHandler; +use sp_weights::Weight; +use xcm::{ + latest::{Ancestor, MultiLocation}, + prelude::{AccountId32, Here, Parachain}, + v3::Outcome, + VersionedMultiAssets, +}; + +// use integration_tests_common::{AccountId, PolkadotMockNet, Polkadot, Statemint, PenpalPolkadot, constants::accounts::{ALICE, BOB}}; + +pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; + +pub type RelayChainPalletXcm = pallet_xcm::Pallet; +pub type StatemintPalletXcm = pallet_xcm::Pallet; +pub type PenpalPolkadotPalletXcm = pallet_xcm::Pallet; + + +#[test] +// NOTE: This needs to be run before every other test to ensure that chains can communicate with one +// another. +fn force_xcm_version() { + let xcm_version = 3; + PolkadotRelay::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, System}; + + let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); + let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); + + // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. + for location in [statemint_location, penpal_location] { + assert_ok!(RelayChainPalletXcm::force_xcm_version( + polkadot_runtime::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + } + }); + + // PenpalPolkadot forces Polkadot xcm version. + PenpalPolkadot::execute_with(|| { + use penpal_runtime::{RuntimeEvent, System}; + + let location: MultiLocation = (Parent).into(); + + assert_ok!(PenpalPolkadotPalletXcm::force_xcm_version( + penpal_runtime::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + }); +} + +// Direct message passing tests. + +// use super::*; + + +#[test] +fn teleport_native_assets_relay_to_assets_para() { + force_xcm_version(); + // const LALA: AccountId = Polkadot::account_id_of(ALICE); + let amount = 1000_000_000; + let assets: VersionedMultiAssets = (Here, amount).into(); + let relay_sender_balance_before = PolkadotRelay::account_data_of(PolkadotSender::get()).free; + let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + + let mut messages: Vec = Vec::new(); + + PolkadotRelay::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + assert_ok!(RelayChainPalletXcm::limited_teleport_assets( + RuntimeOrigin::signed(PolkadotSender::get()), + bx!( + (Ancestor(0), Parachain(Statemint::para_id().into())).into() + ), + bx!( + AccountId32 { network: None, id: Statemint::account_id_of(BOB).into()}.into()) + , + bx!(assets), + 0, + WeightLimit::Unlimited, + )); + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) + ))); + }); + + Statemint::execute_with(|| { + use statemint_runtime::{Runtime, RuntimeEvent, System}; + assert!(System::events().iter().any(|r| matches!( + &r.event, + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) + if *who == Statemint::account_id_of(BOB).into() + ))); + }); + + // let (relay_balance_after, ap_balance_after) = get_balances(); + let relay_sender_balance_after = PolkadotRelay::account_data_of(PolkadotSender::get()).free; + let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert!(para_sender_balance_after > para_receiver_balance_before); +} + +// #[test] +// fn transact_sudo_relay_to_assets_para_works() { +// force_xcm_version(); + +// Polkadot::execute_with(|| { +// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + +// let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< +// statemint_runtime::Runtime, +// Instance1, +// >::force_create { +// id: 1.into(), +// is_sufficient: true, +// min_balance: 1000, +// owner: ALICE.into(), +// }); +// let xcm = Xcm(vec![ +// UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, +// Transact { +// require_weight_at_most: Weight::from_parts(1000000000, 200000), +// origin_kind: OriginKind::Superuser, +// call: call.encode().into(), +// }, +// ]); +// assert_ok!(RelayChainPalletXcm::send( +// RuntimeOrigin::root(), +// Box::new(AP_DEST.into()), +// Box::new(VersionedXcm::from(xcm)), +// )); +// assert!(System::events().iter().any(|r| matches!( +// r.event, +// RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) +// ))); +// }); + +// Statemint::execute_with(|| { +// assert!(statemint_runtime::Assets::asset_exists(1)); +// }); +// } + +// #[test] +// fn reserved_transfer_native_relay_to_assets_para_fails() { +// force_xcm_version(); +// let (relay_balance, ap_balance) = get_balances(); +// let amount = 1000_000_000; +// let assets: VersionedMultiAssets = (Here, amount).into(); + +// Polkadot::execute_with(|| { +// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + +// assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( +// RuntimeOrigin::signed(ALICE.into()), +// Box::new(AP_DEST.into()), +// Box::new(get_benf().into()), +// Box::new(assets), +// 0, +// WeightLimit::Unlimited, +// )); + +// assert!(System::events().iter().any(|r| matches!( +// r.event, +// RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) +// ))); +// }); + +// Statemint::execute_with(|| { +// use statemint_runtime::{RuntimeEvent, System}; + +// assert!(System::events().iter().any(|r| matches!( +// r.event, +// RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { +// outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), +// .. +// }) +// ))); +// }); + +// let (relay_balance_after, ap_balance_after) = get_balances(); +// assert_eq!(relay_balance - amount, relay_balance_after); +// assert_eq!(ap_balance_after, ap_balance); +// } diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs index 4b3039a66a9..320b92d1ce9 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/constants.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -14,23 +14,33 @@ use pallet_im_online::sr25519::AuthorityId as ImOnlineId; pub mod accounts { use super::*; - pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); - pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); + pub const ALICE: &str = "Alice"; + pub const BOB: &str = "Bob"; + pub const CHARLIE: &str = "Charlie"; + pub const DAVE: &str = "Dave"; + pub const EVE: &str = "Eve"; + pub const FERDIE: &str = "Ferdeir"; + pub const ALICE_STASH: &str = "Alice//stash"; + pub const BOB_STASH: &str = "Bob//stash"; + pub const CHARLIE_STASH: &str = "Charlie//stash"; + pub const DAVE_STASH: &str = "Dave//stash"; + pub const EVE_STASH: &str = "Eve//stash"; + pub const FERDIE_STASH: &str = "Ferdie//stash"; pub fn init_balances() -> Vec { vec![ - get_account_id_from_seed::("Alice"), - get_account_id_from_seed::("Bob"), - get_account_id_from_seed::("Charlie"), - get_account_id_from_seed::("Dave"), - get_account_id_from_seed::("Eve"), - get_account_id_from_seed::("Ferdie"), - get_account_id_from_seed::("Alice//stash"), - get_account_id_from_seed::("Bob//stash"), - get_account_id_from_seed::("Charlie//stash"), - get_account_id_from_seed::("Dave//stash"), - get_account_id_from_seed::("Eve//stash"), - get_account_id_from_seed::("Ferdie//stash"), + get_account_id_from_seed::(ALICE), + get_account_id_from_seed::(BOB), + get_account_id_from_seed::(CHARLIE), + get_account_id_from_seed::(DAVE), + get_account_id_from_seed::(EVE), + get_account_id_from_seed::(FERDIE), + get_account_id_from_seed::(ALICE_STASH), + get_account_id_from_seed::(BOB_STASH), + get_account_id_from_seed::(CHARLIE_STASH), + get_account_id_from_seed::(DAVE_STASH), + get_account_id_from_seed::(EVE_STASH), + get_account_id_from_seed::(FERDIE_STASH), ] } } diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index ac5efb0a70b..468a40d69ac 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -6,6 +6,7 @@ use frame_support::{ pallet_prelude::Hooks, sp_io, sp_tracing, traits::{fungibles::Inspect, GenesisBuild}, + parameter_types }; use xcm::prelude::*; use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, RelayChain, Parachain}; @@ -14,18 +15,20 @@ use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; pub use constants::{polkadot, kusama, statemint, statemine, penpal, accounts::{ALICE, BOB}}; use sp_runtime::BuildStorage; -pub use sp_core::{Get, storage::Storage}; +pub use sp_core::{Get, sr25519, storage::Storage}; use parachain_info::pallet::Pallet; +// pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; +pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; decl_test_relay_chains! { - pub struct Polkadot { + pub struct PolkadotRelay { Runtime = polkadot_runtime::Runtime, XcmConfig = polkadot_runtime::xcm_config::XcmConfig, System = polkadot_runtime::System, - genesis = polkadot_storage(), + genesis = polkadot::genesis(), on_init = (), }, - pub struct Kusama { + pub struct KusamaRelay { Runtime = kusama_runtime::Runtime, XcmConfig = kusama_runtime::xcm_config::XcmConfig, System = kusama_runtime::System, @@ -44,7 +47,7 @@ decl_test_parachains! { System = statemint_runtime::System, ParachainSystem = statemint_runtime::ParachainSystem, ParachainInfo = statemint_runtime::ParachainInfo, - genesis = statemint_storage(), + genesis = statemint::genesis(), on_init = (), }, pub struct PenpalPolkadot { @@ -85,14 +88,14 @@ decl_test_parachains! { decl_test_networks! { pub struct PolkadotMockNet { - relay_chain = Polkadot, + relay_chain = PolkadotRelay, parachains = vec![ Statemint, PenpalPolkadot, ], }, pub struct KusamaMockNet { - relay_chain = Kusama, + relay_chain = KusamaRelay, parachains = vec![ Statemine, PenpalKusama, @@ -104,6 +107,29 @@ decl_test_networks! { // polkadot_runtime::System::set_block_number(1); // } +parameter_types! { + // Polkadot + pub PolkadotSender: AccountId = PolkadotRelay::account_id_of(ALICE); + pub PolkadotReceiver: AccountId = PolkadotRelay::account_id_of(BOB); + // Kusama + pub KusamaSender: AccountId = KusamaRelay::account_id_of(ALICE); + pub KusamaReceiver: AccountId = KusamaRelay::account_id_of(BOB); + // Statemint + pub StatemintSender: AccountId = Statemint::account_id_of(ALICE); + pub StatemintReceiver: AccountId = Statemint::account_id_of(BOB); + // Statemine + pub StatemineSender: AccountId = Statemine::account_id_of(ALICE); + pub StatemineReceiver: AccountId = Statemine::account_id_of(BOB); + // Penpal Polkadot + pub PenpalPolkadotSender: AccountId = PenpalPolkadot::account_id_of(ALICE); + pub PenpalPolkadotReceiver: AccountId = PenpalPolkadot::account_id_of(BOB); + // Penpal Kusama + pub PenpalKusamaSender: AccountId = PenpalKusama::account_id_of(ALICE); + pub PenpalKusamaReceiver: AccountId = PenpalKusama::account_id_of(BOB); + + pub StatemintLocation: MultiLocation = (Ancestor(0), Parachain(1000)).into(); +} + pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; @@ -117,129 +143,136 @@ pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() } -pub fn relay_ext() -> sp_io::TestExternalities { - use polkadot_runtime::{Runtime, RuntimeOrigin, System}; - - // ::XcmSender = RelayChainXcmRouter; - // ::XcmRouter = RelayChainXcmRouter; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: polkadot::get_host_config(), - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![ - (ALICE, INITIAL_BALANCE), - (child_account_id(1000), INITIAL_BALANCE), - (child_account_id(2000), INITIAL_BALANCE), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - System::set_block_number(1); - }); - ext -} - -pub fn polkadot_storage() -> Storage { - use polkadot_runtime::{Runtime}; - let mut t = polkadot::genesis(); - - pallet_balances::GenesisConfig:: { - balances: vec![ - (ALICE, INITIAL_BALANCE), - (child_account_id(1000), INITIAL_BALANCE), - (child_account_id(2000), INITIAL_BALANCE), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - t -} +// pub fn relay_ext() -> sp_io::TestExternalities { +// use polkadot_runtime::{Runtime, RuntimeOrigin, System}; + +// // ::XcmSender = RelayChainXcmRouter; +// // ::XcmRouter = RelayChainXcmRouter; + +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + +// polkadot_runtime_parachains::configuration::GenesisConfig:: { +// config: polkadot::get_host_config(), +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![ +// (ALICE, INITIAL_BALANCE), +// (child_account_id(1000), INITIAL_BALANCE), +// (child_account_id(2000), INITIAL_BALANCE), +// ], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// System::set_block_number(1); +// }); +// ext +// } -pub fn statemint_storage() -> Storage { - use statemint_runtime::{Runtime}; - let mut t = statemint::genesis(); +// pub fn polkadot_storage() -> Storage { +// use polkadot_runtime::{Runtime}; +// let mut t = polkadot::genesis(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![ +// (ALICE, INITIAL_BALANCE), +// (child_account_id(1000), INITIAL_BALANCE), +// (child_account_id(2000), INITIAL_BALANCE), +// ], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// t +// } - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); +// pub fn statemint_storage() -> Storage { +// use statemint_runtime::{Runtime}; +// let mut t = statemint::genesis(); - t -} -// Define Statemint TestExternalities. -pub fn statemint_ext() -> sp_io::TestExternalities { - use statemint_runtime::{Runtime, System}; +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); - let mut t = statemint::genesis().build_storage().unwrap(); +// t +// } +// // Define Statemint TestExternalities. +// pub fn statemint_ext() -> sp_io::TestExternalities { +// use statemint_runtime::{Runtime, System}; + +// let mut t = statemint::genesis().build_storage().unwrap(); + +// // let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); + +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// sp_tracing::try_init_simple(); +// System::set_block_number(1); +// }); +// ext +// } - // let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); +// // Define Statemine TestExternalities. +// pub fn statemine_ext() -> sp_io::TestExternalities { +// use statemine_runtime::{Runtime, System}; - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - sp_tracing::try_init_simple(); - System::set_block_number(1); - }); - ext -} +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); -// Define Statemine TestExternalities. -pub fn statemine_ext() -> sp_io::TestExternalities { - use statemine_runtime::{Runtime, System}; +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// sp_tracing::try_init_simple(); +// System::set_block_number(1); +// }); +// ext +// } - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - sp_tracing::try_init_simple(); - System::set_block_number(1); - }); - ext -} +// // Define Penpal TestExternalities. +// pub fn penpal_ext() -> sp_io::TestExternalities { +// use penpal_runtime::{Runtime, System}; -// Define Penpal TestExternalities. -pub fn penpal_ext() -> sp_io::TestExternalities { - use penpal_runtime::{Runtime, System}; +// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); +// pallet_balances::GenesisConfig:: { +// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], +// } +// .assimilate_storage(&mut t) +// .unwrap(); - pallet_balances::GenesisConfig:: { - balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - sp_tracing::try_init_simple(); - System::set_block_number(1); - }); - ext -} +// let mut ext = sp_io::TestExternalities::new(t); +// ext.execute_with(|| { +// sp_tracing::try_init_simple(); +// System::set_block_number(1); +// }); +// ext +// } // mod accounts { // pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); // pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); // } + +pub mod helpers { + use super::*; + // pub fn account_id_of(seed: &str) -> AccountId { + // get_account_id_from_seed::(seed) + // } +} diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml index 83d31d2aea7..2053e3b99a9 100644 --- a/xcm/xcm-emulator/Cargo.toml +++ b/xcm/xcm-emulator/Cargo.toml @@ -18,14 +18,17 @@ sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-std = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" } sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master" } +pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } cumulus-primitives-core = { path = "../../primitives/core"} cumulus-pallet-xcmp-queue = { path = "../../pallets/xcmp-queue" } cumulus-pallet-dmp-queue = { path = "../../pallets/dmp-queue" } cumulus-pallet-parachain-system = { path = "../../pallets/parachain-system" } +cumulus-test-service = { path = "../../test/service" } parachain-info = { path = "../../parachains/pallets/parachain-info" } cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" } cumulus-test-relay-sproof-builder = { path = "../../test/relay-sproof-builder" } +parachains-common = { path = "../../parachains/common" } xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master" } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index c826c2fb12b..a0fa0440a25 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -23,13 +23,15 @@ pub use frame_support::{ weights::Weight, sp_runtime::BuildStorage, }; -pub use frame_system; +pub use pallet_balances::AccountData; +pub use frame_system::AccountInfo; pub use sp_arithmetic::traits::Bounded; pub use sp_io::TestExternalities; pub use sp_std::{cell::RefCell, collections::{vec_deque::VecDeque}, marker::PhantomData}; pub use sp_trie::StorageProof; pub use sp_core::storage::Storage; +pub use cumulus_test_service::get_account_id_from_seed; pub use cumulus_pallet_dmp_queue; pub use cumulus_pallet_parachain_system; pub use cumulus_pallet_xcmp_queue; @@ -40,6 +42,7 @@ pub use cumulus_primitives_core::{ pub use cumulus_primitives_parachain_inherent::ParachainInherentData; pub use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; pub use parachain_info; +pub use parachains_common::{BlockNumber, AccountId}; pub use polkadot_primitives; pub use polkadot_runtime_parachains::{ @@ -245,6 +248,14 @@ macro_rules! __impl_relay { <$network_name>::_para_ids() } + pub fn account_id_of(seed: &str) -> $crate::AccountId { + $crate::get_account_id_from_seed::(seed) + } + + pub fn account_data_of(account: AccountId) -> $crate::AccountData { + Self::ext_wrapper(|| ::System::account(account).data) + } + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); } @@ -467,6 +478,14 @@ macro_rules! __impl_parachain { <$network_name>::_set_relay_block_number(block_number); } + pub fn account_id_of(seed: &str) -> $crate::AccountId { + $crate::get_account_id_from_seed::(seed) + } + + pub fn account_data_of(account: AccountId) -> $crate::AccountData { + Self::ext_wrapper(|| ::System::account(account).data) + } + fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { From 6cba4b41a92d82ba50b7b588f8e73f9c6d96663f Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Mon, 8 May 2023 13:04:15 +0200 Subject: [PATCH 37/60] Substrate 13843 (Asset Freezing) Companion (#2437) * add migrations * fix pallet instancing in migration * migrate by instance * weights * remove migrations * update weights * update weights * update lockfile for {"polkadot", "substrate"} --------- Co-authored-by: muharem Co-authored-by: parity-processbot <> --- Cargo.lock | 382 +++++++++--------- .../statemine/src/weights/pallet_assets.rs | 69 ++++ .../statemint/src/weights/pallet_assets.rs | 69 ++++ .../westmint/src/weights/pallet_assets.rs | 69 ++++ 4 files changed, 398 insertions(+), 191 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c5386ec04c..d46e0c76000 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -585,7 +585,7 @@ dependencies = [ [[package]] name = "binary-merkle-tree" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "log", @@ -3761,7 +3761,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fork-tree" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", ] @@ -3784,7 +3784,7 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "frame-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-support-procedural", @@ -3809,7 +3809,7 @@ dependencies = [ [[package]] name = "frame-benchmarking-cli" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "array-bytes 4.2.0", @@ -3856,7 +3856,7 @@ dependencies = [ [[package]] name = "frame-election-provider-solution-type" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3867,7 +3867,7 @@ dependencies = [ [[package]] name = "frame-election-provider-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-election-provider-solution-type", "frame-support", @@ -3884,7 +3884,7 @@ dependencies = [ [[package]] name = "frame-executive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -3913,7 +3913,7 @@ dependencies = [ [[package]] name = "frame-remote-externalities" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-recursion", "futures", @@ -3933,7 +3933,7 @@ dependencies = [ [[package]] name = "frame-support" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bitflags", "environmental", @@ -3966,7 +3966,7 @@ dependencies = [ [[package]] name = "frame-support-procedural" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "cfg-expr", @@ -3982,7 +3982,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support-procedural-tools-derive", "proc-macro-crate", @@ -3994,7 +3994,7 @@ dependencies = [ [[package]] name = "frame-support-procedural-tools-derive" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -4004,7 +4004,7 @@ dependencies = [ [[package]] name = "frame-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "log", @@ -4022,7 +4022,7 @@ dependencies = [ [[package]] name = "frame-system-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -4037,7 +4037,7 @@ dependencies = [ [[package]] name = "frame-system-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-api", @@ -4046,7 +4046,7 @@ dependencies = [ [[package]] name = "frame-try-runtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "parity-scale-codec", @@ -6015,7 +6015,7 @@ dependencies = [ [[package]] name = "mmr-gadget" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "log", @@ -6034,7 +6034,7 @@ dependencies = [ [[package]] name = "mmr-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "anyhow", "jsonrpsee", @@ -6539,7 +6539,7 @@ dependencies = [ [[package]] name = "pallet-alliance" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "frame-benchmarking", @@ -6560,7 +6560,7 @@ dependencies = [ [[package]] name = "pallet-asset-tx-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6578,7 +6578,7 @@ dependencies = [ [[package]] name = "pallet-assets" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6593,7 +6593,7 @@ dependencies = [ [[package]] name = "pallet-aura" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6609,7 +6609,7 @@ dependencies = [ [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6625,7 +6625,7 @@ dependencies = [ [[package]] name = "pallet-authorship" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6639,7 +6639,7 @@ dependencies = [ [[package]] name = "pallet-babe" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6663,7 +6663,7 @@ dependencies = [ [[package]] name = "pallet-bags-list" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -6683,7 +6683,7 @@ dependencies = [ [[package]] name = "pallet-balances" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6698,7 +6698,7 @@ dependencies = [ [[package]] name = "pallet-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -6717,7 +6717,7 @@ dependencies = [ [[package]] name = "pallet-beefy-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "binary-merkle-tree", @@ -6741,7 +6741,7 @@ dependencies = [ [[package]] name = "pallet-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6847,7 +6847,7 @@ dependencies = [ [[package]] name = "pallet-child-bounties" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6891,7 +6891,7 @@ dependencies = [ [[package]] name = "pallet-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6908,7 +6908,7 @@ dependencies = [ [[package]] name = "pallet-contracts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bitflags", "environmental", @@ -6938,7 +6938,7 @@ dependencies = [ [[package]] name = "pallet-contracts-primitives" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bitflags", "parity-scale-codec", @@ -6951,7 +6951,7 @@ dependencies = [ [[package]] name = "pallet-contracts-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -6961,7 +6961,7 @@ dependencies = [ [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "assert_matches", "frame-benchmarking", @@ -6978,7 +6978,7 @@ dependencies = [ [[package]] name = "pallet-democracy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -6996,7 +6996,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-multi-phase" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7019,7 +7019,7 @@ dependencies = [ [[package]] name = "pallet-election-provider-support-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7032,7 +7032,7 @@ dependencies = [ [[package]] name = "pallet-elections-phragmen" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7050,7 +7050,7 @@ dependencies = [ [[package]] name = "pallet-fast-unstake" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7068,7 +7068,7 @@ dependencies = [ [[package]] name = "pallet-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7091,7 +7091,7 @@ dependencies = [ [[package]] name = "pallet-identity" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7107,7 +7107,7 @@ dependencies = [ [[package]] name = "pallet-im-online" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7127,7 +7127,7 @@ dependencies = [ [[package]] name = "pallet-indices" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7144,7 +7144,7 @@ dependencies = [ [[package]] name = "pallet-insecure-randomness-collective-flip" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7158,7 +7158,7 @@ dependencies = [ [[package]] name = "pallet-membership" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7175,7 +7175,7 @@ dependencies = [ [[package]] name = "pallet-mmr" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7192,7 +7192,7 @@ dependencies = [ [[package]] name = "pallet-multisig" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7208,7 +7208,7 @@ dependencies = [ [[package]] name = "pallet-nfts" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "enumflags2", "frame-benchmarking", @@ -7226,7 +7226,7 @@ dependencies = [ [[package]] name = "pallet-nfts-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "pallet-nfts", @@ -7237,7 +7237,7 @@ dependencies = [ [[package]] name = "pallet-nis" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7253,7 +7253,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7270,7 +7270,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-benchmarking" version = "1.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7290,7 +7290,7 @@ dependencies = [ [[package]] name = "pallet-nomination-pools-runtime-api" version = "1.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "pallet-nomination-pools", "parity-scale-codec", @@ -7301,7 +7301,7 @@ dependencies = [ [[package]] name = "pallet-offences" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7318,7 +7318,7 @@ dependencies = [ [[package]] name = "pallet-offences-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7342,7 +7342,7 @@ dependencies = [ [[package]] name = "pallet-preimage" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7359,7 +7359,7 @@ dependencies = [ [[package]] name = "pallet-proxy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7374,7 +7374,7 @@ dependencies = [ [[package]] name = "pallet-ranked-collective" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7392,7 +7392,7 @@ dependencies = [ [[package]] name = "pallet-recovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7407,7 +7407,7 @@ dependencies = [ [[package]] name = "pallet-referenda" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "assert_matches", "frame-benchmarking", @@ -7426,7 +7426,7 @@ dependencies = [ [[package]] name = "pallet-scheduler" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7443,7 +7443,7 @@ dependencies = [ [[package]] name = "pallet-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7464,7 +7464,7 @@ dependencies = [ [[package]] name = "pallet-session-benchmarking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7480,7 +7480,7 @@ dependencies = [ [[package]] name = "pallet-society" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7494,7 +7494,7 @@ dependencies = [ [[package]] name = "pallet-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-election-provider-support", @@ -7517,7 +7517,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-curve" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -7528,7 +7528,7 @@ dependencies = [ [[package]] name = "pallet-staking-reward-fn" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "sp-arithmetic", @@ -7537,7 +7537,7 @@ dependencies = [ [[package]] name = "pallet-staking-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-api", @@ -7546,7 +7546,7 @@ dependencies = [ [[package]] name = "pallet-state-trie-migration" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7563,7 +7563,7 @@ dependencies = [ [[package]] name = "pallet-sudo" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7592,7 +7592,7 @@ dependencies = [ [[package]] name = "pallet-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7610,7 +7610,7 @@ dependencies = [ [[package]] name = "pallet-tips" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7629,7 +7629,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-support", "frame-system", @@ -7645,7 +7645,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "pallet-transaction-payment-rpc-runtime-api", @@ -7661,7 +7661,7 @@ dependencies = [ [[package]] name = "pallet-transaction-payment-rpc-runtime-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "pallet-transaction-payment", "parity-scale-codec", @@ -7673,7 +7673,7 @@ dependencies = [ [[package]] name = "pallet-treasury" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7690,7 +7690,7 @@ dependencies = [ [[package]] name = "pallet-uniques" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7705,7 +7705,7 @@ dependencies = [ [[package]] name = "pallet-utility" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7721,7 +7721,7 @@ dependencies = [ [[package]] name = "pallet-vesting" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -7736,7 +7736,7 @@ dependencies = [ [[package]] name = "pallet-whitelist" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-benchmarking", "frame-support", @@ -10812,7 +10812,7 @@ dependencies = [ [[package]] name = "sc-allocator" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "sp-core", @@ -10823,7 +10823,7 @@ dependencies = [ [[package]] name = "sc-authority-discovery" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -10851,7 +10851,7 @@ dependencies = [ [[package]] name = "sc-basic-authorship" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "futures-timer", @@ -10874,7 +10874,7 @@ dependencies = [ [[package]] name = "sc-block-builder" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sc-client-api", @@ -10889,7 +10889,7 @@ dependencies = [ [[package]] name = "sc-chain-spec" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "memmap2", "sc-chain-spec-derive", @@ -10908,7 +10908,7 @@ dependencies = [ [[package]] name = "sc-chain-spec-derive" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -10919,7 +10919,7 @@ dependencies = [ [[package]] name = "sc-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "chrono", @@ -10959,7 +10959,7 @@ dependencies = [ [[package]] name = "sc-client-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "fnv", "futures", @@ -10986,7 +10986,7 @@ dependencies = [ [[package]] name = "sc-client-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "kvdb", @@ -11012,7 +11012,7 @@ dependencies = [ [[package]] name = "sc-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11037,7 +11037,7 @@ dependencies = [ [[package]] name = "sc-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11066,7 +11066,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "fork-tree", @@ -11102,7 +11102,7 @@ dependencies = [ [[package]] name = "sc-consensus-babe-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "jsonrpsee", @@ -11124,7 +11124,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11159,7 +11159,7 @@ dependencies = [ [[package]] name = "sc-consensus-beefy-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "jsonrpsee", @@ -11178,7 +11178,7 @@ dependencies = [ [[package]] name = "sc-consensus-epochs" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "fork-tree", "parity-scale-codec", @@ -11191,7 +11191,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ahash 0.8.2", "array-bytes 4.2.0", @@ -11231,7 +11231,7 @@ dependencies = [ [[package]] name = "sc-consensus-grandpa-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "finality-grandpa", "futures", @@ -11251,7 +11251,7 @@ dependencies = [ [[package]] name = "sc-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11274,7 +11274,7 @@ dependencies = [ [[package]] name = "sc-executor" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "lru 0.8.1", "parity-scale-codec", @@ -11298,7 +11298,7 @@ dependencies = [ [[package]] name = "sc-executor-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "sc-allocator", "sp-maybe-compressed-blob", @@ -11311,7 +11311,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmi" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "sc-allocator", @@ -11324,7 +11324,7 @@ dependencies = [ [[package]] name = "sc-executor-wasmtime" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "anyhow", "cfg-if", @@ -11342,7 +11342,7 @@ dependencies = [ [[package]] name = "sc-informant" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ansi_term", "futures", @@ -11358,7 +11358,7 @@ dependencies = [ [[package]] name = "sc-keystore" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11373,7 +11373,7 @@ dependencies = [ [[package]] name = "sc-network" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-channel", @@ -11418,7 +11418,7 @@ dependencies = [ [[package]] name = "sc-network-bitswap" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "cid", "futures", @@ -11438,7 +11438,7 @@ dependencies = [ [[package]] name = "sc-network-common" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11466,7 +11466,7 @@ dependencies = [ [[package]] name = "sc-network-gossip" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ahash 0.8.2", "futures", @@ -11485,7 +11485,7 @@ dependencies = [ [[package]] name = "sc-network-light" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11507,7 +11507,7 @@ dependencies = [ [[package]] name = "sc-network-sync" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -11541,7 +11541,7 @@ dependencies = [ [[package]] name = "sc-network-transactions" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11561,7 +11561,7 @@ dependencies = [ [[package]] name = "sc-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "bytes", @@ -11592,7 +11592,7 @@ dependencies = [ [[package]] name = "sc-peerset" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "libp2p", @@ -11605,7 +11605,7 @@ dependencies = [ [[package]] name = "sc-proposer-metrics" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "substrate-prometheus-endpoint", @@ -11614,7 +11614,7 @@ dependencies = [ [[package]] name = "sc-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "jsonrpsee", @@ -11645,7 +11645,7 @@ dependencies = [ [[package]] name = "sc-rpc-api" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11664,7 +11664,7 @@ dependencies = [ [[package]] name = "sc-rpc-server" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "http", "jsonrpsee", @@ -11679,7 +11679,7 @@ dependencies = [ [[package]] name = "sc-rpc-spec-v2" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "futures", @@ -11705,7 +11705,7 @@ dependencies = [ [[package]] name = "sc-service" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "directories", @@ -11771,7 +11771,7 @@ dependencies = [ [[package]] name = "sc-state-db" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "parity-scale-codec", @@ -11782,7 +11782,7 @@ dependencies = [ [[package]] name = "sc-storage-monitor" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "clap 4.2.7", "fs4", @@ -11798,7 +11798,7 @@ dependencies = [ [[package]] name = "sc-sync-state-rpc" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -11817,7 +11817,7 @@ dependencies = [ [[package]] name = "sc-sysinfo" version = "6.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "libc", @@ -11836,7 +11836,7 @@ dependencies = [ [[package]] name = "sc-telemetry" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "chrono", "futures", @@ -11855,7 +11855,7 @@ dependencies = [ [[package]] name = "sc-tracing" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ansi_term", "atty", @@ -11886,7 +11886,7 @@ dependencies = [ [[package]] name = "sc-tracing-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -11897,7 +11897,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11924,7 +11924,7 @@ dependencies = [ [[package]] name = "sc-transaction-pool-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -11938,7 +11938,7 @@ dependencies = [ [[package]] name = "sc-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-channel", "futures", @@ -12496,7 +12496,7 @@ dependencies = [ [[package]] name = "sp-api" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "log", @@ -12516,7 +12516,7 @@ dependencies = [ [[package]] name = "sp-api-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "blake2", @@ -12530,7 +12530,7 @@ dependencies = [ [[package]] name = "sp-application-crypto" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12543,7 +12543,7 @@ dependencies = [ [[package]] name = "sp-arithmetic" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "integer-sqrt", "num-traits", @@ -12557,7 +12557,7 @@ dependencies = [ [[package]] name = "sp-authority-discovery" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12570,7 +12570,7 @@ dependencies = [ [[package]] name = "sp-block-builder" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-api", @@ -12582,7 +12582,7 @@ dependencies = [ [[package]] name = "sp-blockchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "log", @@ -12600,7 +12600,7 @@ dependencies = [ [[package]] name = "sp-consensus" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures", @@ -12615,7 +12615,7 @@ dependencies = [ [[package]] name = "sp-consensus-aura" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "parity-scale-codec", @@ -12633,7 +12633,7 @@ dependencies = [ [[package]] name = "sp-consensus-babe" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "parity-scale-codec", @@ -12654,7 +12654,7 @@ dependencies = [ [[package]] name = "sp-consensus-beefy" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "lazy_static", "parity-scale-codec", @@ -12673,7 +12673,7 @@ dependencies = [ [[package]] name = "sp-consensus-grandpa" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "finality-grandpa", "log", @@ -12691,7 +12691,7 @@ dependencies = [ [[package]] name = "sp-consensus-slots" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12703,7 +12703,7 @@ dependencies = [ [[package]] name = "sp-core" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "bitflags", @@ -12747,7 +12747,7 @@ dependencies = [ [[package]] name = "sp-core-hashing" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "blake2b_simd", "byteorder", @@ -12761,7 +12761,7 @@ dependencies = [ [[package]] name = "sp-core-hashing-proc-macro" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -12772,7 +12772,7 @@ dependencies = [ [[package]] name = "sp-database" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "kvdb", "parking_lot 0.12.1", @@ -12781,7 +12781,7 @@ dependencies = [ [[package]] name = "sp-debug-derive" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro2", "quote", @@ -12791,7 +12791,7 @@ dependencies = [ [[package]] name = "sp-externalities" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "environmental", "parity-scale-codec", @@ -12802,7 +12802,7 @@ dependencies = [ [[package]] name = "sp-inherents" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "impl-trait-for-tuples", @@ -12817,7 +12817,7 @@ dependencies = [ [[package]] name = "sp-io" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bytes", "ed25519", @@ -12843,7 +12843,7 @@ dependencies = [ [[package]] name = "sp-keyring" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "lazy_static", "sp-core", @@ -12854,7 +12854,7 @@ dependencies = [ [[package]] name = "sp-keystore" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "parity-scale-codec", @@ -12868,7 +12868,7 @@ dependencies = [ [[package]] name = "sp-maybe-compressed-blob" version = "4.1.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "thiserror", "zstd 0.12.3+zstd.1.5.2", @@ -12877,7 +12877,7 @@ dependencies = [ [[package]] name = "sp-metadata-ir" version = "0.1.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-metadata", "parity-scale-codec", @@ -12888,7 +12888,7 @@ dependencies = [ [[package]] name = "sp-mmr-primitives" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ckb-merkle-mountain-range", "log", @@ -12906,7 +12906,7 @@ dependencies = [ [[package]] name = "sp-npos-elections" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -12920,7 +12920,7 @@ dependencies = [ [[package]] name = "sp-offchain" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "sp-api", "sp-core", @@ -12930,7 +12930,7 @@ dependencies = [ [[package]] name = "sp-panic-handler" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "backtrace", "lazy_static", @@ -12940,7 +12940,7 @@ dependencies = [ [[package]] name = "sp-rpc" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "rustc-hash", "serde", @@ -12950,7 +12950,7 @@ dependencies = [ [[package]] name = "sp-runtime" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "either", "hash256-std-hasher", @@ -12972,7 +12972,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "bytes", "impl-trait-for-tuples", @@ -12990,7 +12990,7 @@ dependencies = [ [[package]] name = "sp-runtime-interface-proc-macro" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "Inflector", "proc-macro-crate", @@ -13002,7 +13002,7 @@ dependencies = [ [[package]] name = "sp-serializer" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "serde", "serde_json", @@ -13011,7 +13011,7 @@ dependencies = [ [[package]] name = "sp-session" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -13025,7 +13025,7 @@ dependencies = [ [[package]] name = "sp-staking" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -13038,7 +13038,7 @@ dependencies = [ [[package]] name = "sp-state-machine" version = "0.13.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hash-db", "log", @@ -13058,7 +13058,7 @@ dependencies = [ [[package]] name = "sp-statement-store" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "log", "parity-scale-codec", @@ -13076,12 +13076,12 @@ dependencies = [ [[package]] name = "sp-std" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" [[package]] name = "sp-storage" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13094,7 +13094,7 @@ dependencies = [ [[package]] name = "sp-timestamp" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "futures-timer", @@ -13109,7 +13109,7 @@ dependencies = [ [[package]] name = "sp-tracing" version = "6.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "sp-std", @@ -13121,7 +13121,7 @@ dependencies = [ [[package]] name = "sp-transaction-pool" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "sp-api", "sp-runtime", @@ -13130,7 +13130,7 @@ dependencies = [ [[package]] name = "sp-transaction-storage-proof" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "log", @@ -13146,7 +13146,7 @@ dependencies = [ [[package]] name = "sp-trie" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ahash 0.8.2", "hash-db", @@ -13169,7 +13169,7 @@ dependencies = [ [[package]] name = "sp-version" version = "5.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "impl-serde", "parity-scale-codec", @@ -13186,7 +13186,7 @@ dependencies = [ [[package]] name = "sp-version-proc-macro" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "proc-macro2", @@ -13197,7 +13197,7 @@ dependencies = [ [[package]] name = "sp-wasm-interface" version = "7.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "anyhow", "impl-trait-for-tuples", @@ -13211,7 +13211,7 @@ dependencies = [ [[package]] name = "sp-weights" version = "4.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "parity-scale-codec", "scale-info", @@ -13546,7 +13546,7 @@ dependencies = [ [[package]] name = "substrate-build-script-utils" version = "3.0.0" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "platforms 2.0.0", ] @@ -13554,7 +13554,7 @@ dependencies = [ [[package]] name = "substrate-frame-rpc-system" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "frame-system-rpc-runtime-api", "futures", @@ -13573,7 +13573,7 @@ dependencies = [ [[package]] name = "substrate-prometheus-endpoint" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "hyper", "log", @@ -13585,7 +13585,7 @@ dependencies = [ [[package]] name = "substrate-rpc-client" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "jsonrpsee", @@ -13598,7 +13598,7 @@ dependencies = [ [[package]] name = "substrate-state-trie-migration-rpc" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "jsonrpsee", "log", @@ -13617,7 +13617,7 @@ dependencies = [ [[package]] name = "substrate-test-client" version = "2.0.1" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "array-bytes 4.2.0", "async-trait", @@ -13643,7 +13643,7 @@ dependencies = [ [[package]] name = "substrate-test-utils" version = "4.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "futures", "substrate-test-utils-derive", @@ -13653,7 +13653,7 @@ dependencies = [ [[package]] name = "substrate-test-utils-derive" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -13664,7 +13664,7 @@ dependencies = [ [[package]] name = "substrate-wasm-builder" version = "5.0.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "ansi_term", "build-helper", @@ -14318,7 +14318,7 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "try-runtime-cli" version = "0.10.0-dev" -source = "git+https://github.com/paritytech/substrate?branch=master#529e24ab7762f6d225aa383902cd6886cff20989" +source = "git+https://github.com/paritytech/substrate?branch=master#cf1fb8953c8aa2ca9bb2197fae40c31e10bcf45f" dependencies = [ "async-trait", "clap 4.2.7", diff --git a/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs b/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs index 94957ff84fa..29a01e5bb9a 100644 --- a/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/statemine/src/weights/pallet_assets.rs @@ -441,4 +441,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs b/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs index 933dcb4d3af..d7f390194af 100644 --- a/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/statemint/src/weights/pallet_assets.rs @@ -447,4 +447,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } diff --git a/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs b/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs index f08633cd2ba..75518b3ef41 100644 --- a/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs +++ b/parachains/runtimes/assets/westmint/src/weights/pallet_assets.rs @@ -443,4 +443,73 @@ impl pallet_assets::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn touch() -> Weight { + // Proof Size summary in bytes: + // Measured: `453` + // Estimated: `3675` + // Minimum execution time: 37_468_000 picoseconds. + Weight::from_parts(37_957_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn touch_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `351` + // Estimated: `3675` + // Minimum execution time: 383_408_000 picoseconds. + Weight::from_parts(392_036_000, 3675) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: System Account (r:1 w:1) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn refund() -> Weight { + // Proof Size summary in bytes: + // Measured: `579` + // Estimated: `3675` + // Minimum execution time: 34_066_000 picoseconds. + Weight::from_parts(34_347_000, 3675) + .saturating_add(T::DbWeight::get().reads(3_u64)) + .saturating_add(T::DbWeight::get().writes(3_u64)) + } + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + /// Storage: Assets Asset (r:1 w:1) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + fn refund_other() -> Weight { + // Proof Size summary in bytes: + // Measured: `510` + // Estimated: `3675` + // Minimum execution time: 32_060_000 picoseconds. + Weight::from_parts(32_519_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// Storage: Assets Asset (r:1 w:0) + /// Proof: Assets Asset (max_values: None, max_size: Some(210), added: 2685, mode: MaxEncodedLen) + /// Storage: Assets Account (r:1 w:1) + /// Proof: Assets Account (max_values: None, max_size: Some(134), added: 2609, mode: MaxEncodedLen) + fn block() -> Weight { + // Proof Size summary in bytes: + // Measured: `459` + // Estimated: `3675` + // Minimum execution time: 115_000_000 picoseconds. + Weight::from_parts(163_000_000, 3675) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } } From 97984e44bbb70c1da3a10d75893cda3bc4fd9111 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 8 May 2023 17:20:20 +0200 Subject: [PATCH 38/60] Prevent name clash with Substrate Pallet Template (#2536) * Remove cumulus template pallet Signed-off-by: Oliver Tale-Yazdi * Use substrate template pallet Signed-off-by: Oliver Tale-Yazdi * Update Cargo.lock Signed-off-by: Oliver Tale-Yazdi * Revert back to master Revert "Remove cumulus template pallet" This reverts commit a6d3566e52e9124c0e9823c12cacea557187c6b4. Revert "Use substrate template pallet" This reverts commit fbb8eea28dec5b75e13823762572d24bd9a4b88f. Revert "Update Cargo.lock" This reverts commit ee24cb81e5d91d6b8f7ef0c97d0f0fdbfe857c53. Signed-off-by: Oliver Tale-Yazdi * pallet-template -> pallet-parachain-template Signed-off-by: Oliver Tale-Yazdi * Update Cargo.lock Signed-off-by: Oliver Tale-Yazdi --------- Signed-off-by: Oliver Tale-Yazdi --- Cargo.lock | 32 +++++++++---------- .../pallets/template/Cargo.toml | 2 +- .../pallets/template/src/benchmarking.rs | 2 +- .../pallets/template/src/mock.rs | 5 ++- parachain-template/runtime/Cargo.toml | 8 ++--- parachain-template/runtime/src/lib.rs | 6 ++-- 6 files changed, 27 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d46e0c76000..9358d81a038 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7339,6 +7339,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-parachain-template" +version = "0.1.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", +] + [[package]] name = "pallet-preimage" version = "4.0.0-dev" @@ -7574,21 +7589,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "pallet-template" -version = "0.1.0" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", -] - [[package]] name = "pallet-timestamp" version = "4.0.0-dev" @@ -7879,9 +7879,9 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-collator-selection", + "pallet-parachain-template", "pallet-session", "pallet-sudo", - "pallet-template", "pallet-timestamp", "pallet-transaction-payment", "pallet-transaction-payment-rpc-runtime-api", diff --git a/parachain-template/pallets/template/Cargo.toml b/parachain-template/pallets/template/Cargo.toml index ca574f6c8d5..f47d82c9798 100644 --- a/parachain-template/pallets/template/Cargo.toml +++ b/parachain-template/pallets/template/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pallet-template" +name = "pallet-parachain-template" authors = ["Anonymous"] description = "FRAME pallet template for defining custom runtime logic." version = "0.1.0" diff --git a/parachain-template/pallets/template/src/benchmarking.rs b/parachain-template/pallets/template/src/benchmarking.rs index fea9e65969b..8bba2a09867 100644 --- a/parachain-template/pallets/template/src/benchmarking.rs +++ b/parachain-template/pallets/template/src/benchmarking.rs @@ -1,4 +1,4 @@ -//! Benchmarking setup for pallet-template +//! Benchmarking setup for pallet-parachain-template use super::*; diff --git a/parachain-template/pallets/template/src/mock.rs b/parachain-template/pallets/template/src/mock.rs index 4a7ebac0fa8..099c0af8acd 100644 --- a/parachain-template/pallets/template/src/mock.rs +++ b/parachain-template/pallets/template/src/mock.rs @@ -1,4 +1,3 @@ -use crate as pallet_template; use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; @@ -18,7 +17,7 @@ frame_support::construct_runtime!( UncheckedExtrinsic = UncheckedExtrinsic, { System: frame_system::{Pallet, Call, Config, Storage, Event}, - TemplateModule: pallet_template::{Pallet, Call, Storage, Event}, + TemplateModule: crate::{Pallet, Call, Storage, Event}, } ); @@ -54,7 +53,7 @@ impl system::Config for Test { type MaxConsumers = frame_support::traits::ConstU32<16>; } -impl pallet_template::Config for Test { +impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; } diff --git a/parachain-template/runtime/Cargo.toml b/parachain-template/runtime/Cargo.toml index 81a4cf811a8..fefaffb032c 100644 --- a/parachain-template/runtime/Cargo.toml +++ b/parachain-template/runtime/Cargo.toml @@ -22,7 +22,7 @@ scale-info = { version = "2.6.0", default-features = false, features = ["derive" smallvec = "1.10.0" # Local -pallet-template = { path = "../pallets/template", default-features = false } +pallet-parachain-template = { path = "../pallets/template", default-features = false } # Substrate frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true, branch = "master" } @@ -99,7 +99,7 @@ std = [ "pallet-collator-selection/std", "pallet-session/std", "pallet-sudo/std", - "pallet-template/std", + "pallet-parachain-template/std", "pallet-timestamp/std", "pallet-transaction-payment-rpc-runtime-api/std", "pallet-transaction-payment/std", @@ -132,7 +132,7 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", - "pallet-template/runtime-benchmarks", + "pallet-parachain-template/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", @@ -156,7 +156,7 @@ try-runtime = [ "pallet-collator-selection/try-runtime", "pallet-session/try-runtime", "pallet-sudo/try-runtime", - "pallet-template/try-runtime", + "pallet-parachain-template/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-xcm/try-runtime", diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 3c24b39d64d..7a847fc5118 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -58,7 +58,7 @@ use xcm::latest::prelude::BodyId; use xcm_executor::XcmExecutor; /// Import the template pallet. -pub use pallet_template; +pub use pallet_parachain_template; /// Alias to 512-bit hash when used in the context of a transaction signature on the chain. pub type Signature = MultiSignature; @@ -457,7 +457,7 @@ impl pallet_collator_selection::Config for Runtime { } /// Configure the pallet template in pallets/template. -impl pallet_template::Config for Runtime { +impl pallet_parachain_template::Config for Runtime { type RuntimeEvent = RuntimeEvent; } @@ -492,7 +492,7 @@ construct_runtime!( DmpQueue: cumulus_pallet_dmp_queue = 33, // Template - TemplatePallet: pallet_template = 40, + TemplatePallet: pallet_parachain_template = 40, } ); From b65e0271587559d3e47c21609c7ffe7b25bcee55 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Mon, 8 May 2023 17:54:41 +0200 Subject: [PATCH 39/60] added sovereign and balances helpers --- .../xcm-emulator/assets/statemint/src/lib.rs | 13 +- .../assets/statemint/tests/mod.rs | 2 +- .../assets/statemint/tests/teleport.rs | 94 ++++++++ .../assets/statemint/tests/teleports.rs | 225 ------------------ .../assets/statemint/tests/transact.rs | 83 +++++++ .../xcm-emulator/common/src/lib.rs | 185 +++----------- xcm/xcm-emulator/src/lib.rs | 70 +++++- 7 files changed, 292 insertions(+), 380 deletions(-) create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs delete mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs index 7493b71f9f4..0f1fa813506 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -1,10 +1,19 @@ +pub use frame_support::{ + assert_ok, +}; +pub use polkadot_core_primitives::InboundDownwardMessage; +pub use xcm::prelude::*; +pub use xcm::v3::NetworkId::{Polkadot as PolkadotId, Kusama as KusamaId}; +// pub use statemint_runtime::constants::currency::{DOLLARS as STATEMINT_DOLLARS}; +pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx}; pub use integration_tests_common::{ AccountId, - PolkadotMockNet, KusamaMockNet, PolkadotRelay, KusamaRelay, Statemint, Statemine, PenpalPolkadot, PenpalKusama, + PolkadotMockNet, KusamaMockNet, Polkadot, Kusama, Statemint, Statemine, PenpalPolkadot, PenpalKusama, PolkadotSender, PolkadotReceiver, KusamaSender, KusamaReceiver, StatemintSender, StatemintReceiver, StatemineSender, StatemineReceiver, PenpalPolkadotSender, PenpalPolkadotReceiver, PenpalKusamaSender, PenpalKusamaReceiver, - constants::accounts::{ALICE, BOB}, + constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}}, }; + #[cfg(test)] mod tests {} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs index baa4880e2dc..33b71a24075 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs @@ -1 +1 @@ -pub mod teleports; +pub mod teleport; diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs new file mode 100644 index 00000000000..ecb4b11b4d6 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -0,0 +1,94 @@ +use statemint_it::*; + +#[test] +// NOTE: This needs to be run before every other test to ensure that chains can communicate with one +// another. +pub fn force_xcm_version() { + let xcm_version = 3; + Polkadot::execute_with(|| { + let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); + let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); + + // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. + for location in [statemint_location, penpal_location] { + assert_ok!(::XcmPallet::force_xcm_version( + ::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + assert!(::System::events().iter().any(|r| matches!( + r.event, + polkadot_runtime::RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + } + }); + + // PenpalPolkadot forces Polkadot xcm version. + PenpalPolkadot::execute_with(|| { + let location: MultiLocation = (Parent).into(); + + assert_ok!(::XcmPallet::force_xcm_version( + penpal_runtime::RuntimeOrigin::root(), + Box::new(location), + xcm_version, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert!(::System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { + 0: loc, + 1: ver, + }) if loc == location && ver == xcm_version + ))); + }); +} + +#[test] +fn teleport_native_assets_from_relay_to_assets_para() { + let amount = POLKADOT_ED * 1000; + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + + Polkadot::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + + assert_ok!(::XcmPallet::limited_teleport_assets( + RuntimeOrigin::signed(PolkadotSender::get()), + bx!( + (Ancestor(0), Parachain(Statemint::para_id().into())).into() + ), + bx!( + AccountId32 { network: None, id: Statemint::account_id_of(BOB).into()}.into()) + , + bx!(native_assets), + 0, + WeightLimit::Unlimited, + )); + assert!(::System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) + ))); + }); + + Statemint::execute_with(|| { + use statemint_runtime::{Runtime, RuntimeEvent, System}; + // assert!(System::events().iter().any(|r| matches!( + // &r.event, + // RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) + // if *who == Statemint::account_id_of(BOB).into() + // ))); + }); + + // let (relay_balance_after, ap_balance_after) = get_balances(); + let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; + + // assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + // assert!(para_sender_balance_after > para_receiver_balance_before); +} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs deleted file mode 100644 index 87057766040..00000000000 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleports.rs +++ /dev/null @@ -1,225 +0,0 @@ -// use crate::PolkadotMockNet; -use statemint_it::*; -use frame_support::{ - assert_ok, - instances::Instance1, - pallet_prelude::Hooks, - sp_io, sp_tracing, - traits::{fungibles::Inspect, GenesisBuild}, -}; - -use codec::Encode; -use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_core::parameter_types; -use statemint_runtime::constants::currency::DOLLARS; -use xcm::prelude::*; -use xcm_emulator::{TestExt, Parachain as Para, RelayChain as Relay}; - -use xcm_executor::traits::Convert; -use xcm::latest::Error; -use xcm_emulator::{cumulus_pallet_dmp_queue, bx}; -use parachains_common::Balance; -use polkadot_core_primitives::InboundDownwardMessage; -use polkadot_parachain::primitives::DmpMessageHandler; -use sp_weights::Weight; -use xcm::{ - latest::{Ancestor, MultiLocation}, - prelude::{AccountId32, Here, Parachain}, - v3::Outcome, - VersionedMultiAssets, -}; - -// use integration_tests_common::{AccountId, PolkadotMockNet, Polkadot, Statemint, PenpalPolkadot, constants::accounts::{ALICE, BOB}}; - -pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; - -pub type RelayChainPalletXcm = pallet_xcm::Pallet; -pub type StatemintPalletXcm = pallet_xcm::Pallet; -pub type PenpalPolkadotPalletXcm = pallet_xcm::Pallet; - - -#[test] -// NOTE: This needs to be run before every other test to ensure that chains can communicate with one -// another. -fn force_xcm_version() { - let xcm_version = 3; - PolkadotRelay::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, System}; - - let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); - let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); - - // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. - for location in [statemint_location, penpal_location] { - assert_ok!(RelayChainPalletXcm::force_xcm_version( - polkadot_runtime::RuntimeOrigin::root(), - Box::new(location), - xcm_version, - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - } - }); - - // PenpalPolkadot forces Polkadot xcm version. - PenpalPolkadot::execute_with(|| { - use penpal_runtime::{RuntimeEvent, System}; - - let location: MultiLocation = (Parent).into(); - - assert_ok!(PenpalPolkadotPalletXcm::force_xcm_version( - penpal_runtime::RuntimeOrigin::root(), - Box::new(location), - xcm_version, - )); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - }); -} - -// Direct message passing tests. - -// use super::*; - - -#[test] -fn teleport_native_assets_relay_to_assets_para() { - force_xcm_version(); - // const LALA: AccountId = Polkadot::account_id_of(ALICE); - let amount = 1000_000_000; - let assets: VersionedMultiAssets = (Here, amount).into(); - let relay_sender_balance_before = PolkadotRelay::account_data_of(PolkadotSender::get()).free; - let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; - - let mut messages: Vec = Vec::new(); - - PolkadotRelay::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - - assert_ok!(RelayChainPalletXcm::limited_teleport_assets( - RuntimeOrigin::signed(PolkadotSender::get()), - bx!( - (Ancestor(0), Parachain(Statemint::para_id().into())).into() - ), - bx!( - AccountId32 { network: None, id: Statemint::account_id_of(BOB).into()}.into()) - , - bx!(assets), - 0, - WeightLimit::Unlimited, - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) - ))); - }); - - Statemint::execute_with(|| { - use statemint_runtime::{Runtime, RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) - if *who == Statemint::account_id_of(BOB).into() - ))); - }); - - // let (relay_balance_after, ap_balance_after) = get_balances(); - let relay_sender_balance_after = PolkadotRelay::account_data_of(PolkadotSender::get()).free; - let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; - - assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); - assert!(para_sender_balance_after > para_receiver_balance_before); -} - -// #[test] -// fn transact_sudo_relay_to_assets_para_works() { -// force_xcm_version(); - -// Polkadot::execute_with(|| { -// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - -// let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< -// statemint_runtime::Runtime, -// Instance1, -// >::force_create { -// id: 1.into(), -// is_sufficient: true, -// min_balance: 1000, -// owner: ALICE.into(), -// }); -// let xcm = Xcm(vec![ -// UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, -// Transact { -// require_weight_at_most: Weight::from_parts(1000000000, 200000), -// origin_kind: OriginKind::Superuser, -// call: call.encode().into(), -// }, -// ]); -// assert_ok!(RelayChainPalletXcm::send( -// RuntimeOrigin::root(), -// Box::new(AP_DEST.into()), -// Box::new(VersionedXcm::from(xcm)), -// )); -// assert!(System::events().iter().any(|r| matches!( -// r.event, -// RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) -// ))); -// }); - -// Statemint::execute_with(|| { -// assert!(statemint_runtime::Assets::asset_exists(1)); -// }); -// } - -// #[test] -// fn reserved_transfer_native_relay_to_assets_para_fails() { -// force_xcm_version(); -// let (relay_balance, ap_balance) = get_balances(); -// let amount = 1000_000_000; -// let assets: VersionedMultiAssets = (Here, amount).into(); - -// Polkadot::execute_with(|| { -// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - -// assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( -// RuntimeOrigin::signed(ALICE.into()), -// Box::new(AP_DEST.into()), -// Box::new(get_benf().into()), -// Box::new(assets), -// 0, -// WeightLimit::Unlimited, -// )); - -// assert!(System::events().iter().any(|r| matches!( -// r.event, -// RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) -// ))); -// }); - -// Statemint::execute_with(|| { -// use statemint_runtime::{RuntimeEvent, System}; - -// assert!(System::events().iter().any(|r| matches!( -// r.event, -// RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { -// outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), -// .. -// }) -// ))); -// }); - -// let (relay_balance_after, ap_balance_after) = get_balances(); -// assert_eq!(relay_balance - amount, relay_balance_after); -// assert_eq!(ap_balance_after, ap_balance); -// } diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs new file mode 100644 index 00000000000..6c141a7291f --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs @@ -0,0 +1,83 @@ +// use statemint_it::*; + +// #[test] +// fn transact_sudo_relay_to_assets_para_works() { +// force_xcm_version(); + +// Polkadot::execute_with(|| { +// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + +// let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< +// statemint_runtime::Runtime, +// Instance1, +// >::force_create { +// id: 1.into(), +// is_sufficient: true, +// min_balance: 1000, +// owner: ALICE.into(), +// }); +// let xcm = Xcm(vec![ +// UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, +// Transact { +// require_weight_at_most: Weight::from_parts(1000000000, 200000), +// origin_kind: OriginKind::Superuser, +// call: call.encode().into(), +// }, +// ]); +// assert_ok!(RelayChainPalletXcm::send( +// RuntimeOrigin::root(), +// Box::new(AP_DEST.into()), +// Box::new(VersionedXcm::from(xcm)), +// )); +// assert!(System::events().iter().any(|r| matches!( +// r.event, +// RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) +// ))); +// }); + +// Statemint::execute_with(|| { +// assert!(statemint_runtime::Assets::asset_exists(1)); +// }); +// } + +// #[test] +// fn reserved_transfer_native_relay_to_assets_para_fails() { +// force_xcm_version(); +// let (relay_balance, ap_balance) = get_balances(); +// let amount = 1000_000_000; +// let assets: VersionedMultiAssets = (Here, amount).into(); + +// Polkadot::execute_with(|| { +// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; + +// assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( +// RuntimeOrigin::signed(ALICE.into()), +// Box::new(AP_DEST.into()), +// Box::new(get_benf().into()), +// Box::new(assets), +// 0, +// WeightLimit::Unlimited, +// )); + +// assert!(System::events().iter().any(|r| matches!( +// r.event, +// RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) +// ))); +// }); + +// Statemint::execute_with(|| { +// use statemint_runtime::{RuntimeEvent, System}; + +// assert!(System::events().iter().any(|r| matches!( +// r.event, +// RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { +// outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), +// .. +// }) +// ))); +// }); + +// let (relay_balance_after, ap_balance_after) = get_balances(); +// assert_eq!(relay_balance - amount, relay_balance_after); +// assert_eq!(ap_balance_after, ap_balance); +// } diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 468a40d69ac..09fae8339b6 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -1,37 +1,39 @@ pub mod constants; use frame_support::{ - assert_ok, - instances::Instance1, - pallet_prelude::Hooks, sp_io, sp_tracing, - traits::{fungibles::Inspect, GenesisBuild}, parameter_types }; use xcm::prelude::*; use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, RelayChain, Parachain}; -use polkadot_runtime_parachains::configuration::HostConfiguration; use xcm_executor::traits::Convert; use statemint_runtime::constants::currency::DOLLARS; pub use constants::{polkadot, kusama, statemint, statemine, penpal, accounts::{ALICE, BOB}}; -use sp_runtime::BuildStorage; pub use sp_core::{Get, sr25519, storage::Storage}; -use parachain_info::pallet::Pallet; -// pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; decl_test_relay_chains! { - pub struct PolkadotRelay { + pub struct Polkadot { Runtime = polkadot_runtime::Runtime, + RuntimeOrigin = polkadot_runtime::RuntimeOrigin, + RuntimeEvent = polkadot_runtime::RuntimeEvent, XcmConfig = polkadot_runtime::xcm_config::XcmConfig, System = polkadot_runtime::System, + XcmPallet = polkadot_runtime::XcmPallet, + Balances = polkadot_runtime::Balances, + SovereignAccountOf = polkadot_runtime::xcm_config::SovereignAccountOf, genesis = polkadot::genesis(), on_init = (), }, - pub struct KusamaRelay { + pub struct Kusama { Runtime = kusama_runtime::Runtime, + RuntimeOrigin = kusama_runtime::RuntimeOrigin, + RuntimeEvent = kusama_runtime::RuntimeEvent, XcmConfig = kusama_runtime::xcm_config::XcmConfig, System = kusama_runtime::System, + XcmPallet = kusama_runtime::XcmPallet, + Balances = kusama_runtime::Balances, + SovereignAccountOf = kusama_runtime::xcm_config::SovereignAccountOf, genesis = kusama::genesis(), on_init = (), } @@ -42,22 +44,30 @@ decl_test_parachains! { pub struct Statemint { Runtime = statemint_runtime::Runtime, RuntimeOrigin = statemint_runtime::RuntimeOrigin, + RuntimeEvent = statemint_runtime::RuntimeEvent, XcmpMessageHandler = statemint_runtime::XcmpQueue, DmpMessageHandler = statemint_runtime::DmpQueue, System = statemint_runtime::System, ParachainSystem = statemint_runtime::ParachainSystem, ParachainInfo = statemint_runtime::ParachainInfo, + XcmPallet = statemint_runtime::PolkadotXcm, + Balances = statemint_runtime::Balances, + LocationToAccountId = statemint_runtime::xcm_config::LocationToAccountId, genesis = statemint::genesis(), on_init = (), }, pub struct PenpalPolkadot { Runtime = penpal_runtime::Runtime, RuntimeOrigin = penpal_runtime::RuntimeOrigin, + RuntimeEvent = penpal_runtime::RuntimeEvent, XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, ParachainSystem = penpal_runtime::ParachainSystem, ParachainInfo = penpal_runtime::ParachainInfo, + XcmPallet = penpal_runtime::PolkadotXcm, + Balances = penpal_runtime::Balances, + LocationToAccountId = penpal_runtime::xcm_config::LocationToAccountId, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), }, @@ -65,22 +75,30 @@ decl_test_parachains! { pub struct Statemine { Runtime = statemine_runtime::Runtime, RuntimeOrigin = statemine_runtime::RuntimeOrigin, + RuntimeEvent = statemine_runtime::RuntimeEvent, XcmpMessageHandler = statemine_runtime::XcmpQueue, DmpMessageHandler = statemine_runtime::DmpQueue, System = statemine_runtime::System, ParachainSystem = statemine_runtime::ParachainSystem, ParachainInfo = statemine_runtime::ParachainInfo, + XcmPallet = statemine_runtime::PolkadotXcm, + Balances = statemine_runtime::Balances, + LocationToAccountId = statemine_runtime::xcm_config::LocationToAccountId, genesis = statemine::genesis(), on_init = (), }, pub struct PenpalKusama { Runtime = penpal_runtime::Runtime, RuntimeOrigin = penpal_runtime::RuntimeOrigin, + RuntimeEvent = penpal_runtime::RuntimeEvent, XcmpMessageHandler = penpal_runtime::XcmpQueue, DmpMessageHandler = penpal_runtime::DmpQueue, System = penpal_runtime::System, ParachainSystem = penpal_runtime::ParachainSystem, ParachainInfo = penpal_runtime::ParachainInfo, + XcmPallet = penpal_runtime::PolkadotXcm, + Balances = penpal_runtime::Balances, + LocationToAccountId = penpal_runtime::xcm_config::LocationToAccountId, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), } @@ -88,14 +106,14 @@ decl_test_parachains! { decl_test_networks! { pub struct PolkadotMockNet { - relay_chain = PolkadotRelay, + relay_chain = Polkadot, parachains = vec![ Statemint, PenpalPolkadot, ], }, pub struct KusamaMockNet { - relay_chain = KusamaRelay, + relay_chain = Kusama, parachains = vec![ Statemine, PenpalKusama, @@ -103,17 +121,13 @@ decl_test_networks! { } } -// pub fn on_init() { -// polkadot_runtime::System::set_block_number(1); -// } - parameter_types! { // Polkadot - pub PolkadotSender: AccountId = PolkadotRelay::account_id_of(ALICE); - pub PolkadotReceiver: AccountId = PolkadotRelay::account_id_of(BOB); + pub PolkadotSender: AccountId = Polkadot::account_id_of(ALICE); + pub PolkadotReceiver: AccountId = Polkadot::account_id_of(BOB); // Kusama - pub KusamaSender: AccountId = KusamaRelay::account_id_of(ALICE); - pub KusamaReceiver: AccountId = KusamaRelay::account_id_of(BOB); + pub KusamaSender: AccountId = Kusama::account_id_of(ALICE); + pub KusamaReceiver: AccountId = Kusama::account_id_of(BOB); // Statemint pub StatemintSender: AccountId = Statemint::account_id_of(ALICE); pub StatemintReceiver: AccountId = Statemint::account_id_of(BOB); @@ -143,136 +157,13 @@ pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() } -// pub fn relay_ext() -> sp_io::TestExternalities { -// use polkadot_runtime::{Runtime, RuntimeOrigin, System}; - -// // ::XcmSender = RelayChainXcmRouter; -// // ::XcmRouter = RelayChainXcmRouter; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// polkadot_runtime_parachains::configuration::GenesisConfig:: { -// config: polkadot::get_host_config(), -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![ -// (ALICE, INITIAL_BALANCE), -// (child_account_id(1000), INITIAL_BALANCE), -// (child_account_id(2000), INITIAL_BALANCE), -// ], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// System::set_block_number(1); -// }); -// ext -// } - -// pub fn polkadot_storage() -> Storage { -// use polkadot_runtime::{Runtime}; -// let mut t = polkadot::genesis(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![ -// (ALICE, INITIAL_BALANCE), -// (child_account_id(1000), INITIAL_BALANCE), -// (child_account_id(2000), INITIAL_BALANCE), -// ], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// t -// } - -// pub fn statemint_storage() -> Storage { -// use statemint_runtime::{Runtime}; -// let mut t = statemint::genesis(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// t -// } -// // Define Statemint TestExternalities. -// pub fn statemint_ext() -> sp_io::TestExternalities { -// use statemint_runtime::{Runtime, System}; - -// let mut t = statemint::genesis().build_storage().unwrap(); - -// // let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// sp_tracing::try_init_simple(); -// System::set_block_number(1); -// }); -// ext -// } - -// // Define Statemine TestExternalities. -// pub fn statemine_ext() -> sp_io::TestExternalities { -// use statemine_runtime::{Runtime, System}; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// sp_tracing::try_init_simple(); -// System::set_block_number(1); -// }); -// ext -// } - -// // Define Penpal TestExternalities. -// pub fn penpal_ext() -> sp_io::TestExternalities { -// use penpal_runtime::{Runtime, System}; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// sp_tracing::try_init_simple(); -// System::set_block_number(1); -// }); -// ext -// } - -// mod accounts { -// pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); -// pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); -// } - pub mod helpers { use super::*; // pub fn account_id_of(seed: &str) -> AccountId { // get_account_id_from_seed::(seed) // } + + // pub fn fund_accounts(accounts: (AccountId, Balance)) { + + // } } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index a0fa0440a25..35a4ebfe246 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -86,18 +86,27 @@ pub trait TestExt { pub trait RelayChain: TestExt + UmpSink { type Runtime; + type RuntimeOrigin; + type RuntimeEvent; type XcmConfig; type System; + type XcmPallet; + type Balances; + type SovereignAccountOf; } pub trait Parachain: TestExt + XcmpMessageHandler + DmpMessageHandler { type Runtime; - type Origin; + type RuntimeOrigin; + type RuntimeEvent; type XcmpMessageHandler; type DmpMessageHandler; type System; type ParachainSystem; type ParachainInfo; + type XcmPallet; + type Balances; + type LocationToAccountId; } // Relay Chain Implementation @@ -107,8 +116,13 @@ macro_rules! decl_test_relay_chains { $( pub struct $name:ident { Runtime = $runtime:path, + RuntimeOrigin = $runtime_origin:path, + RuntimeEvent = $runtime_event:path, XcmConfig = $xcm_config:path, System = $system:path, + XcmPallet = $xcm_pallet:path, + Balances = $balances_pallet:path, + SovereignAccountOf = $sovereign_account_of:path, genesis = $genesis:expr, on_init = $on_init:expr, } @@ -120,8 +134,14 @@ macro_rules! decl_test_relay_chains { impl RelayChain for $name { type Runtime = $runtime; + type RuntimeOrigin = $runtime_origin; + type RuntimeEvent = $runtime_event; type XcmConfig = $xcm_config; type System = $system; + type XcmPallet = $xcm_pallet; + type Balances = $balances_pallet; + type SovereignAccountOf = $sovereign_account_of; + } $crate::__impl_xcm_handlers_for_relay_chain!($name); @@ -256,6 +276,22 @@ macro_rules! __impl_relay { Self::ext_wrapper(|| ::System::account(account).data) } + pub fn sovereign_account_id_of(location: $crate::MultiLocation) -> $crate::AccountId { + ::SovereignAccountOf::convert(location.into()).unwrap() + } + + pub fn fund_accounts(accounts: Vec<(AccountId, Balance)>) { + Self::ext_wrapper(|| { + for account in accounts { + let _ = ::Balances::force_set_balance( + ::RuntimeOrigin::root(), + account.0.into(), + account.1.into(), + ); + } + }); + } + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); } @@ -274,12 +310,16 @@ macro_rules! decl_test_parachains { $( pub struct $name:ident { Runtime = $runtime:path, - RuntimeOrigin = $origin:path, + RuntimeOrigin = $runtime_origin:path, + RuntimeEvent = $runtime_event:path, XcmpMessageHandler = $xcmp_message_handler:path, DmpMessageHandler = $dmp_message_handler:path, System = $system:path, ParachainSystem = $parachain_system:path, ParachainInfo = $parachain_info:path, + XcmPallet = $xcm_pallet:path, + Balances = $balances_pallet:path, + LocationToAccountId = $location_to_account:path, genesis = $genesis:expr, on_init = $on_init:expr, } @@ -291,12 +331,16 @@ macro_rules! decl_test_parachains { impl Parachain for $name { type Runtime = $runtime; - type Origin = $origin; + type RuntimeOrigin = $runtime_origin; + type RuntimeEvent = $runtime_event; type XcmpMessageHandler = $xcmp_message_handler; type DmpMessageHandler = $dmp_message_handler; type System = $system; type ParachainSystem = $parachain_system; type ParachainInfo = $parachain_info; + type XcmPallet = $xcm_pallet; + type Balances = $balances_pallet; + type LocationToAccountId = $location_to_account; } $crate::__impl_xcm_for_parachain!($name); @@ -389,7 +433,7 @@ macro_rules! __impl_test_ext_for_parachain { let relay_block_number = <$name>::relay_block_number(); let para_id = <$name>::para_id().into(); let _ = ::ParachainSystem::set_validation_data( - ::Origin::none(), + ::RuntimeOrigin::none(), <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), ); }) @@ -486,6 +530,22 @@ macro_rules! __impl_parachain { Self::ext_wrapper(|| ::System::account(account).data) } + pub fn sovereign_account_id_of(location: $crate::MultiLocation) -> $crate::AccountId { + ::LocationToAccountId::convert(location.into()).unwrap() + } + + pub fn fund_accounts(accounts: Vec<(AccountId, Balance)>) { + Self::ext_wrapper(|| { + for account in accounts { + let _ = ::Balances::force_set_balance( + ::RuntimeOrigin::root(), + account.0.into(), + account.1.into(), + ); + } + }); + } + fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { @@ -511,7 +571,7 @@ macro_rules! __impl_parachain { let para_id = Self::para_id(); let _ = ::ParachainSystem::set_validation_data( - ::Origin::none(), + ::RuntimeOrigin::none(), Self::hrmp_channel_parachain_inherent_data(para_id.into(), 1), ); // set `AnnouncedHrmpMessagesPerCandidate` From 1ab6b2f4f157d5a1fc6631dd59e2c20dfd936e12 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 09:49:56 +0000 Subject: [PATCH 40/60] Bump quote from 1.0.26 to 1.0.27 (#2548) Bumps [quote](https://github.com/dtolnay/quote) from 1.0.26 to 1.0.27. - [Release notes](https://github.com/dtolnay/quote/releases) - [Commits](https://github.com/dtolnay/quote/compare/1.0.26...1.0.27) --- updated-dependencies: - dependency-name: quote dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- pallets/parachain-system/proc-macro/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9358d81a038..667e7d0eefa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10105,9 +10105,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500" dependencies = [ "proc-macro2", ] diff --git a/pallets/parachain-system/proc-macro/Cargo.toml b/pallets/parachain-system/proc-macro/Cargo.toml index 2eb35fe4f0b..d32fd096999 100644 --- a/pallets/parachain-system/proc-macro/Cargo.toml +++ b/pallets/parachain-system/proc-macro/Cargo.toml @@ -11,7 +11,7 @@ proc-macro = true [dependencies] syn = "2.0.15" proc-macro2 = "1.0.54" -quote = "1.0.26" +quote = "1.0.27" proc-macro-crate = "1.3.1" [features] From e623cf170826a531a8fb1b6b839e6a7ce56e9c62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 May 2023 09:50:48 +0000 Subject: [PATCH 41/60] Bump array-bytes from 6.0.0 to 6.1.0 (#2549) Bumps [array-bytes](https://github.com/hack-ink/array-bytes) from 6.0.0 to 6.1.0. - [Release notes](https://github.com/hack-ink/array-bytes/releases) - [Changelog](https://github.com/hack-ink/array-bytes/blob/main/CHANGELOG) - [Commits](https://github.com/hack-ink/array-bytes/compare/v6.0.0...v6.1.0) --- updated-dependencies: - dependency-name: array-bytes dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 6 +++--- client/relay-chain-minimal-node/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 667e7d0eefa..a094272eb97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -263,9 +263,9 @@ checksum = "f52f63c5c1316a16a4b35eaac8b76a98248961a533f061684cb2a7cb0eafb6c6" [[package]] name = "array-bytes" -version = "6.0.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22f72e9d6fac4bc80778ea470b20197b88d28c292bb7d60c3fb099280003cd19" +checksum = "d9b1c5a481ec30a5abd8dfbd94ab5cf1bb4e9a66be7f1b3b322f2f1170c200fd" [[package]] name = "arrayref" @@ -2674,7 +2674,7 @@ dependencies = [ name = "cumulus-relay-chain-minimal-node" version = "0.1.0" dependencies = [ - "array-bytes 6.0.0", + "array-bytes 6.1.0", "async-trait", "cumulus-primitives-core", "cumulus-relay-chain-interface", diff --git a/client/relay-chain-minimal-node/Cargo.toml b/client/relay-chain-minimal-node/Cargo.toml index 17ad78f3c85..e9552e382fb 100644 --- a/client/relay-chain-minimal-node/Cargo.toml +++ b/client/relay-chain-minimal-node/Cargo.toml @@ -37,7 +37,7 @@ cumulus-relay-chain-interface = { path = "../relay-chain-interface" } cumulus-relay-chain-rpc-interface = { path = "../relay-chain-rpc-interface" } cumulus-primitives-core = { path = "../../primitives/core" } -array-bytes = "6.0" +array-bytes = "6.1" lru = "0.9" tracing = "0.1.37" async-trait = "0.1.68" From b963e38831936f6472b7652f7a26a0290cf6fb46 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 11 May 2023 10:08:03 +0200 Subject: [PATCH 42/60] more helpers + tess pass --- .../xcm-emulator/assets/statemint/src/lib.rs | 2 +- .../assets/statemint/tests/teleport.rs | 60 +++++++++++-------- .../xcm-emulator/common/src/lib.rs | 3 + xcm/xcm-emulator/src/lib.rs | 23 ++++--- 4 files changed, 54 insertions(+), 34 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs index 0f1fa813506..3f012f73f6a 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -12,7 +12,7 @@ pub use integration_tests_common::{ PolkadotSender, PolkadotReceiver, KusamaSender, KusamaReceiver, StatemintSender, StatemintReceiver, StatemineSender, StatemineReceiver, PenpalPolkadotSender, PenpalPolkadotReceiver, PenpalKusamaSender, PenpalKusamaReceiver, - constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}}, + constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}}, XCM_VERSION_3 }; #[cfg(test)] diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index ecb4b11b4d6..c7ab0565412 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -1,19 +1,21 @@ use statemint_it::*; +// use xcm::v2::Junction::AccountId32; #[test] // NOTE: This needs to be run before every other test to ensure that chains can communicate with one // another. pub fn force_xcm_version() { - let xcm_version = 3; + let xcm_version = XCM_VERSION_3; + Polkadot::execute_with(|| { - let statemint_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); - let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); + let statemint_location: MultiLocation = Polkadot::child_location_of(Statemint::para_id()); + let penpal_location: MultiLocation = Polkadot::child_location_of(PenpalPolkadot::para_id()); // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. for location in [statemint_location, penpal_location] { assert_ok!(::XcmPallet::force_xcm_version( ::RuntimeOrigin::root(), - Box::new(location), + bx!(location), xcm_version, )); assert!(::System::events().iter().any(|r| matches!( @@ -28,11 +30,12 @@ pub fn force_xcm_version() { // PenpalPolkadot forces Polkadot xcm version. PenpalPolkadot::execute_with(|| { - let location: MultiLocation = (Parent).into(); + let origin = ::RuntimeOrigin::root(); + let location: MultiLocation = PenpalPolkadot::parent_location(); assert_ok!(::XcmPallet::force_xcm_version( - penpal_runtime::RuntimeOrigin::root(), - Box::new(location), + origin, + bx!(location), xcm_version, )); @@ -51,44 +54,51 @@ pub fn force_xcm_version() { #[test] fn teleport_native_assets_from_relay_to_assets_para() { let amount = POLKADOT_ED * 1000; - let native_assets: VersionedMultiAssets = (Here, amount).into(); let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + // Call arguments + let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); + let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain Polkadot::execute_with(|| { use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; assert_ok!(::XcmPallet::limited_teleport_assets( - RuntimeOrigin::signed(PolkadotSender::get()), - bx!( - (Ancestor(0), Parachain(Statemint::para_id().into())).into() - ), - bx!( - AccountId32 { network: None, id: Statemint::account_id_of(BOB).into()}.into()) - , + origin, + bx!(assets_para_destination), + bx!(beneficiary), bx!(native_assets), - 0, - WeightLimit::Unlimited, + fee_asset_item, + weight_limit, )); + assert!(::System::events().iter().any(|r| matches!( r.event, RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) ))); }); + + // Receive XCM message in Assets Parachain Statemint::execute_with(|| { use statemint_runtime::{Runtime, RuntimeEvent, System}; - // assert!(System::events().iter().any(|r| matches!( - // &r.event, - // RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) - // if *who == Statemint::account_id_of(BOB).into() - // ))); + assert!(System::events().iter().any(|r| matches!( + &r.event, + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) + if *who == Statemint::account_id_of(BOB).into() + ))); + // panic!(); }); - // let (relay_balance_after, ap_balance_after) = get_balances(); let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; - // assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); - // assert!(para_sender_balance_after > para_receiver_balance_before); + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert!(para_sender_balance_after > para_receiver_balance_before); } diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 09fae8339b6..cb6182a2431 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -147,6 +147,9 @@ parameter_types! { pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; +pub const XCM_VERSION_2: u32 = 3; +pub const XCM_VERSION_3: u32 = 2; + pub fn parent_account_id() -> parachains_common::AccountId { let location = (Parent,); statemint_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 35a4ebfe246..5dc093b5555 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -268,6 +268,10 @@ macro_rules! __impl_relay { <$network_name>::_para_ids() } + pub fn child_location_of(id: $crate::ParaId) -> MultiLocation { + (Ancestor(0), Parachain(id.into())).into() + } + pub fn account_id_of(seed: &str) -> $crate::AccountId { $crate::get_account_id_from_seed::(seed) } @@ -427,11 +431,12 @@ macro_rules! __impl_test_ext_for_parachain { relay_block_number += 1; <$name>::set_relay_block_number(relay_block_number); + let para_id = <$name>::para_id().into(); + $ext_name.with(|v| { v.borrow_mut().execute_with(|| { // Make sure it has been recorded properly let relay_block_number = <$name>::relay_block_number(); - let para_id = <$name>::para_id().into(); let _ = ::ParachainSystem::set_validation_data( ::RuntimeOrigin::none(), <$name>::hrmp_channel_parachain_inherent_data(para_id, relay_block_number), @@ -462,8 +467,6 @@ macro_rules! __impl_test_ext_for_parachain { // send upward messages let relay_block_number = <$name>::relay_block_number(); - let para_id = <$name>::para_id().into(); - for msg in collation_info.upward_messages.clone() { <$name>::send_upward_message(para_id, msg); } @@ -511,7 +514,11 @@ macro_rules! __impl_parachain { } pub fn para_id() -> $crate::ParaId { - ::ParachainInfo::get() + Self::ext_wrapper(|| ::ParachainInfo::get()) + } + + pub fn parent_location() -> $crate::MultiLocation { + (Parent).into() } fn relay_block_number() -> u32 { @@ -564,11 +571,13 @@ macro_rules! __impl_parachain { } fn prepare_for_xcmp() { + let para_id = Self::para_id(); + ::ext_wrapper(|| { use $crate::{Get, Hooks}; let block_number = ::System::block_number(); - let para_id = Self::para_id(); + // let para_id = Self::para_id(); let _ = ::ParachainSystem::set_validation_data( ::RuntimeOrigin::none(), @@ -633,9 +642,7 @@ macro_rules! decl_test_networks { fn _para_ids() -> Vec { vec![$( - <$parachain>::ext_wrapper( - || <$parachain>::para_id().into() - ), + <$parachain>::para_id().into(), )*] } From 45f4c4a34d933c7d3f7a686b08e60e34638b6e43 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 11 May 2023 19:41:08 +0200 Subject: [PATCH 43/60] expected events macro added --- .../xcm-emulator/assets/statemint/src/lib.rs | 2 +- .../assets/statemint/tests/teleport.rs | 21 ++++++----- .../xcm-emulator/common/src/lib.rs | 13 ------- xcm/xcm-emulator/src/lib.rs | 35 +++++++++++++++++-- 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs index 3f012f73f6a..7109eff2583 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -5,7 +5,7 @@ pub use polkadot_core_primitives::InboundDownwardMessage; pub use xcm::prelude::*; pub use xcm::v3::NetworkId::{Polkadot as PolkadotId, Kusama as KusamaId}; // pub use statemint_runtime::constants::currency::{DOLLARS as STATEMINT_DOLLARS}; -pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx}; +pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx, assert_expected_events}; pub use integration_tests_common::{ AccountId, PolkadotMockNet, KusamaMockNet, Polkadot, Kusama, Statemint, Statemine, PenpalPolkadot, PenpalKusama, diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index c7ab0565412..cb9cf3c76cf 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -57,7 +57,7 @@ fn teleport_native_assets_from_relay_to_assets_para() { let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; - // Call arguments + // Limited Teleport Assets call arguments let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); let beneficiary: VersionedMultiLocation = AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); @@ -87,15 +87,20 @@ fn teleport_native_assets_from_relay_to_assets_para() { // Receive XCM message in Assets Parachain Statemint::execute_with(|| { - use statemint_runtime::{Runtime, RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) - if *who == Statemint::account_id_of(BOB).into() - ))); - // panic!(); + assert_expected_events!( + Statemint, + vec![ + Balances(pallet_balances::Event::Deposit { who, .. }) => { + who: *who == StatemineReceiver::get().into(), + }, + Balances(pallet_balances::Event::Deposit { who, .. }) => { + who: *who == StatemineReceiver::get().into(), + }, + ] + ); }); + // Check if balances are updated accordingly in Relay Chain and Assets Parachain let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index cb6182a2431..447ce249bcf 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -140,8 +140,6 @@ parameter_types! { // Penpal Kusama pub PenpalKusamaSender: AccountId = PenpalKusama::account_id_of(ALICE); pub PenpalKusamaReceiver: AccountId = PenpalKusama::account_id_of(BOB); - - pub StatemintLocation: MultiLocation = (Ancestor(0), Parachain(1000)).into(); } @@ -159,14 +157,3 @@ pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { let location = (Parachain(para),); polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() } - -pub mod helpers { - use super::*; - // pub fn account_id_of(seed: &str) -> AccountId { - // get_account_id_from_seed::(seed) - // } - - // pub fn fund_accounts(accounts: (AccountId, Balance)) { - - // } -} diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 5dc093b5555..509c08838b5 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -347,14 +347,14 @@ macro_rules! decl_test_parachains { type LocationToAccountId = $location_to_account; } - $crate::__impl_xcm_for_parachain!($name); + $crate::__impl_xcm_handlers_for_parachain!($name); $crate::__impl_test_ext_for_parachain!($name, $genesis, $on_init); )+ }; } #[macro_export] -macro_rules! __impl_xcm_for_parachain { +macro_rules! __impl_xcm_handlers_for_parachain { ($name:ident) => { impl $crate::XcmpMessageHandler for $name { fn handle_xcmp_messages< @@ -553,6 +553,10 @@ macro_rules! __impl_parachain { }); } + pub fn received_events(events: Vec<::RuntimeEvent>) { + + } + fn send_horizontal_messages< I: Iterator)>, >(to_para_id: u32, iter: I) { @@ -781,6 +785,33 @@ macro_rules! decl_test_networks { }; } +#[macro_export] +macro_rules! assert_expected_events { + ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { + + type RuntimeEvent = <$chain as $crate::Parachain>::RuntimeEvent; + + <$chain as $crate::Parachain>::System::events().iter().any(|record| + match &record.event { + $( + $crate::paste::expr!(RuntimeEvent::$event_pat) => { + $( + if $condition { + true + } else { + // panic!("Expected event attribute '{:?}' received with a different value '{:?}'", stringify!($attr), $attr); + false + } + )* + // true + }, + )* + _ => false + } + ); + }; +} + #[macro_export] macro_rules! bx { ($e:expr) => { From 89f0fc919c9df3606b0dbf972c1c9d3c1d773bd3 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 11 May 2023 20:54:31 +0200 Subject: [PATCH 44/60] added events trait method --- .../assets/statemint/tests/teleport.rs | 1 - xcm/xcm-emulator/src/lib.rs | 17 +++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index cb9cf3c76cf..ec6f31f8b8c 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -84,7 +84,6 @@ fn teleport_native_assets_from_relay_to_assets_para() { ))); }); - // Receive XCM message in Assets Parachain Statemint::execute_with(|| { assert_expected_events!( diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 509c08838b5..76222c531f7 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -296,6 +296,10 @@ macro_rules! __impl_relay { }); } + pub fn events() -> Vec<::RuntimeEvent> { + ::System::events().iter().map(|record| record.event.clone()).collect() + } + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); } @@ -553,8 +557,8 @@ macro_rules! __impl_parachain { }); } - pub fn received_events(events: Vec<::RuntimeEvent>) { - + pub fn events() -> Vec<::RuntimeEvent> { + ::System::events().iter().map(|record| record.event.clone()).collect() } fn send_horizontal_messages< @@ -789,12 +793,13 @@ macro_rules! decl_test_networks { macro_rules! assert_expected_events { ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { - type RuntimeEvent = <$chain as $crate::Parachain>::RuntimeEvent; + type InnerRuntimeEvent = <$chain as $crate::Parachain>::RuntimeEvent; - <$chain as $crate::Parachain>::System::events().iter().any(|record| - match &record.event { + // <$chain as $crate::Parachain>::System::events().iter().any(|record| + <$chain>::events().iter().any(|event| + match event { $( - $crate::paste::expr!(RuntimeEvent::$event_pat) => { + $crate::paste::expr!(InnerRuntimeEvent::$event_pat) => { $( if $condition { true From 5faf54adc87f93b7efe65fa92278d7e2a2978553 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Fri, 12 May 2023 18:12:37 +0200 Subject: [PATCH 45/60] expect_events macro improve --- .../assets/statemint/tests/teleport.rs | 25 +++++----- xcm/xcm-emulator/src/lib.rs | 49 ++++++++++--------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index ec6f31f8b8c..83504b4fa70 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -53,11 +53,11 @@ pub fn force_xcm_version() { #[test] fn teleport_native_assets_from_relay_to_assets_para() { + // Init tests variables let amount = POLKADOT_ED * 1000; let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; - // Limited Teleport Assets call arguments let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); let beneficiary: VersionedMultiLocation = AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); @@ -67,8 +67,6 @@ fn teleport_native_assets_from_relay_to_assets_para() { // Send XCM message from Relay Chain Polkadot::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - assert_ok!(::XcmPallet::limited_teleport_assets( origin, bx!(assets_para_destination), @@ -78,23 +76,28 @@ fn teleport_native_assets_from_relay_to_assets_para() { weight_limit, )); - assert!(::System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) - ))); + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) => {}, + ] + ); }); // Receive XCM message in Assets Parachain Statemint::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + assert_expected_events!( Statemint, vec![ - Balances(pallet_balances::Event::Deposit { who, .. }) => { - who: *who == StatemineReceiver::get().into(), - }, - Balances(pallet_balances::Event::Deposit { who, .. }) => { + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, amount }) => { who: *who == StatemineReceiver::get().into(), + // amount: *amount == 10, }, + // RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) => {}, ] ); }); diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 76222c531f7..0802582b95b 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -141,7 +141,6 @@ macro_rules! decl_test_relay_chains { type XcmPallet = $xcm_pallet; type Balances = $balances_pallet; type SovereignAccountOf = $sovereign_account_of; - } $crate::__impl_xcm_handlers_for_relay_chain!($name); @@ -184,7 +183,7 @@ macro_rules! __impl_test_ext_for_relay_chain { = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } - impl $crate::TestExt for $name { + impl TestExt for $name { fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { @@ -406,7 +405,7 @@ macro_rules! __impl_test_ext_for_parachain { = $crate::RefCell::new(<$name>::build_new_ext($genesis)); } - impl $crate::TestExt for $name { + impl TestExt for $name { fn build_new_ext(storage: $crate::Storage) -> $crate::TestExternalities { let mut ext = sp_io::TestExternalities::new(storage); ext.execute_with(|| { @@ -622,17 +621,16 @@ macro_rules! decl_test_networks { pub fn reset() { use $crate::{TestExt, VecDeque}; - <$relay_chain>::reset_ext(); - $( <$parachain>::reset_ext(); )* - - $( <$parachain>::prepare_for_xcmp(); )* - $crate::INITIALIZED.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::DMP_DONE.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().remove(stringify!($name))); $crate::RELAY_BLOCK_NUMBER.with(|b| b.borrow_mut().remove(stringify!($name))); + + <$relay_chain>::reset_ext(); + $( <$parachain>::reset_ext(); )* + $( <$parachain>::prepare_for_xcmp(); )* } fn _init() { @@ -792,28 +790,31 @@ macro_rules! decl_test_networks { #[macro_export] macro_rules! assert_expected_events { ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { + $( + let mut meet_conditions = true; + let mut message: Vec = Vec::new(); - type InnerRuntimeEvent = <$chain as $crate::Parachain>::RuntimeEvent; - - // <$chain as $crate::Parachain>::System::events().iter().any(|record| - <$chain>::events().iter().any(|event| - match event { - $( - $crate::paste::expr!(InnerRuntimeEvent::$event_pat) => { + let event_received = <$chain>::events().iter().any(|event| + match event { + $event_pat => { $( - if $condition { - true - } else { - // panic!("Expected event attribute '{:?}' received with a different value '{:?}'", stringify!($attr), $attr); - false + if !$condition { + message.push(format!(" - The attribute {:?} = {:?} did not met the condition {:?}\n", stringify!($attr), $attr, stringify!($condition))); + meet_conditions &= $condition } )* - // true + true }, - )* - _ => false + _ => false + } + ); + + if event_received && !meet_conditions { + panic!("\n\nEvent \x1b[31m{:?}\x1b[0m was received but some of its attributes did not meet the conditions:\n{}", stringify!($event_pat), message.concat()); + } else if !event_received { + panic!("\n\nEvent \x1b[31m{:?}\x1b[0m was NOT received", stringify!($event_pat)); } - ); + )* }; } From 06962cb6d9d5ae72d75c66bba7ea9ecd90a701a5 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Fri, 12 May 2023 18:51:13 +0200 Subject: [PATCH 46/60] expect_events macro done --- .../xcm-emulator/assets/statemint/tests/teleport.rs | 4 +--- xcm/xcm-emulator/src/lib.rs | 12 ++++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index 83504b4fa70..2b388eef098 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -93,11 +93,9 @@ fn teleport_native_assets_from_relay_to_assets_para() { assert_expected_events!( Statemint, vec![ - RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, amount }) => { + RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) => { who: *who == StatemineReceiver::get().into(), - // amount: *amount == 10, }, - // RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) => {}, ] ); }); diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 0802582b95b..4e0220fc309 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -790,16 +790,17 @@ macro_rules! decl_test_networks { #[macro_export] macro_rules! assert_expected_events { ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { + let mut message: Vec = Vec::new(); $( let mut meet_conditions = true; - let mut message: Vec = Vec::new(); + let mut event_message: Vec = Vec::new(); let event_received = <$chain>::events().iter().any(|event| match event { $event_pat => { $( if !$condition { - message.push(format!(" - The attribute {:?} = {:?} did not met the condition {:?}\n", stringify!($attr), $attr, stringify!($condition))); + event_message.push(format!(" - The attribute {:?} = {:?} did not met the condition {:?}\n", stringify!($attr), $attr, stringify!($condition))); meet_conditions &= $condition } )* @@ -810,11 +811,14 @@ macro_rules! assert_expected_events { ); if event_received && !meet_conditions { - panic!("\n\nEvent \x1b[31m{:?}\x1b[0m was received but some of its attributes did not meet the conditions:\n{}", stringify!($event_pat), message.concat()); + message.push(format!("\n\nEvent \x1b[31m{}\x1b[0m was received but some of its attributes did not meet the conditions:\n{}", stringify!($event_pat), event_message.concat())); } else if !event_received { - panic!("\n\nEvent \x1b[31m{:?}\x1b[0m was NOT received", stringify!($event_pat)); + message.push(format!("\n\nEvent \x1b[31m{}\x1b[0m was never received", stringify!($event_pat))); } )* + if !message.is_empty() { + panic!("{}", message.concat()) + } }; } From 53eef96f16499a1618c6fdb78dc12ae511f7d85b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sat, 13 May 2023 14:47:53 +0200 Subject: [PATCH 47/60] network traits added --- .../assets/statemint/tests/teleport.rs | 1 - xcm/xcm-emulator/src/lib.rs | 137 ++++++++++-------- 2 files changed, 76 insertions(+), 62 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index 2b388eef098..346febb4e98 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -1,5 +1,4 @@ use statemint_it::*; -// use xcm::v2::Junction::AccountId32; #[test] // NOTE: This needs to be run before every other test to ensure that chains can communicate with one diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 4e0220fc309..e57b2e29458 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -84,7 +84,68 @@ pub trait TestExt { fn ext_wrapper(func: impl FnOnce() -> R) -> R; } -pub trait RelayChain: TestExt + UmpSink { +pub trait Network { + fn _init(); + fn _para_ids() -> Vec; + fn _relay_block_number() -> u32; + fn _set_relay_block_number(block_number: u32); + fn _process_messages(); + fn _has_unprocessed_messages() -> bool; + fn _process_downward_messages(); + fn _process_horizontal_messages(); + fn _process_upward_messages(); + fn _hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData; +} + +pub trait NetworkComponent { + fn network_name() -> &'static str; + + fn init() { + N::_init(); + } + + fn relay_block_number() -> u32 { + N::_relay_block_number() + } + + fn set_relay_block_number(block_number: u32) { + N::_set_relay_block_number(block_number); + } + + fn para_ids() -> Vec { + N::_para_ids() + } + + fn send_horizontal_messages< + I: Iterator)>, + >(to_para_id: u32, iter: I) { + HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); + } + + fn send_upward_message(from_para_id: u32, msg: Vec) { + UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((from_para_id, msg))); + } + + fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { + DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); + } + + fn hrmp_channel_parachain_inherent_data( + para_id: u32, + relay_parent_number: u32, + ) -> ParachainInherentData { + N::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) + } + + fn process_messages() { + N::_process_messages(); + } +} + +pub trait RelayChain: UmpSink { type Runtime; type RuntimeOrigin; type RuntimeEvent; @@ -95,7 +156,7 @@ pub trait RelayChain: TestExt + UmpSink { type SovereignAccountOf; } -pub trait Parachain: TestExt + XcmpMessageHandler + DmpMessageHandler { +pub trait Parachain: XcmpMessageHandler + DmpMessageHandler { type Runtime; type RuntimeOrigin; type RuntimeEvent; @@ -203,6 +264,7 @@ macro_rules! __impl_test_ext_for_relay_chain { } fn execute_with(execute: impl FnOnce() -> R) -> R { + use $crate::{NetworkComponent}; // Make sure the Network is initialized <$name>::init(); @@ -250,23 +312,13 @@ macro_rules! __impl_test_ext_for_relay_chain { macro_rules! __impl_relay { ($network_name:ident, $relay_chain:ty) => { - impl $relay_chain { - pub fn network_name() -> &'static str { + impl $crate::NetworkComponent<$network_name> for $relay_chain { + fn network_name() -> &'static str { stringify!($network_name) } + } - fn init() { - <$network_name>::_init(); - } - - pub fn relay_block_number() -> u32 { - <$network_name>::_relay_block_number() - } - - fn para_ids() -> Vec { - <$network_name>::_para_ids() - } - + impl $relay_chain { pub fn child_location_of(id: $crate::ParaId) -> MultiLocation { (Ancestor(0), Parachain(id.into())).into() } @@ -298,14 +350,6 @@ macro_rules! __impl_relay { pub fn events() -> Vec<::RuntimeEvent> { ::System::events().iter().map(|record| record.event.clone()).collect() } - - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - $crate::DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); - } - - fn process_messages() { - <$network_name>::_process_messages(); - } } } } @@ -425,7 +469,7 @@ macro_rules! __impl_test_ext_for_parachain { } fn execute_with(execute: impl FnOnce() -> R) -> R { - use $crate::{Get, Hooks}; + use $crate::{Get, Hooks, NetworkComponent}; // Make sure the Network is initialized <$name>::init(); @@ -507,15 +551,13 @@ macro_rules! __impl_test_ext_for_parachain { macro_rules! __impl_parachain { ($network_name:ident, $parachain:ty) => { - impl $parachain { - pub fn network_name() -> &'static str { + impl $crate::NetworkComponent<$network_name> for $parachain { + fn network_name() -> &'static str { stringify!($network_name) } + } - fn init() { - <$network_name>::_init(); - } - + impl $parachain { pub fn para_id() -> $crate::ParaId { Self::ext_wrapper(|| ::ParachainInfo::get()) } @@ -524,14 +566,6 @@ macro_rules! __impl_parachain { (Parent).into() } - fn relay_block_number() -> u32 { - <$network_name>::_relay_block_number() - } - - fn set_relay_block_number(block_number: u32) { - <$network_name>::_set_relay_block_number(block_number); - } - pub fn account_id_of(seed: &str) -> $crate::AccountId { $crate::get_account_id_from_seed::(seed) } @@ -560,31 +594,14 @@ macro_rules! __impl_parachain { ::System::events().iter().map(|record| record.event.clone()).collect() } - fn send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) { - $crate::HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); - } - - fn send_upward_message(from_para_id: u32, msg: Vec) { - $crate::UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((from_para_id, msg))); - } - - fn hrmp_channel_parachain_inherent_data( - para_id: u32, - relay_parent_number: u32, - ) -> $crate::ParachainInherentData { - <$network_name>::_hrmp_channel_parachain_inherent_data(para_id, relay_parent_number) - } - fn prepare_for_xcmp() { + use $crate::NetworkComponent; let para_id = Self::para_id(); ::ext_wrapper(|| { use $crate::{Get, Hooks}; let block_number = ::System::block_number(); - // let para_id = Self::para_id(); let _ = ::ParachainSystem::set_validation_data( ::RuntimeOrigin::none(), @@ -594,10 +611,6 @@ macro_rules! __impl_parachain { ::ParachainSystem::on_initialize(block_number); }); } - - fn process_messages() { - <$network_name>::_process_messages(); - } } } } @@ -632,7 +645,9 @@ macro_rules! decl_test_networks { $( <$parachain>::reset_ext(); )* $( <$parachain>::prepare_for_xcmp(); )* } + } + impl $crate::Network for $name { fn _init() { // If Network has not been itialized yet, it gets initialized if $crate::INITIALIZED.with(|b| b.borrow_mut().get(stringify!($name)).is_none()) { From 36eb693f64c15654cec5dca27866364c2fd6c452 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sat, 13 May 2023 16:59:01 +0200 Subject: [PATCH 48/60] reserve_transfer test added --- .../xcm-emulator/assets/statemint/src/lib.rs | 6 +- .../assets/statemint/tests/mod.rs | 2 + .../statemint/tests/reserve_transfer.rs | 59 +++++++++++++++++++ .../assets/statemint/tests/transact.rs | 48 +-------------- 4 files changed, 65 insertions(+), 50 deletions(-) create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs index 7109eff2583..cf1b585157c 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -1,11 +1,11 @@ pub use frame_support::{ + instances::Instance1, assert_ok, }; pub use polkadot_core_primitives::InboundDownwardMessage; +pub use xcm::v3::{NetworkId::{Polkadot as PolkadotId, Kusama as KusamaId}, Error}; pub use xcm::prelude::*; -pub use xcm::v3::NetworkId::{Polkadot as PolkadotId, Kusama as KusamaId}; -// pub use statemint_runtime::constants::currency::{DOLLARS as STATEMINT_DOLLARS}; -pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx, assert_expected_events}; +pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx, assert_expected_events, cumulus_pallet_dmp_queue}; pub use integration_tests_common::{ AccountId, PolkadotMockNet, KusamaMockNet, Polkadot, Kusama, Statemint, Statemine, PenpalPolkadot, PenpalKusama, diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs index 33b71a24075..c1aa7035d67 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs @@ -1 +1,3 @@ +pub mod reserve_transfer; pub mod teleport; +// pub mod transact; diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs new file mode 100644 index 00000000000..77e7799de70 --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs @@ -0,0 +1,59 @@ +use statemint_it::*; + +#[test] +fn reserve_transfer_native_asset_from_relay_to_assets() { + // Init tests variables + let amount = POLKADOT_ED * 1000; + let relay_sender_balance_before = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; + + let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); + let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let native_assets: VersionedMultiAssets = (Here, amount).into(); + let fee_asset_item = 0; + let weight_limit = WeightLimit::Unlimited; + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::limited_reserve_transfer_assets( + origin, + bx!(assets_para_destination), + bx!(beneficiary), + bx!(native_assets), + fee_asset_item, + weight_limit, + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Statemint, + vec![ + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { + outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), + .. + }) => {}, + ] + ); + }); + + // Check if balances are updated accordingly in Relay Chain and Assets Parachain + let relay_sender_balance_after = Polkadot::account_data_of(PolkadotSender::get()).free; + let para_sender_balance_after = Statemint::account_data_of(StatemintReceiver::get()).free; + + assert_eq!(relay_sender_balance_before - amount, relay_sender_balance_after); + assert_eq!(para_sender_balance_after, para_receiver_balance_before); +} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs index 6c141a7291f..5e62aefe4bd 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs @@ -1,12 +1,8 @@ // use statemint_it::*; // #[test] -// fn transact_sudo_relay_to_assets_para_works() { -// force_xcm_version(); - +// fn transact_sudo_from_relay_to_assets_para() { // Polkadot::execute_with(|| { -// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - // let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< // statemint_runtime::Runtime, // Instance1, @@ -39,45 +35,3 @@ // assert!(statemint_runtime::Assets::asset_exists(1)); // }); // } - -// #[test] -// fn reserved_transfer_native_relay_to_assets_para_fails() { -// force_xcm_version(); -// let (relay_balance, ap_balance) = get_balances(); -// let amount = 1000_000_000; -// let assets: VersionedMultiAssets = (Here, amount).into(); - -// Polkadot::execute_with(|| { -// use polkadot_runtime::{RuntimeEvent, RuntimeOrigin, System}; - -// assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( -// RuntimeOrigin::signed(ALICE.into()), -// Box::new(AP_DEST.into()), -// Box::new(get_benf().into()), -// Box::new(assets), -// 0, -// WeightLimit::Unlimited, -// )); - -// assert!(System::events().iter().any(|r| matches!( -// r.event, -// RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) -// ))); -// }); - -// Statemint::execute_with(|| { -// use statemint_runtime::{RuntimeEvent, System}; - -// assert!(System::events().iter().any(|r| matches!( -// r.event, -// RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { -// outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), -// .. -// }) -// ))); -// }); - -// let (relay_balance_after, ap_balance_after) = get_balances(); -// assert_eq!(relay_balance - amount, relay_balance_after); -// assert_eq!(ap_balance_after, ap_balance); -// } From 342e526a55127693ca15656d7a171b3013fbfded Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sat, 13 May 2023 21:46:24 +0200 Subject: [PATCH 49/60] para & relay macro inputs redefined --- .../statemint/tests/reserve_transfer.rs | 3 +- .../assets/statemint/tests/teleport.rs | 7 +- .../xcm-emulator/common/src/lib.rs | 155 +++++++++++------- xcm/xcm-emulator/src/lib.rs | 108 ++++++++---- 4 files changed, 174 insertions(+), 99 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs index 77e7799de70..c1bab17c937 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs @@ -1,3 +1,4 @@ +use integration_tests_common::PolkadotPallet; use statemint_it::*; #[test] @@ -16,7 +17,7 @@ fn reserve_transfer_native_asset_from_relay_to_assets() { // Send XCM message from Relay Chain Polkadot::execute_with(|| { - assert_ok!(::XcmPallet::limited_reserve_transfer_assets( + assert_ok!(::XcmPallet::limited_reserve_transfer_assets( origin, bx!(assets_para_destination), bx!(beneficiary), diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index 346febb4e98..18f4606ad55 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -1,3 +1,4 @@ +use integration_tests_common::{PolkadotPallet, PenpalPolkadotPallet}; use statemint_it::*; #[test] @@ -12,7 +13,7 @@ pub fn force_xcm_version() { // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. for location in [statemint_location, penpal_location] { - assert_ok!(::XcmPallet::force_xcm_version( + assert_ok!(::XcmPallet::force_xcm_version( ::RuntimeOrigin::root(), bx!(location), xcm_version, @@ -32,7 +33,7 @@ pub fn force_xcm_version() { let origin = ::RuntimeOrigin::root(); let location: MultiLocation = PenpalPolkadot::parent_location(); - assert_ok!(::XcmPallet::force_xcm_version( + assert_ok!(::PolkadotXcm::force_xcm_version( origin, bx!(location), xcm_version, @@ -66,7 +67,7 @@ fn teleport_native_assets_from_relay_to_assets_para() { // Send XCM message from Relay Chain Polkadot::execute_with(|| { - assert_ok!(::XcmPallet::limited_teleport_assets( + assert_ok!(::XcmPallet::limited_teleport_assets( origin, bx!(assets_para_destination), bx!(beneficiary), diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 447ce249bcf..2076dfbbd1c 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -14,93 +14,128 @@ pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAu decl_test_relay_chains! { pub struct Polkadot { - Runtime = polkadot_runtime::Runtime, - RuntimeOrigin = polkadot_runtime::RuntimeOrigin, - RuntimeEvent = polkadot_runtime::RuntimeEvent, - XcmConfig = polkadot_runtime::xcm_config::XcmConfig, - System = polkadot_runtime::System, - XcmPallet = polkadot_runtime::XcmPallet, - Balances = polkadot_runtime::Balances, - SovereignAccountOf = polkadot_runtime::xcm_config::SovereignAccountOf, genesis = polkadot::genesis(), on_init = (), + runtime = { + Runtime: polkadot_runtime::Runtime, + RuntimeOrigin: polkadot_runtime::RuntimeOrigin, + RuntimeCall: polkadot_runtime::RuntimeCall, + RuntimeEvent: polkadot_runtime::RuntimeEvent, + XcmConfig: polkadot_runtime::xcm_config::XcmConfig, + SovereignAccountOf: polkadot_runtime::xcm_config::SovereignAccountOf, + System: polkadot_runtime::System, + Balances: polkadot_runtime::Balances, + }, + pallets_extra = { + XcmPallet: polkadot_runtime::XcmPallet, + } }, pub struct Kusama { - Runtime = kusama_runtime::Runtime, - RuntimeOrigin = kusama_runtime::RuntimeOrigin, - RuntimeEvent = kusama_runtime::RuntimeEvent, - XcmConfig = kusama_runtime::xcm_config::XcmConfig, - System = kusama_runtime::System, - XcmPallet = kusama_runtime::XcmPallet, - Balances = kusama_runtime::Balances, - SovereignAccountOf = kusama_runtime::xcm_config::SovereignAccountOf, genesis = kusama::genesis(), on_init = (), + runtime = { + Runtime: kusama_runtime::Runtime, + RuntimeOrigin: kusama_runtime::RuntimeOrigin, + RuntimeCall: polkadot_runtime::RuntimeCall, + RuntimeEvent: kusama_runtime::RuntimeEvent, + XcmConfig: kusama_runtime::xcm_config::XcmConfig, + SovereignAccountOf: kusama_runtime::xcm_config::SovereignAccountOf, + System: kusama_runtime::System, + Balances: kusama_runtime::Balances, + }, + pallets_extra = { + XcmPallet: kusama_runtime::XcmPallet, + } } } decl_test_parachains! { // Polkadot pub struct Statemint { - Runtime = statemint_runtime::Runtime, - RuntimeOrigin = statemint_runtime::RuntimeOrigin, - RuntimeEvent = statemint_runtime::RuntimeEvent, - XcmpMessageHandler = statemint_runtime::XcmpQueue, - DmpMessageHandler = statemint_runtime::DmpQueue, - System = statemint_runtime::System, - ParachainSystem = statemint_runtime::ParachainSystem, - ParachainInfo = statemint_runtime::ParachainInfo, - XcmPallet = statemint_runtime::PolkadotXcm, - Balances = statemint_runtime::Balances, - LocationToAccountId = statemint_runtime::xcm_config::LocationToAccountId, genesis = statemint::genesis(), on_init = (), + runtime = { + Runtime: statemint_runtime::Runtime, + RuntimeOrigin: statemint_runtime::RuntimeOrigin, + RuntimeCall: statemint_runtime::RuntimeCall, + RuntimeEvent: statemint_runtime::RuntimeEvent, + XcmpMessageHandler: statemint_runtime::XcmpQueue, + DmpMessageHandler: statemint_runtime::DmpQueue, + LocationToAccountId: statemint_runtime::xcm_config::LocationToAccountId, + System: statemint_runtime::System, + Balances: statemint_runtime::Balances, + ParachainSystem: statemint_runtime::ParachainSystem, + ParachainInfo: statemint_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: statemint_runtime::PolkadotXcm, + Assets: statemint_runtime::Assets, + } }, pub struct PenpalPolkadot { - Runtime = penpal_runtime::Runtime, - RuntimeOrigin = penpal_runtime::RuntimeOrigin, - RuntimeEvent = penpal_runtime::RuntimeEvent, - XcmpMessageHandler = penpal_runtime::XcmpQueue, - DmpMessageHandler = penpal_runtime::DmpQueue, - System = penpal_runtime::System, - ParachainSystem = penpal_runtime::ParachainSystem, - ParachainInfo = penpal_runtime::ParachainInfo, - XcmPallet = penpal_runtime::PolkadotXcm, - Balances = penpal_runtime::Balances, - LocationToAccountId = penpal_runtime::xcm_config::LocationToAccountId, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), + runtime = { + Runtime: penpal_runtime::Runtime, + RuntimeOrigin: penpal_runtime::RuntimeOrigin, + RuntimeCall: penpal_runtime::RuntimeEvent, + RuntimeEvent: penpal_runtime::RuntimeEvent, + XcmpMessageHandler: penpal_runtime::XcmpQueue, + DmpMessageHandler: penpal_runtime::DmpQueue, + LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId, + System: penpal_runtime::System, + Balances: penpal_runtime::Balances, + ParachainSystem: penpal_runtime::ParachainSystem, + ParachainInfo: penpal_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: penpal_runtime::PolkadotXcm, + Assets: penpal_runtime::Assets, + } }, // Kusama pub struct Statemine { - Runtime = statemine_runtime::Runtime, - RuntimeOrigin = statemine_runtime::RuntimeOrigin, - RuntimeEvent = statemine_runtime::RuntimeEvent, - XcmpMessageHandler = statemine_runtime::XcmpQueue, - DmpMessageHandler = statemine_runtime::DmpQueue, - System = statemine_runtime::System, - ParachainSystem = statemine_runtime::ParachainSystem, - ParachainInfo = statemine_runtime::ParachainInfo, - XcmPallet = statemine_runtime::PolkadotXcm, - Balances = statemine_runtime::Balances, - LocationToAccountId = statemine_runtime::xcm_config::LocationToAccountId, genesis = statemine::genesis(), on_init = (), + runtime = { + Runtime: statemine_runtime::Runtime, + RuntimeOrigin: statemine_runtime::RuntimeOrigin, + RuntimeCall: statemine_runtime::RuntimeEvent, + RuntimeEvent: statemine_runtime::RuntimeEvent, + XcmpMessageHandler: statemine_runtime::XcmpQueue, + DmpMessageHandler: statemine_runtime::DmpQueue, + LocationToAccountId: statemine_runtime::xcm_config::LocationToAccountId, + System: statemine_runtime::System, + Balances: statemine_runtime::Balances, + ParachainSystem: statemine_runtime::ParachainSystem, + ParachainInfo: statemine_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: statemine_runtime::PolkadotXcm, + Assets: statemine_runtime::Assets, + ForeignAssets: statemine_runtime::Assets, + } }, pub struct PenpalKusama { - Runtime = penpal_runtime::Runtime, - RuntimeOrigin = penpal_runtime::RuntimeOrigin, - RuntimeEvent = penpal_runtime::RuntimeEvent, - XcmpMessageHandler = penpal_runtime::XcmpQueue, - DmpMessageHandler = penpal_runtime::DmpQueue, - System = penpal_runtime::System, - ParachainSystem = penpal_runtime::ParachainSystem, - ParachainInfo = penpal_runtime::ParachainInfo, - XcmPallet = penpal_runtime::PolkadotXcm, - Balances = penpal_runtime::Balances, - LocationToAccountId = penpal_runtime::xcm_config::LocationToAccountId, genesis = penpal::genesis(penpal::PARA_ID), on_init = (), + runtime = { + Runtime: penpal_runtime::Runtime, + RuntimeOrigin: penpal_runtime::RuntimeOrigin, + RuntimeCall: penpal_runtime::RuntimeEvent, + RuntimeEvent: penpal_runtime::RuntimeEvent, + XcmpMessageHandler: penpal_runtime::XcmpQueue, + DmpMessageHandler: penpal_runtime::DmpQueue, + LocationToAccountId: penpal_runtime::xcm_config::LocationToAccountId, + System: penpal_runtime::System, + Balances: penpal_runtime::Balances, + ParachainSystem: penpal_runtime::ParachainSystem, + ParachainInfo: penpal_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: penpal_runtime::PolkadotXcm, + Assets: penpal_runtime::Assets, + } } } diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index e57b2e29458..7a4c199a87e 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -148,26 +148,26 @@ pub trait NetworkComponent { pub trait RelayChain: UmpSink { type Runtime; type RuntimeOrigin; + type RuntimeCall; type RuntimeEvent; type XcmConfig; + type SovereignAccountOf; type System; - type XcmPallet; type Balances; - type SovereignAccountOf; } pub trait Parachain: XcmpMessageHandler + DmpMessageHandler { type Runtime; type RuntimeOrigin; + type RuntimeCall; type RuntimeEvent; type XcmpMessageHandler; type DmpMessageHandler; + type LocationToAccountId; type System; + type Balances; type ParachainSystem; type ParachainInfo; - type XcmPallet; - type Balances; - type LocationToAccountId; } // Relay Chain Implementation @@ -176,16 +176,21 @@ macro_rules! decl_test_relay_chains { ( $( pub struct $name:ident { - Runtime = $runtime:path, - RuntimeOrigin = $runtime_origin:path, - RuntimeEvent = $runtime_event:path, - XcmConfig = $xcm_config:path, - System = $system:path, - XcmPallet = $xcm_pallet:path, - Balances = $balances_pallet:path, - SovereignAccountOf = $sovereign_account_of:path, genesis = $genesis:expr, on_init = $on_init:expr, + runtime = { + Runtime: $($runtime:tt)::*, + RuntimeOrigin: $($runtime_origin:tt)::*, + RuntimeCall: $($runtime_call:tt)::*, + RuntimeEvent: $($runtime_event:tt)::*, + XcmConfig: $($xcm_config:tt)::*, + SovereignAccountOf: $($sovereign_acc_of:tt)::*, + System: $($system:tt)::*, + Balances: $($balances:tt)::*, + }, + pallets_extra = { + $($pallet_name:ident: $pallet_path:path,)* + } } ), + @@ -194,14 +199,28 @@ macro_rules! decl_test_relay_chains { pub struct $name; impl RelayChain for $name { - type Runtime = $runtime; - type RuntimeOrigin = $runtime_origin; - type RuntimeEvent = $runtime_event; - type XcmConfig = $xcm_config; - type System = $system; - type XcmPallet = $xcm_pallet; - type Balances = $balances_pallet; - type SovereignAccountOf = $sovereign_account_of; + type Runtime = $($runtime)::*; + type RuntimeOrigin = $($runtime_origin)::*; + type RuntimeCall = $($runtime_call)::*; + type RuntimeEvent = $($runtime_event)::*; + type XcmConfig = $($xcm_config)::*; + type SovereignAccountOf = $($sovereign_acc_of)::*; + type System = $($system)::*; + type Balances = $($balances)::*; + } + + $crate::paste::paste! { + pub trait [<$name Pallet>] { + $( + type $pallet_name; + )? + } + + impl [<$name Pallet>] for $name { + $( + type $pallet_name = $pallet_path; + )? + } } $crate::__impl_xcm_handlers_for_relay_chain!($name); @@ -360,19 +379,24 @@ macro_rules! decl_test_parachains { ( $( pub struct $name:ident { - Runtime = $runtime:path, - RuntimeOrigin = $runtime_origin:path, - RuntimeEvent = $runtime_event:path, - XcmpMessageHandler = $xcmp_message_handler:path, - DmpMessageHandler = $dmp_message_handler:path, - System = $system:path, - ParachainSystem = $parachain_system:path, - ParachainInfo = $parachain_info:path, - XcmPallet = $xcm_pallet:path, - Balances = $balances_pallet:path, - LocationToAccountId = $location_to_account:path, genesis = $genesis:expr, on_init = $on_init:expr, + runtime = { + Runtime: $runtime:path, + RuntimeOrigin: $runtime_origin:path, + RuntimeCall: $runtime_call:path, + RuntimeEvent: $runtime_event:path, + XcmpMessageHandler: $xcmp_message_handler:path, + DmpMessageHandler: $dmp_message_handler:path, + LocationToAccountId: $location_to_account:path, + System: $system:path, + Balances: $balances_pallet:path, + ParachainSystem: $parachain_system:path, + ParachainInfo: $parachain_info:path, + }, + pallets_extra = { + $($pallet_name:ident: $pallet_path:path,)* + } } ), + @@ -383,15 +407,29 @@ macro_rules! decl_test_parachains { impl Parachain for $name { type Runtime = $runtime; type RuntimeOrigin = $runtime_origin; + type RuntimeCall = $runtime_call; type RuntimeEvent = $runtime_event; type XcmpMessageHandler = $xcmp_message_handler; type DmpMessageHandler = $dmp_message_handler; + type LocationToAccountId = $location_to_account; type System = $system; + type Balances = $balances_pallet; type ParachainSystem = $parachain_system; type ParachainInfo = $parachain_info; - type XcmPallet = $xcm_pallet; - type Balances = $balances_pallet; - type LocationToAccountId = $location_to_account; + } + + $crate::paste::paste! { + pub trait [<$name Pallet>] { + $( + type $pallet_name; + )* + } + + impl [<$name Pallet>] for $name { + $( + type $pallet_name = $pallet_path; + )* + } } $crate::__impl_xcm_handlers_for_parachain!($name); From 839b32bed0a7b9aeb9f8b837985715e3a01b2989 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sun, 14 May 2023 20:33:10 +0200 Subject: [PATCH 50/60] added collectives & BH paras --- Cargo.lock | 3 + .../xcm-emulator/assets/statemint/src/lib.rs | 2 +- .../assets/statemint/tests/teleport.rs | 52 +----- .../xcm-emulator/common/Cargo.toml | 5 +- .../xcm-emulator/common/src/constants.rs | 151 +++++++++++++++++- .../xcm-emulator/common/src/lib.rs | 91 ++++++++--- 6 files changed, 227 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b3fd743d777..b95d2d84611 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4377,6 +4377,9 @@ dependencies = [ name = "integration-tests-common" version = "1.0.0" dependencies = [ + "bridge-hub-kusama-runtime", + "bridge-hub-polkadot-runtime", + "collectives-polkadot-runtime", "cumulus-primitives-core", "cumulus-test-service", "frame-support", diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs index cf1b585157c..d742c250542 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -12,7 +12,7 @@ pub use integration_tests_common::{ PolkadotSender, PolkadotReceiver, KusamaSender, KusamaReceiver, StatemintSender, StatemintReceiver, StatemineSender, StatemineReceiver, PenpalPolkadotSender, PenpalPolkadotReceiver, PenpalKusamaSender, PenpalKusamaReceiver, - constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}}, XCM_VERSION_3 + constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}, XCM_V3}, }; #[cfg(test)] diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs index 18f4606ad55..f7e8ad0455f 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs @@ -1,56 +1,6 @@ -use integration_tests_common::{PolkadotPallet, PenpalPolkadotPallet}; +use integration_tests_common::{PolkadotPallet}; use statemint_it::*; -#[test] -// NOTE: This needs to be run before every other test to ensure that chains can communicate with one -// another. -pub fn force_xcm_version() { - let xcm_version = XCM_VERSION_3; - - Polkadot::execute_with(|| { - let statemint_location: MultiLocation = Polkadot::child_location_of(Statemint::para_id()); - let penpal_location: MultiLocation = Polkadot::child_location_of(PenpalPolkadot::para_id()); - - // Check that we can force xcm version for Statemint and PenpalPolkadot from Polkadot. - for location in [statemint_location, penpal_location] { - assert_ok!(::XcmPallet::force_xcm_version( - ::RuntimeOrigin::root(), - bx!(location), - xcm_version, - )); - assert!(::System::events().iter().any(|r| matches!( - r.event, - polkadot_runtime::RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - } - }); - - // PenpalPolkadot forces Polkadot xcm version. - PenpalPolkadot::execute_with(|| { - let origin = ::RuntimeOrigin::root(); - let location: MultiLocation = PenpalPolkadot::parent_location(); - - assert_ok!(::PolkadotXcm::force_xcm_version( - origin, - bx!(location), - xcm_version, - )); - - type RuntimeEvent = ::RuntimeEvent; - - assert!(::System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - }); -} - #[test] fn teleport_native_assets_from_relay_to_assets_para() { // Init tests variables diff --git a/parachains/integration-tests/xcm-emulator/common/Cargo.toml b/parachains/integration-tests/xcm-emulator/common/Cargo.toml index d8d47c93846..0f96494453c 100644 --- a/parachains/integration-tests/xcm-emulator/common/Cargo.toml +++ b/parachains/integration-tests/xcm-emulator/common/Cargo.toml @@ -44,6 +44,7 @@ cumulus-primitives-core = { path = "../../../../primitives/core" } penpal-runtime = { path = "../../../runtimes/testing/penpal" } statemint-runtime = { path = "../../../runtimes/assets/statemint" } statemine-runtime = { path = "../../../runtimes/assets/statemine" } - -# Local +collectives-polkadot-runtime = { path = "../../../runtimes/collectives/collectives-polkadot" } +bridge-hub-kusama-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-kusama" } +bridge-hub-polkadot-runtime = { path = "../../../runtimes/bridge-hubs/bridge-hub-polkadot" } xcm-emulator = { default-features = false, path = "../../../../xcm/xcm-emulator" } diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/xcm-emulator/common/src/constants.rs index 320b92d1ce9..10a3a63846c 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/constants.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/constants.rs @@ -1,17 +1,19 @@ pub use polkadot_runtime_parachains::configuration::HostConfiguration; -use polkadot_primitives::{AccountPublic, AssignmentId, ValidatorId}; +use polkadot_primitives::{AssignmentId, ValidatorId}; pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; -use cumulus_primitives_core::ParaId; pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; pub use xcm; use grandpa::AuthorityId as GrandpaId; -use sp_core::{crypto::UncheckedInto, sr25519, storage::Storage}; +use sp_core::{sr25519, storage::Storage}; use sp_runtime::{Perbill, BuildStorage}; use sp_consensus_babe::AuthorityId as BabeId; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +pub const XCM_V2: u32 = 3; +pub const XCM_V3: u32 = 2; + pub mod accounts { use super::*; pub const ALICE: &str = "Alice"; @@ -19,7 +21,7 @@ pub mod accounts { pub const CHARLIE: &str = "Charlie"; pub const DAVE: &str = "Dave"; pub const EVE: &str = "Eve"; - pub const FERDIE: &str = "Ferdeir"; + pub const FERDIE: &str = "Ferdei"; pub const ALICE_STASH: &str = "Alice//stash"; pub const BOB_STASH: &str = "Bob//stash"; pub const CHARLIE_STASH: &str = "Charlie//stash"; @@ -94,7 +96,6 @@ pub mod validators { /// The default XCM version to set in genesis config. const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION; - // Polkadot pub mod polkadot { use super::*; @@ -436,3 +437,143 @@ pub mod penpal { genesis_config.build_storage().unwrap() } } + +// Collectives +pub mod collectives { + use super::*; + pub const PARA_ID: u32 = 1001; + pub const ED: Balance = collectives_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = collectives_polkadot_runtime::GenesisConfig { + system: collectives_polkadot_runtime::SystemConfig { + code: collectives_polkadot_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: collectives_polkadot_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: collectives_polkadot_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: collectives_polkadot_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + collectives_polkadot_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + // no need to pass anything to aura, in fact it will panic if we do. Session will take care + // of this. + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: collectives_polkadot_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + alliance: Default::default(), + alliance_motion: Default::default(), + }; + + genesis_config.build_storage().unwrap() + } +} + +pub mod bridge_hub_kusama { + use super::*; + pub const PARA_ID: u32 = 1002; + pub const ED: Balance = bridge_hub_kusama_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = bridge_hub_kusama_runtime::GenesisConfig { + system: bridge_hub_kusama_runtime::SystemConfig { + code: bridge_hub_kusama_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: bridge_hub_kusama_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: bridge_hub_kusama_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: bridge_hub_kusama_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + bridge_hub_kusama_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: bridge_hub_kusama_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} + +pub mod bridge_hub_polkadot { + use super::*; + pub const PARA_ID: u32 = 1002; + pub const ED: Balance = bridge_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; + + pub fn genesis() -> Storage { + let genesis_config = bridge_hub_polkadot_runtime::GenesisConfig { + system: bridge_hub_polkadot_runtime::SystemConfig { + code: bridge_hub_polkadot_runtime::WASM_BINARY + .expect("WASM binary was not build, please build it!") + .to_vec(), + }, + balances: bridge_hub_polkadot_runtime::BalancesConfig { + balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + }, + parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, + collator_selection: bridge_hub_polkadot_runtime::CollatorSelectionConfig { + invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + candidacy_bond: ED * 16, + ..Default::default() + }, + session: bridge_hub_polkadot_runtime::SessionConfig { + keys: collators::invulnerables() + .into_iter() + .map(|(acc, aura)| { + ( + acc.clone(), // account id + acc, // validator id + bridge_hub_polkadot_runtime::SessionKeys { aura }, // session keys + ) + }) + .collect(), + }, + aura: Default::default(), + aura_ext: Default::default(), + parachain_system: Default::default(), + polkadot_xcm: bridge_hub_polkadot_runtime::PolkadotXcmConfig { + safe_xcm_version: Some(SAFE_XCM_VERSION), + }, + }; + + genesis_config.build_storage().unwrap() + } +} diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/xcm-emulator/common/src/lib.rs index 2076dfbbd1c..f7a627ff346 100644 --- a/parachains/integration-tests/xcm-emulator/common/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/common/src/lib.rs @@ -7,8 +7,7 @@ use frame_support::{ use xcm::prelude::*; use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, RelayChain, Parachain}; use xcm_executor::traits::Convert; -use statemint_runtime::constants::currency::DOLLARS; -pub use constants::{polkadot, kusama, statemint, statemine, penpal, accounts::{ALICE, BOB}}; +pub use constants::{polkadot, kusama, statemint, statemine, penpal, collectives, bridge_hub_kusama, bridge_hub_polkadot, accounts::{ALICE, BOB}}; pub use sp_core::{Get, sr25519, storage::Storage}; pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; @@ -136,6 +135,66 @@ decl_test_parachains! { PolkadotXcm: penpal_runtime::PolkadotXcm, Assets: penpal_runtime::Assets, } + }, + pub struct Collectives { + genesis = collectives::genesis(), + on_init = (), + runtime = { + Runtime: collectives_polkadot_runtime::Runtime, + RuntimeOrigin: collectives_polkadot_runtime::RuntimeOrigin, + RuntimeCall: collectives_polkadot_runtime::RuntimeEvent, + RuntimeEvent: collectives_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: collectives_polkadot_runtime::XcmpQueue, + DmpMessageHandler: collectives_polkadot_runtime::DmpQueue, + LocationToAccountId: collectives_polkadot_runtime::xcm_config::LocationToAccountId, + System: collectives_polkadot_runtime::System, + Balances: collectives_polkadot_runtime::Balances, + ParachainSystem: collectives_polkadot_runtime::ParachainSystem, + ParachainInfo: collectives_polkadot_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: collectives_polkadot_runtime::PolkadotXcm, + } + }, + pub struct BHKusama { + genesis = bridge_hub_kusama::genesis(), + on_init = (), + runtime = { + Runtime: bridge_hub_kusama_runtime::Runtime, + RuntimeOrigin: bridge_hub_kusama_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_kusama_runtime::RuntimeEvent, + RuntimeEvent: bridge_hub_kusama_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_kusama_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_kusama_runtime::DmpQueue, + LocationToAccountId: bridge_hub_kusama_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_kusama_runtime::System, + Balances: bridge_hub_kusama_runtime::Balances, + ParachainSystem: bridge_hub_kusama_runtime::ParachainSystem, + ParachainInfo:bridge_hub_kusama_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: bridge_hub_kusama_runtime::PolkadotXcm, + } + }, + pub struct BHPolkadot { + genesis = bridge_hub_polkadot::genesis(), + on_init = (), + runtime = { + Runtime: bridge_hub_polkadot_runtime::Runtime, + RuntimeOrigin: bridge_hub_polkadot_runtime::RuntimeOrigin, + RuntimeCall: bridge_hub_polkadot_runtime::RuntimeEvent, + RuntimeEvent: bridge_hub_polkadot_runtime::RuntimeEvent, + XcmpMessageHandler: bridge_hub_polkadot_runtime::XcmpQueue, + DmpMessageHandler: bridge_hub_polkadot_runtime::DmpQueue, + LocationToAccountId: bridge_hub_polkadot_runtime::xcm_config::LocationToAccountId, + System: bridge_hub_polkadot_runtime::System, + Balances: bridge_hub_polkadot_runtime::Balances, + ParachainSystem: bridge_hub_polkadot_runtime::ParachainSystem, + ParachainInfo:bridge_hub_polkadot_runtime::ParachainInfo, + }, + pallets_extra = { + PolkadotXcm: bridge_hub_polkadot_runtime::PolkadotXcm, + } } } @@ -145,6 +204,8 @@ decl_test_networks! { parachains = vec![ Statemint, PenpalPolkadot, + Collectives, + BHPolkadot, ], }, pub struct KusamaMockNet { @@ -152,6 +213,7 @@ decl_test_networks! { parachains = vec![ Statemine, PenpalKusama, + BHKusama, ], } } @@ -175,20 +237,13 @@ parameter_types! { // Penpal Kusama pub PenpalKusamaSender: AccountId = PenpalKusama::account_id_of(ALICE); pub PenpalKusamaReceiver: AccountId = PenpalKusama::account_id_of(BOB); -} - - -pub const INITIAL_BALANCE: u128 = 1000 * DOLLARS; - -pub const XCM_VERSION_2: u32 = 3; -pub const XCM_VERSION_3: u32 = 2; - -pub fn parent_account_id() -> parachains_common::AccountId { - let location = (Parent,); - statemint_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() -} - -pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { - let location = (Parachain(para),); - polkadot_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() + // Collectives + pub CollectivesSender: AccountId = Collectives::account_id_of(ALICE); + pub CollectivesReceiver: AccountId = Collectives::account_id_of(BOB); + // Bridge Hub Polkadot + pub BHPolkadotSender: AccountId = BHPolkadot::account_id_of(ALICE); + pub BHPolkadotReceiver: AccountId = BHPolkadot::account_id_of(BOB); + // Bridge Hub Kusama + pub BHKusamaSender: AccountId = BHKusama::account_id_of(ALICE); + pub BHKusamaReceiver: AccountId = BHKusama::account_id_of(BOB); } From 0f6d89ae69ba7cc4bc9ad1193d262dcb7c509b49 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sun, 14 May 2023 21:43:17 +0200 Subject: [PATCH 51/60] test restructure --- .../xcm-emulator/assets/statemint/src/lib.rs | 13 +++- .../assets/statemint/src/tests/mod.rs | 3 + .../{ => src}/tests/reserve_transfer.rs | 3 +- .../statemint/{ => src}/tests/teleport.rs | 3 +- .../assets/statemint/src/tests/transact.rs | 59 +++++++++++++++++++ .../assets/statemint/tests/mod.rs | 3 - .../assets/statemint/tests/transact.rs | 37 ------------ 7 files changed, 75 insertions(+), 46 deletions(-) create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/mod.rs rename parachains/integration-tests/xcm-emulator/assets/statemint/{ => src}/tests/reserve_transfer.rs (96%) rename parachains/integration-tests/xcm-emulator/assets/statemint/{ => src}/tests/teleport.rs (96%) create mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs delete mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs delete mode 100644 parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs index d742c250542..6b9acc083a4 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs @@ -1,19 +1,28 @@ pub use frame_support::{ instances::Instance1, assert_ok, + pallet_prelude::Weight, + traits::{fungibles::Inspect}, }; +pub use codec::Encode; pub use polkadot_core_primitives::InboundDownwardMessage; pub use xcm::v3::{NetworkId::{Polkadot as PolkadotId, Kusama as KusamaId}, Error}; pub use xcm::prelude::*; pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx, assert_expected_events, cumulus_pallet_dmp_queue}; pub use integration_tests_common::{ AccountId, - PolkadotMockNet, KusamaMockNet, Polkadot, Kusama, Statemint, Statemine, PenpalPolkadot, PenpalKusama, + PolkadotMockNet, KusamaMockNet, + Polkadot, Kusama, Statemint, Statemine, PenpalPolkadot, PenpalKusama, + Collectives, BHKusama, BHPolkadot, + PolkadotPallet, KusamaPallet, StateminePallet, StatemintPallet, CollectivesPallet, + BHKusamaPallet, BHPolkadotPallet, PolkadotSender, PolkadotReceiver, KusamaSender, KusamaReceiver, StatemintSender, StatemintReceiver, StatemineSender, StatemineReceiver, + CollectivesReceiver, CollectivesSender, BHKusamaSender, BHKusamaReceiver, + BHPolkadotSender, BHPolkadotReceiver, PenpalPolkadotSender, PenpalPolkadotReceiver, PenpalKusamaSender, PenpalKusamaReceiver, constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}, XCM_V3}, }; #[cfg(test)] -mod tests {} +mod tests; diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/mod.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/mod.rs new file mode 100644 index 00000000000..996f9fd0aae --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/mod.rs @@ -0,0 +1,3 @@ +mod reserve_transfer; +mod teleport; +mod transact; diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/reserve_transfer.rs similarity index 96% rename from parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs rename to parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/reserve_transfer.rs index c1bab17c937..5b46dc881f6 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/reserve_transfer.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/reserve_transfer.rs @@ -1,5 +1,4 @@ -use integration_tests_common::PolkadotPallet; -use statemint_it::*; +use crate::*; #[test] fn reserve_transfer_native_asset_from_relay_to_assets() { diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/teleport.rs similarity index 96% rename from parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs rename to parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/teleport.rs index f7e8ad0455f..1c2e4915ad2 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/teleport.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/teleport.rs @@ -1,5 +1,4 @@ -use integration_tests_common::{PolkadotPallet}; -use statemint_it::*; +use crate::*; #[test] fn teleport_native_assets_from_relay_to_assets_para() { diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs new file mode 100644 index 00000000000..798f6c1929b --- /dev/null +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs @@ -0,0 +1,59 @@ +use crate::*; + +#[test] +fn transact_sudo_from_relay_to_assets_para() { + // Init tests variables + // Call to be executed in Assets Parachain + let call = ::RuntimeCall::Assets(pallet_assets::Call::< + ::Runtime, + Instance1, + >::force_create { + id: 1.into(), + is_sufficient: true, + min_balance: 1000, + owner: StatemintSender::get().into(), + }).encode().into(); + + // XcmPallet send arguments + let sudo_origin = ::RuntimeOrigin::root(); + let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); + + let weight_limit = WeightLimit::Unlimited; + let require_weight_at_most = Weight::from_parts(1000000000, 200000); + let origin_kind = OriginKind::Superuser; + let check_origin = None; + + let xcm = VersionedXcm::from( + Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { + require_weight_at_most, + origin_kind, + call, + }, + ]) + ); + + // Send XCM message from Relay Chain + Polkadot::execute_with(|| { + assert_ok!(::XcmPallet::send( + sudo_origin, + bx!(assets_para_destination), + bx!(xcm), + )); + + type RuntimeEvent = ::RuntimeEvent; + + assert_expected_events!( + Polkadot, + vec![ + RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) => {}, + ] + ); + }); + + // Receive XCM message in Assets Parachain + Statemint::execute_with(|| { + assert!(::Assets::asset_exists(1)); + }); +} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs deleted file mode 100644 index c1aa7035d67..00000000000 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod reserve_transfer; -pub mod teleport; -// pub mod transact; diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs deleted file mode 100644 index 5e62aefe4bd..00000000000 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/tests/transact.rs +++ /dev/null @@ -1,37 +0,0 @@ -// use statemint_it::*; - -// #[test] -// fn transact_sudo_from_relay_to_assets_para() { -// Polkadot::execute_with(|| { -// let call = statemint_runtime::RuntimeCall::Assets(pallet_assets::Call::< -// statemint_runtime::Runtime, -// Instance1, -// >::force_create { -// id: 1.into(), -// is_sufficient: true, -// min_balance: 1000, -// owner: ALICE.into(), -// }); -// let xcm = Xcm(vec![ -// UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, -// Transact { -// require_weight_at_most: Weight::from_parts(1000000000, 200000), -// origin_kind: OriginKind::Superuser, -// call: call.encode().into(), -// }, -// ]); -// assert_ok!(RelayChainPalletXcm::send( -// RuntimeOrigin::root(), -// Box::new(AP_DEST.into()), -// Box::new(VersionedXcm::from(xcm)), -// )); -// assert!(System::events().iter().any(|r| matches!( -// r.event, -// RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) -// ))); -// }); - -// Statemint::execute_with(|| { -// assert!(statemint_runtime::Assets::asset_exists(1)); -// }); -// } From 84dea0a8b31e7d5cba27eef889fd25b4d495b0b6 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sun, 14 May 2023 22:01:09 +0200 Subject: [PATCH 52/60] statemine removed --- Cargo.lock | 51 --- Cargo.toml | 3 +- .../xcm-emulator/assets/statemine/Cargo.toml | 36 -- .../xcm-emulator/assets/statemine/src/lib.rs | 2 - .../assets/statemine/tests/statemine.rs | 372 ------------------ 5 files changed, 1 insertion(+), 463 deletions(-) delete mode 100644 parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml delete mode 100644 parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs delete mode 100644 parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs diff --git a/Cargo.lock b/Cargo.lock index b95d2d84611..77ea6d506e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12721,32 +12721,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "statemine-it" -version = "1.0.0" -dependencies = [ - "frame-support", - "frame-system", - "integration-tests-common", - "kusama-runtime", - "pallet-assets", - "pallet-balances", - "pallet-xcm", - "parachains-common", - "parity-scale-codec", - "penpal-runtime", - "polkadot-core-primitives", - "polkadot-parachain", - "polkadot-runtime-parachains", - "sp-core", - "sp-runtime", - "sp-weights", - "statemine-runtime", - "xcm", - "xcm-emulator", - "xcm-executor", -] - [[package]] name = "statemine-runtime" version = "2.0.0" @@ -15357,31 +15331,6 @@ dependencies = [ "xcm-executor", ] -[[package]] -name = "xcm-emulator-example" -version = "0.1.0" -dependencies = [ - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-core", - "frame-support", - "frame-system", - "kusama-runtime", - "pallet-balances", - "pallet-xcm", - "parachain-info", - "parity-scale-codec", - "polkadot-parachain", - "polkadot-primitives", - "polkadot-runtime-parachains", - "proc-macro2", - "serde", - "sp-io", - "sp-runtime", - "test-runtime", - "xcm", - "xcm-emulator", -] - [[package]] name = "xcm-executor" version = "0.9.39" diff --git a/Cargo.toml b/Cargo.toml index 51705186116..66ae401c2a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,6 @@ members = [ "parachains/runtimes/contracts/contracts-rococo", "parachains/runtimes/testing/penpal", "parachains/integration-tests/xcm-emulator/common", - "parachains/integration-tests/xcm-emulator/assets/statemine", "parachains/integration-tests/xcm-emulator/assets/statemint", "test/client", "test/relay-sproof-builder", @@ -54,7 +53,7 @@ members = [ "test/runtime", "test/service", "xcm/xcm-emulator", - "xcm/xcm-emulator/example", + # "xcm/xcm-emulator/example", "xcm/xcm-emulator/test-runtime", ] diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml b/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml deleted file mode 100644 index 1cb25d869a3..00000000000 --- a/parachains/integration-tests/xcm-emulator/assets/statemine/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -name = "statemine-it" -version = "1.0.0" -authors = ["Parity Technologies "] -edition = "2021" -description = "Statemine parachain runtime integration tests with xcm-emulator" - -[dependencies] -codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } - -# Substrate -sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } -frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } -frame-system = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } -sp-core = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } -sp-weights = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-balances = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-assets = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" } - -# Polkadot -polkadot-core-primitives = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-parachain = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } -kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } -xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } -xcm-executor = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } -pallet-xcm = { default-features = false, git = "https://github.com/paritytech/polkadot", branch = "master" } - -# Cumulus -parachains-common = { path = "../../../../common" } -penpal-runtime = { path = "../../../../runtimes/testing/penpal" } -statemine-runtime = { path = "../../../../runtimes/assets/statemine" } - -# Local -xcm-emulator = { default-features = false, path = "../../../../../xcm/xcm-emulator" } -integration-tests-common = { default-features = false, path = "../../common" } diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs b/parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs deleted file mode 100644 index 5c6016f6a14..00000000000 --- a/parachains/integration-tests/xcm-emulator/assets/statemine/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[cfg(test)] -mod tests {} diff --git a/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs b/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs deleted file mode 100644 index a12bb4f9492..00000000000 --- a/parachains/integration-tests/xcm-emulator/assets/statemine/tests/statemine.rs +++ /dev/null @@ -1,372 +0,0 @@ -use frame_support::{ - assert_ok, - instances::Instance1, - pallet_prelude::Hooks, - sp_io, sp_tracing, - traits::{fungibles::Inspect, GenesisBuild}, -}; - -use codec::Encode; -use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_core::parameter_types; -use statemine_runtime::constants::currency::GRAND; -use xcm::prelude::*; -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt}; - -use xcm_executor::traits::Convert; - -use parachains_common::Balance; -use polkadot_core_primitives::InboundDownwardMessage; -use polkadot_parachain::primitives::DmpMessageHandler; -use sp_weights::Weight; -use xcm::{ - latest::{Ancestor, MultiLocation}, - prelude::{AccountId32, Here, Parachain}, - v3::Outcome, - VersionedMultiAssets, -}; - -pub const ALICE: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([0u8; 32]); -pub const BOB: sp_runtime::AccountId32 = sp_runtime::AccountId32::new([1u8; 32]); -pub const INITIAL_BALANCE: u128 = 1000 * GRAND; - -decl_test_parachain! { - pub struct Statemine { - Runtime = statemine_runtime::Runtime, - RuntimeOrigin = statemine_runtime::RuntimeOrigin, - XcmpMessageHandler = statemine_runtime::XcmpQueue, - DmpMessageHandler = statemine_runtime::DmpQueue, - new_ext = statemine_ext(), - } -} - -decl_test_parachain! { - pub struct Penpal { - Runtime = penpal_runtime::Runtime, - RuntimeOrigin = penpal_runtime::RuntimeOrigin, - XcmpMessageHandler = penpal_runtime::XcmpQueue, - DmpMessageHandler = penpal_runtime::DmpQueue, - new_ext = penpal_ext(), - } -} - -decl_test_relay_chain! { - pub struct Relay { - Runtime = kusama_runtime::Runtime, - XcmConfig = kusama_runtime::xcm_config::XcmConfig, - new_ext = relay_ext(), - } -} - -decl_test_network! { - pub struct MockNet { - relay_chain = Relay, - parachains = vec![ - (1000, Statemine), - (2000, Penpal), - ], - } -} - -// // Define Statemine TestExternalities. -// pub fn statemine_ext() -> sp_io::TestExternalities { -// use statemine_runtime::{Runtime, System}; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// sp_tracing::try_init_simple(); -// System::set_block_number(1); -// }); -// ext -// } - -// // Define Penpal TestExternalities. -// pub fn penpal_ext() -> sp_io::TestExternalities { -// use penpal_runtime::{Runtime, System}; - -// let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - -// pallet_balances::GenesisConfig:: { -// balances: vec![(ALICE, INITIAL_BALANCE), (parent_account_id(), INITIAL_BALANCE)], -// } -// .assimilate_storage(&mut t) -// .unwrap(); - -// let mut ext = sp_io::TestExternalities::new(t); -// ext.execute_with(|| { -// sp_tracing::try_init_simple(); -// System::set_block_number(1); -// }); -// ext -// } - -// Define Kusama TestExternalities. -pub fn relay_ext() -> sp_io::TestExternalities { - use kusama_runtime::{Runtime, RuntimeOrigin, System}; - - // ::XcmSender = RelayChainXcmRouter; - // ::XcmRouter = RelayChainXcmRouter; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: HostConfiguration { - max_upward_queue_count: 10, - max_upward_queue_size: 51200, - max_upward_message_size: 51200, - max_upward_message_num_per_candidate: 10, - max_downward_message_size: 51200, - ..Default::default() - }, - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![ - (ALICE, INITIAL_BALANCE), - (child_account_id(1000), INITIAL_BALANCE), - (child_account_id(2000), INITIAL_BALANCE), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| { - System::set_block_number(1); - }); - ext -} - -pub fn parent_account_id() -> parachains_common::AccountId { - let location = (Parent,); - statemine_runtime::xcm_config::LocationToAccountId::convert(location.into()).unwrap() -} - -pub fn child_account_id(para: u32) -> polkadot_core_primitives::AccountId { - let location = (Parachain(para),); - kusama_runtime::xcm_config::SovereignAccountOf::convert(location.into()).unwrap() -} - -pub type RelayChainPalletXcm = pallet_xcm::Pallet; -pub type StateminePalletXcm = pallet_xcm::Pallet; -pub type PenpalPalletXcm = pallet_xcm::Pallet; - -parameter_types! { - pub StatemineLocation: MultiLocation = (Ancestor(0), Parachain(1000)).into(); -} - -#[test] -// NOTE: This needs to be run before every other test to ensure that chains can communicate with one -// another. -fn force_xcm_version() { - let xcm_version = 3; - Relay::execute_with(|| { - use kusama_runtime::{RuntimeEvent, System}; - - let statemine_location: MultiLocation = (Ancestor(0), Parachain(1000)).into(); - let penpal_location: MultiLocation = (Ancestor(0), Parachain(2000)).into(); - - // Check that we can force xcm version for Statemine and Penpal from Kusama. - for location in [statemine_location, penpal_location] { - assert_ok!(RelayChainPalletXcm::force_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Box::new(location), - xcm_version, - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - } - }); - - // Penpal forces Kusama xcm version. - Penpal::execute_with(|| { - use penpal_runtime::{RuntimeEvent, System}; - - let location: MultiLocation = (Parent).into(); - - assert_ok!(PenpalPalletXcm::force_xcm_version( - penpal_runtime::RuntimeOrigin::root(), - Box::new(location), - xcm_version, - )); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged { - 0: loc, - 1: ver, - }) if loc == location && ver == xcm_version - ))); - }); -} - -// Direct message passing tests. -mod dmp { - use super::*; - use xcm::latest::Error; - use xcm_emulator::cumulus_pallet_dmp_queue; - - fn get_balances() -> (Balance, Balance) { - let mut relay_balance = Default::default(); - Relay::execute_with(|| { - relay_balance = - kusama_runtime::System::account::(ALICE.into()) - .data - .free; - }); - let mut assets_para_balance = Default::default(); - - Statemine::execute_with(|| { - assets_para_balance = - statemine_runtime::System::account::(ALICE.into()) - .data - .free; - }); - - (relay_balance, assets_para_balance) - } - - fn get_benf() -> Junction { - AccountId32 { network: None, id: ALICE.into() } - } - - const AP_DEST: (Ancestor, Junction) = (Ancestor(0), Parachain(1000)); - - #[test] - fn teleport_native_assets_relay_to_assets_para() { - force_xcm_version(); - let amount = 1000_000_000; - let assets: VersionedMultiAssets = (Here, amount).into(); - - let mut messages: Vec = Vec::new(); - - let (relay_balance, ap_balance) = get_balances(); - - Relay::execute_with(|| { - use kusama_runtime::{RuntimeEvent, RuntimeOrigin, System}; - - assert_ok!(RelayChainPalletXcm::limited_teleport_assets( - RuntimeOrigin::signed(ALICE.into()), - Box::new(AP_DEST.into()), - Box::new(get_benf().into()), - Box::new(assets), - 0, - WeightLimit::Unlimited, - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) - ))); - }); - - Statemine::execute_with(|| { - use statemine_runtime::{Runtime, RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - &r.event, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { who, .. }) - if *who == ALICE.into() - ))); - }); - - let (relay_balance_after, ap_balance_after) = get_balances(); - assert_eq!(relay_balance - amount, relay_balance_after); - assert!(ap_balance_after > ap_balance); - } - - #[test] - fn transact_sudo_relay_to_assets_para_works() { - force_xcm_version(); - - Relay::execute_with(|| { - use kusama_runtime::{RuntimeEvent, RuntimeOrigin, System}; - - let call = statemine_runtime::RuntimeCall::Assets(pallet_assets::Call::< - statemine_runtime::Runtime, - Instance1, - >::force_create { - id: 1.into(), - is_sufficient: true, - min_balance: 1000, - owner: ALICE.into(), - }); - let xcm = Xcm(vec![ - UnpaidExecution { weight_limit: WeightLimit::Unlimited, check_origin: None }, - Transact { - require_weight_at_most: Weight::from_parts(1000000000, 200000), - origin_kind: OriginKind::Superuser, - call: call.encode().into(), - }, - ]); - assert_ok!(RelayChainPalletXcm::send( - RuntimeOrigin::root(), - Box::new(AP_DEST.into()), - Box::new(VersionedXcm::from(xcm)), - )); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Sent { .. }) - ))); - }); - - Statemine::execute_with(|| { - assert!(statemine_runtime::Assets::asset_exists(1)); - }); - } - - #[test] - fn reserved_transfer_native_relay_to_assets_para_fails() { - force_xcm_version(); - let (relay_balance, ap_balance) = get_balances(); - let amount = 1000_000_000; - let assets: VersionedMultiAssets = (Here, amount).into(); - - Relay::execute_with(|| { - use kusama_runtime::{RuntimeEvent, RuntimeOrigin, System}; - - assert_ok!(RelayChainPalletXcm::limited_reserve_transfer_assets( - RuntimeOrigin::signed(ALICE.into()), - Box::new(AP_DEST.into()), - Box::new(get_benf().into()), - Box::new(assets), - 0, - WeightLimit::Unlimited, - )); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) - ))); - }); - - Statemine::execute_with(|| { - use statemine_runtime::{RuntimeEvent, System}; - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { - outcome: Outcome::Incomplete(_, Error::UntrustedReserveLocation), - .. - }) - ))); - }); - - let (relay_balance_after, ap_balance_after) = get_balances(); - assert_eq!(relay_balance - amount, relay_balance_after); - assert_eq!(ap_balance_after, ap_balance); - } -} From 406886cdd57e31884acf69f7cb41e2b44fc676fc Mon Sep 17 00:00:00 2001 From: NachoPal Date: Sun, 14 May 2023 23:40:42 +0200 Subject: [PATCH 53/60] nitpick --- .../xcm-emulator/assets/statemint/src/tests/transact.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs index 798f6c1929b..30ef497282d 100644 --- a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs +++ b/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs @@ -4,11 +4,13 @@ use crate::*; fn transact_sudo_from_relay_to_assets_para() { // Init tests variables // Call to be executed in Assets Parachain + const ASSET_ID: u32 = 1; + let call = ::RuntimeCall::Assets(pallet_assets::Call::< ::Runtime, Instance1, >::force_create { - id: 1.into(), + id: ASSET_ID.into(), is_sufficient: true, min_balance: 1000, owner: StatemintSender::get().into(), @@ -54,6 +56,6 @@ fn transact_sudo_from_relay_to_assets_para() { // Receive XCM message in Assets Parachain Statemint::execute_with(|| { - assert!(::Assets::asset_exists(1)); + assert!(::Assets::asset_exists(ASSET_ID)); }); } From 0f3afd23a75a5eab35d54af6abf622c52f9d4556 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 17 May 2023 15:00:11 +0200 Subject: [PATCH 54/60] rename test folder + events logs --- Cargo.lock | 29 +- Cargo.toml | 6 +- .../assets/statemint/Cargo.toml | 0 .../assets/statemint/src/lib.rs | 0 .../assets/statemint/src/tests/mod.rs | 0 .../statemint/src/tests/reserve_transfer.rs | 0 .../assets/statemint/src/tests/teleport.rs | 0 .../assets/statemint/src/tests/transact.rs | 0 .../common/Cargo.toml | 0 .../common/src/constants.rs | 0 .../common/src/lib.rs | 0 xcm/xcm-emulator/Cargo.toml | 1 + xcm/xcm-emulator/example/Cargo.toml | 37 -- xcm/xcm-emulator/example/src/lib.rs | 438 ------------------ xcm/xcm-emulator/src/lib.rs | 12 +- xcm/xcm-emulator/test-runtime/Cargo.toml | 71 --- xcm/xcm-emulator/test-runtime/src/lib.rs | 278 ----------- 17 files changed, 12 insertions(+), 860 deletions(-) rename parachains/integration-tests/{xcm-emulator => emulated}/assets/statemint/Cargo.toml (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/assets/statemint/src/lib.rs (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/assets/statemint/src/tests/mod.rs (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/assets/statemint/src/tests/reserve_transfer.rs (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/assets/statemint/src/tests/teleport.rs (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/assets/statemint/src/tests/transact.rs (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/common/Cargo.toml (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/common/src/constants.rs (100%) rename parachains/integration-tests/{xcm-emulator => emulated}/common/src/lib.rs (100%) delete mode 100644 xcm/xcm-emulator/example/Cargo.toml delete mode 100644 xcm/xcm-emulator/example/src/lib.rs delete mode 100644 xcm/xcm-emulator/test-runtime/Cargo.toml delete mode 100644 xcm/xcm-emulator/test-runtime/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 77ea6d506e1..130a84c2f30 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13248,34 +13248,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" -[[package]] -name = "test-runtime" -version = "0.1.0" -dependencies = [ - "cumulus-pallet-dmp-queue", - "cumulus-pallet-parachain-system", - "cumulus-pallet-xcm", - "cumulus-pallet-xcmp-queue", - "cumulus-primitives-utility", - "frame-support", - "frame-system", - "pallet-balances", - "pallet-xcm", - "parachain-info", - "parity-scale-codec", - "polkadot-parachain", - "polkadot-runtime-parachains", - "scale-info", - "serde", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "xcm", - "xcm-builder", - "xcm-executor", -] - [[package]] name = "test-runtime-constants" version = "0.9.39" @@ -15314,6 +15286,7 @@ dependencies = [ "cumulus-test-service", "frame-support", "frame-system", + "log", "pallet-balances", "parachain-info", "parachains-common", diff --git a/Cargo.toml b/Cargo.toml index 66ae401c2a3..2e709cda11f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,16 +45,14 @@ members = [ "parachains/runtimes/collectives/collectives-polkadot", "parachains/runtimes/contracts/contracts-rococo", "parachains/runtimes/testing/penpal", - "parachains/integration-tests/xcm-emulator/common", - "parachains/integration-tests/xcm-emulator/assets/statemint", + "parachains/integration-tests/emulated/common", + "parachains/integration-tests/emulated/assets/statemint", "test/client", "test/relay-sproof-builder", "test/relay-validation-worker-provider", "test/runtime", "test/service", "xcm/xcm-emulator", - # "xcm/xcm-emulator/example", - "xcm/xcm-emulator/test-runtime", ] [profile.release] diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml b/parachains/integration-tests/emulated/assets/statemint/Cargo.toml similarity index 100% rename from parachains/integration-tests/xcm-emulator/assets/statemint/Cargo.toml rename to parachains/integration-tests/emulated/assets/statemint/Cargo.toml diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs similarity index 100% rename from parachains/integration-tests/xcm-emulator/assets/statemint/src/lib.rs rename to parachains/integration-tests/emulated/assets/statemint/src/lib.rs diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/mod.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs similarity index 100% rename from parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/mod.rs rename to parachains/integration-tests/emulated/assets/statemint/src/tests/mod.rs diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/reserve_transfer.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs similarity index 100% rename from parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/reserve_transfer.rs rename to parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/teleport.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs similarity index 100% rename from parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/teleport.rs rename to parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs diff --git a/parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs similarity index 100% rename from parachains/integration-tests/xcm-emulator/assets/statemint/src/tests/transact.rs rename to parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs diff --git a/parachains/integration-tests/xcm-emulator/common/Cargo.toml b/parachains/integration-tests/emulated/common/Cargo.toml similarity index 100% rename from parachains/integration-tests/xcm-emulator/common/Cargo.toml rename to parachains/integration-tests/emulated/common/Cargo.toml diff --git a/parachains/integration-tests/xcm-emulator/common/src/constants.rs b/parachains/integration-tests/emulated/common/src/constants.rs similarity index 100% rename from parachains/integration-tests/xcm-emulator/common/src/constants.rs rename to parachains/integration-tests/emulated/common/src/constants.rs diff --git a/parachains/integration-tests/xcm-emulator/common/src/lib.rs b/parachains/integration-tests/emulated/common/src/lib.rs similarity index 100% rename from parachains/integration-tests/xcm-emulator/common/src/lib.rs rename to parachains/integration-tests/emulated/common/src/lib.rs diff --git a/xcm/xcm-emulator/Cargo.toml b/xcm/xcm-emulator/Cargo.toml index 2053e3b99a9..13877e1ff49 100644 --- a/xcm/xcm-emulator/Cargo.toml +++ b/xcm/xcm-emulator/Cargo.toml @@ -10,6 +10,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" } paste = "1.0.5" quote = "1.0.23" casey = "0.3.3" +log = { version = "0.4.17", default-features = false } frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } diff --git a/xcm/xcm-emulator/example/Cargo.toml b/xcm/xcm-emulator/example/Cargo.toml deleted file mode 100644 index 5d87c2dd5cf..00000000000 --- a/xcm/xcm-emulator/example/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "xcm-emulator-example" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2021" - -[dependencies] -serde = { version = "1.0.137", optional = true } -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -proc-macro2 = "1.0.40" - -frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "master" } -pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" } -sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" } - -cumulus-primitives-core = { path = "../../../primitives/core" } -cumulus-pallet-xcmp-queue = { path = "../../../pallets/xcmp-queue" } -parachain-info = { path = "../../../parachains/pallets/parachain-info" } - -xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } -kusama-runtime = { git = "https://github.com/paritytech/polkadot", branch = "master" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } - - -xcm-emulator = { path = ".." } -test-runtime = { path = "../test-runtime" } - -[features] -runtime-benchmarks = [ - "kusama-runtime/runtime-benchmarks", - "test-runtime/runtime-benchmarks", -] diff --git a/xcm/xcm-emulator/example/src/lib.rs b/xcm/xcm-emulator/example/src/lib.rs deleted file mode 100644 index 36c65c645ee..00000000000 --- a/xcm/xcm-emulator/example/src/lib.rs +++ /dev/null @@ -1,438 +0,0 @@ -// Copyright 2023 Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot 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. - -// Polkadot 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 Polkadot. If not, see . - -use frame_support::{pallet_prelude::Weight, traits::GenesisBuild}; -use sp_runtime::AccountId32; - -use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain}; - -decl_test_relay_chain! { - pub struct KusamaNet { - Runtime = kusama_runtime::Runtime, - XcmConfig = kusama_runtime::xcm_config::XcmConfig, - new_ext = kusama_ext(), - } -} - -decl_test_parachain! { - pub struct ParachainA { - Runtime = test_runtime::Runtime, - RuntimeOrigin = test_runtime::RuntimeOrigin, - XcmpMessageHandler = test_runtime::XcmpQueue, - DmpMessageHandler = test_runtime::DmpQueue, - new_ext = parachain_ext(1), - } -} - -decl_test_parachain! { - pub struct ParachainB { - Runtime = test_runtime::Runtime, - RuntimeOrigin = test_runtime::RuntimeOrigin, - XcmpMessageHandler = test_runtime::XcmpQueue, - DmpMessageHandler = test_runtime::DmpQueue, - new_ext = parachain_ext(2), - } -} - -decl_test_parachain! { - pub struct ParachainC { - Runtime = test_runtime::Runtime, - RuntimeOrigin = test_runtime::RuntimeOrigin, - XcmpMessageHandler = test_runtime::XcmpQueue, - DmpMessageHandler = test_runtime::DmpQueue, - new_ext = parachain_ext(3), - } -} - -decl_test_network! { - pub struct Network { - relay_chain = KusamaNet, - parachains = vec![ - (1, ParachainA), - (2, ParachainB), - (3, ParachainC), - ], - } -} - -pub const ALICE: AccountId32 = AccountId32::new([0u8; 32]); -pub const INITIAL_BALANCE: u128 = 1_000_000_000_000; - -pub fn parachain_ext(para_id: u32) -> sp_io::TestExternalities { - use test_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - let parachain_info_config = parachain_info::GenesisConfig { parachain_id: para_id.into() }; - - >::assimilate_storage( - ¶chain_info_config, - &mut t, - ) - .unwrap(); - - pallet_balances::GenesisConfig:: { balances: vec![(ALICE, INITIAL_BALANCE)] } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -fn default_parachains_host_configuration( -) -> polkadot_runtime_parachains::configuration::HostConfiguration< - polkadot_primitives::v4::BlockNumber, -> { - use polkadot_primitives::v4::{MAX_CODE_SIZE, MAX_POV_SIZE}; - - polkadot_runtime_parachains::configuration::HostConfiguration { - minimum_validation_upgrade_delay: 5, - validation_upgrade_cooldown: 10u32, - validation_upgrade_delay: 10, - code_retention_period: 1200, - max_code_size: MAX_CODE_SIZE, - max_pov_size: MAX_POV_SIZE, - max_head_data_size: 32 * 1024, - group_rotation_frequency: 20, - chain_availability_period: 4, - thread_availability_period: 4, - max_upward_queue_count: 8, - max_upward_queue_size: 1024 * 1024, - max_downward_message_size: 1024, - ump_service_total_weight: Weight::from_parts(4 * 1_000_000_000, 0), - max_upward_message_size: 50 * 1024, - max_upward_message_num_per_candidate: 5, - hrmp_sender_deposit: 0, - hrmp_recipient_deposit: 0, - hrmp_channel_max_capacity: 8, - hrmp_channel_max_total_size: 8 * 1024, - hrmp_max_parachain_inbound_channels: 4, - hrmp_max_parathread_inbound_channels: 4, - hrmp_channel_max_message_size: 1024 * 1024, - hrmp_max_parachain_outbound_channels: 4, - hrmp_max_parathread_outbound_channels: 4, - hrmp_max_message_num_per_candidate: 5, - dispute_period: 6, - no_show_slots: 2, - n_delay_tranches: 25, - needed_approvals: 2, - relay_vrf_modulo_samples: 2, - zeroth_delay_tranche_width: 0, - ..Default::default() - } -} - -pub fn kusama_ext() -> sp_io::TestExternalities { - use kusama_runtime::{Runtime, System}; - - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - - pallet_balances::GenesisConfig:: { balances: vec![(ALICE, INITIAL_BALANCE)] } - .assimilate_storage(&mut t) - .unwrap(); - - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: default_parachains_host_configuration(), - } - .assimilate_storage(&mut t) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -#[cfg(test)] -mod tests { - use super::*; - use codec::Encode; - - use cumulus_primitives_core::ParaId; - use frame_support::{assert_ok, dispatch::GetDispatchInfo, traits::Currency}; - use sp_runtime::traits::AccountIdConversion; - use xcm::{v3::prelude::*, VersionedMultiLocation, VersionedXcm}; - use xcm_emulator::TestExt; - - #[test] - fn dmp() { - Network::reset(); - - let remark = test_runtime::RuntimeCall::System( - frame_system::Call::::remark_with_event { - remark: "Hello from Kusama!".as_bytes().to_vec(), - }, - ); - KusamaNet::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - assert_ok!(kusama_runtime::XcmPallet::send_xcm( - Here, - Parachain(1), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts(INITIAL_BALANCE as u64, 1024 * 1024), - call: remark.encode().into(), - }]), - )); - }); - - ParachainA::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - }); - } - - #[test] - fn ump() { - Network::reset(); - - KusamaNet::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - let _ = kusama_runtime::Balances::deposit_creating( - &ParaId::from(1).into_account_truncating(), - 1_000_000_000_000, - ); - }); - - let remark = kusama_runtime::RuntimeCall::System(frame_system::Call::< - kusama_runtime::Runtime, - >::remark_with_event { - remark: "Hello from Pumpkin!".as_bytes().to_vec(), - }); - ParachainA::execute_with(|| { - assert_ok!(test_runtime::PolkadotXcm::force_default_xcm_version( - test_runtime::RuntimeOrigin::root(), - Some(3) - )); - assert_ok!(test_runtime::PolkadotXcm::send_xcm( - Here, - Parent, - Xcm(vec![ - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts( - INITIAL_BALANCE as u64, - 1024 * 1024 - ), - call: remark.encode().into(), - } - ]), - )); - }); - - KusamaNet::execute_with(|| { - use kusama_runtime::{RuntimeEvent, System}; - // TODO: https://github.com/paritytech/polkadot/pull/6824 or change this call to - // force_create_assets like we do in cumulus integration tests. - // assert!(System::events().iter().any(|r| matches!( - // r.event, - // RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - // ))); - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Ump(polkadot_runtime_parachains::ump::Event::ExecutedUpward( - _, - Outcome::Incomplete(_, XcmError::NoPermission) - )) - ))); - }); - } - - #[test] - fn xcmp() { - Network::reset(); - - let remark = test_runtime::RuntimeCall::System( - frame_system::Call::::remark_with_event { - remark: "Hello from Pumpkin!".as_bytes().to_vec(), - }, - ); - ParachainA::execute_with(|| { - assert_ok!(test_runtime::PolkadotXcm::send_xcm( - Here, - MultiLocation::new(1, X1(Parachain(2))), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: 20_000_000.into(), - call: remark.encode().into(), - }]), - )); - }); - - ParachainB::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - }); - } - - #[test] - fn xcmp_through_a_parachain() { - use test_runtime::{PolkadotXcm, Runtime, RuntimeCall}; - - Network::reset(); - - // The message goes through: Pumpkin --> Mushroom --> Octopus - let remark = RuntimeCall::System(frame_system::Call::::remark_with_event { - remark: "Hello from Pumpkin!".as_bytes().to_vec(), - }); - let send_xcm_to_octopus = RuntimeCall::PolkadotXcm(pallet_xcm::Call::::send { - dest: Box::new(VersionedMultiLocation::V3(MultiLocation::new(1, X1(Parachain(3))))), - message: Box::new(VersionedXcm::V3(Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: 10_000_000.into(), - call: remark.encode().into(), - }]))), - }); - assert_eq!( - send_xcm_to_octopus.get_dispatch_info().weight, - Weight::from_parts(110000010, 10000010) - ); - ParachainA::execute_with(|| { - assert_ok!(PolkadotXcm::send_xcm( - Here, - MultiLocation::new(1, X1(Parachain(2))), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: 110_000_010.into(), - call: send_xcm_to_octopus.encode().into(), - }]), - )); - }); - - ParachainB::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::PolkadotXcm(pallet_xcm::Event::Sent(_, _, _)) - ))); - }); - - ParachainC::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - // execution would fail, but good enough to check if the message is received - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { .. }) - ))); - }); - } - - #[test] - fn deduplicate_dmp() { - Network::reset(); - KusamaNet::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - }); - - kusama_send_rmrk("Kusama", 2); - parachain_receive_and_reset_events(true); - - // a different dmp message in same relay-parent-block allow execution. - kusama_send_rmrk("Polkadot", 1); - parachain_receive_and_reset_events(true); - - // same dmp message with same relay-parent-block wouldn't execution - kusama_send_rmrk("Kusama", 1); - parachain_receive_and_reset_events(false); - - // different relay-parent-block allow dmp message execution - KusamaNet::execute_with(|| kusama_runtime::System::set_block_number(2)); - - kusama_send_rmrk("Kusama", 1); - parachain_receive_and_reset_events(true); - - // reset can send same dmp message again - Network::reset(); - KusamaNet::execute_with(|| { - assert_ok!(kusama_runtime::XcmPallet::force_default_xcm_version( - kusama_runtime::RuntimeOrigin::root(), - Some(3) - )); - }); - - kusama_send_rmrk("Kusama", 1); - parachain_receive_and_reset_events(true); - } - - fn kusama_send_rmrk(msg: &str, count: u32) { - let remark = test_runtime::RuntimeCall::System( - frame_system::Call::::remark_with_event { - remark: msg.as_bytes().to_vec(), - }, - ); - KusamaNet::execute_with(|| { - for _ in 0..count { - assert_ok!(kusama_runtime::XcmPallet::send_xcm( - Here, - Parachain(1), - Xcm(vec![Transact { - origin_kind: OriginKind::SovereignAccount, - require_weight_at_most: Weight::from_parts( - INITIAL_BALANCE as u64, - 1024 * 1024 - ), - call: remark.encode().into(), - }]), - )); - } - }); - } - - fn parachain_receive_and_reset_events(received: bool) { - ParachainA::execute_with(|| { - use test_runtime::{RuntimeEvent, System}; - System::events().iter().for_each(|r| println!(">>> {:?}", r.event)); - - if received { - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - - System::reset_events(); - } else { - assert!(System::events().iter().all(|r| !matches!( - r.event, - RuntimeEvent::System(frame_system::Event::Remarked { sender: _, hash: _ }) - ))); - } - }); - } -} diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 7a4c199a87e..4afe0fc5850 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -17,7 +17,7 @@ pub use codec::Encode; pub use paste; pub use casey::pascal; - +pub use log; pub use frame_support::{ traits::{Get, Hooks}, weights::Weight, @@ -843,12 +843,15 @@ macro_rules! decl_test_networks { #[macro_export] macro_rules! assert_expected_events { ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { + // $crate::sp_tracing::enter_span!($crate::sp_tracing::Level::DEBUG, "test-span"); let mut message: Vec = Vec::new(); $( let mut meet_conditions = true; let mut event_message: Vec = Vec::new(); - let event_received = <$chain>::events().iter().any(|event| + let event_received = <$chain>::events().iter().any(|event| { + $crate::log::debug!(target: format!("events::{}", stringify!($chain)).to_lowercase().as_str(), "{:?}", event); + match event { $event_pat => { $( @@ -861,7 +864,7 @@ macro_rules! assert_expected_events { }, _ => false } - ); + }); if event_received && !meet_conditions { message.push(format!("\n\nEvent \x1b[31m{}\x1b[0m was received but some of its attributes did not meet the conditions:\n{}", stringify!($event_pat), event_message.concat())); @@ -872,7 +875,8 @@ macro_rules! assert_expected_events { if !message.is_empty() { panic!("{}", message.concat()) } - }; + } + } #[macro_export] diff --git a/xcm/xcm-emulator/test-runtime/Cargo.toml b/xcm/xcm-emulator/test-runtime/Cargo.toml deleted file mode 100644 index ac72f6a6ce2..00000000000 --- a/xcm/xcm-emulator/test-runtime/Cargo.toml +++ /dev/null @@ -1,71 +0,0 @@ -[package] -name = "test-runtime" -description = "A simple runtime for cross-chain messages tests." -license = "Apache-2.0" -version = "0.1.0" -authors = ["Parity Technologies "] -edition = "2021" - -[dependencies] -serde = { version = "1.0.137", optional = true } -codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false } -scale-info = { version = "2.1", default-features = false, features = ["derive"] } - -sp-runtime = { 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-std = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -sp-core = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" } -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" } - -cumulus-pallet-dmp-queue = { path = "../../../pallets/dmp-queue", default-features = false } -cumulus-pallet-xcmp-queue = { path = "../../../pallets/xcmp-queue", default-features = false } -parachain-info = { path = "../../../parachains/pallets/parachain-info", default-features = false } -cumulus-pallet-xcm = { path = "../../../pallets/xcm", default-features = false } -cumulus-pallet-parachain-system = { path = "../../../pallets/parachain-system", default-features = false } -cumulus-primitives-utility = { path = "../../../primitives/utility", default-features = false } - -xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } -xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "master" } -xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "master" } -pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "master" } -polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot", branch = "master" } - - -[features] -default = ["std"] -no_std = [] -std = [ - "serde/std", - "codec/std", - "scale-info/std", - - "sp-runtime/std", - "sp-io/std", - "sp-std/std", - "sp-core/std", - "pallet-balances/std", - "frame-support/std", - "frame-system/std", - - "cumulus-pallet-dmp-queue/std", - "cumulus-pallet-xcmp-queue/std", - "cumulus-pallet-xcm/std", - "cumulus-pallet-parachain-system/std", - "parachain-info/std", - "cumulus-primitives-utility/std", - - "xcm/std", - "xcm-executor/std", - "polkadot-parachain/std", - "xcm-builder/std", - "pallet-xcm/std", - "polkadot-runtime-parachains/std", -] - -runtime-benchmarks = [ - "pallet-xcm/runtime-benchmarks", - "xcm-builder/runtime-benchmarks", -] diff --git a/xcm/xcm-emulator/test-runtime/src/lib.rs b/xcm/xcm-emulator/test-runtime/src/lib.rs deleted file mode 100644 index 9010936892c..00000000000 --- a/xcm/xcm-emulator/test-runtime/src/lib.rs +++ /dev/null @@ -1,278 +0,0 @@ -// Copyright 2023 Parity Technologies (UK) Ltd. -// This file is part of Polkadot. - -// Polkadot 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. - -// Polkadot 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 Polkadot. If not, see . - -use frame_support::{ - construct_runtime, parameter_types, - traits::{ConstU32, Everything, Nothing}, - weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight}, -}; -use frame_system::EnsureRoot; -use pallet_xcm::XcmPassthrough; -use polkadot_parachain::primitives::Sibling; -use sp_core::H256; -use sp_runtime::{ - testing::Header, - traits::{Convert, IdentityLookup}, - AccountId32, -}; -use xcm::v3::prelude::*; -use xcm_builder::{ - AccountId32Aliases, AllowUnpaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin, - FixedWeightBounds, IsConcrete, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative, - SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32, - SovereignSignedViaLocation, -}; - -use xcm_executor::{Config, XcmExecutor}; - -pub type AccountId = AccountId32; -pub type Balance = u128; -pub type Amount = i128; - -parameter_types! { - pub const BlockHashCount: u64 = 250; -} - -impl frame_system::Config for Runtime { - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = u64; - type Hash = H256; - type Hashing = ::sp_runtime::traits::BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type BlockWeights = (); - type BlockLength = (); - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type DbWeight = (); - type BaseCallFilter = Everything; - type SystemWeightInfo = (); - type SS58Prefix = (); - type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; - type MaxConsumers = ConstU32<16>; -} - -parameter_types! { - pub ExistentialDeposit: Balance = 1; - pub const MaxLocks: u32 = 50; - pub const MaxReserves: u32 = 50; -} - -impl pallet_balances::Config for Runtime { - type MaxLocks = MaxLocks; - type Balance = Balance; - type RuntimeEvent = RuntimeEvent; - type DustRemoval = (); - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); - type MaxReserves = MaxReserves; - type ReserveIdentifier = [u8; 8]; - type HoldIdentifier = (); - type FreezeIdentifier = (); - type MaxHolds = (); - type MaxFreezes = (); -} - -impl parachain_info::Config for Runtime {} - -parameter_types! { - pub const RelayLocation: MultiLocation = MultiLocation::parent(); - pub const RelayNetwork: NetworkId = NetworkId::Kusama; - pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into(); - pub UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into())); -} - -pub type LocationToAccountId = ( - ParentIsPreset, - SiblingParachainConvertsVia, - AccountId32Aliases, -); - -pub type XcmOriginToCallOrigin = ( - SovereignSignedViaLocation, - RelayChainAsNative, - SiblingParachainAsNative, - SignedAccountId32AsNative, - XcmPassthrough, -); - -parameter_types! { - pub const UnitWeightCost: u64 = 10; - pub const MaxInstructions: u32 = 100; - pub const MaxAssetsIntoHolding: u32 = 64; - pub const RelayChain: MultiLocation = MultiLocation::parent(); -} - -/// Means for transacting assets on this chain. -pub type LocalAssetTransactor = CurrencyAdapter< - // Use this currency: - Balances, - // Use this currency when it is a fungible asset matching the given location or name: - IsConcrete, - // Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID: - LocationToAccountId, - // Our chain's account ID type (we can't get away without mentioning it explicitly): - AccountId, - // We don't track any teleports. - (), ->; - -/// The means for routing XCM messages which are not for local execution into -/// the right message queues. -pub type XcmRouter = ( - // Two routers - use UMP to communicate with the relay chain: - cumulus_primitives_utility::ParentAsUmp, - // ..and XCMP to communicate with the sibling chains. - XcmpQueue, -); - -pub type Barrier = AllowUnpaidExecutionFrom; - -pub struct XcmConfig; -impl Config for XcmConfig { - type RuntimeCall = RuntimeCall; - type XcmSender = XcmRouter; - type AssetTransactor = LocalAssetTransactor; - type OriginConverter = XcmOriginToCallOrigin; - type IsReserve = (); - type IsTeleporter = (); - type UniversalLocation = UniversalLocation; - type Barrier = Barrier; - type Weigher = FixedWeightBounds; - type Trader = (); - type ResponseHandler = (); - type AssetTrap = (); - type AssetClaims = (); - type SubscriptionService = (); - type AssetLocker = PolkadotXcm; - type AssetExchanger = (); - type PalletInstancesInfo = (); - type MaxAssetsIntoHolding = MaxAssetsIntoHolding; - type FeeManager = (); - type MessageExporter = (); - type UniversalAliases = Nothing; - type CallDispatcher = RuntimeCall; - type SafeCallFilter = Everything; -} - -parameter_types! { - pub const ReservedXcmpWeight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4), 0); - pub const ReservedDmpWeight: Weight = Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND.saturating_div(4), 0); -} - -impl cumulus_pallet_parachain_system::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type OnSystemEvent = (); - type SelfParaId = ParachainInfo; - type DmpMessageHandler = DmpQueue; - type ReservedDmpWeight = ReservedDmpWeight; - type OutboundXcmpMessageSource = XcmpQueue; - type XcmpMessageHandler = XcmpQueue; - type ReservedXcmpWeight = ReservedXcmpWeight; - type CheckAssociatedRelayNumber = cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; -} - -impl cumulus_pallet_xcmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; - type ChannelInfo = ParachainSystem; - type VersionWrapper = (); - type ExecuteOverweightOrigin = EnsureRoot; - type ControllerOrigin = EnsureRoot; - type ControllerOriginConverter = XcmOriginToCallOrigin; - type WeightInfo = (); - type PriceForSiblingDelivery = (); -} - -impl cumulus_pallet_dmp_queue::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; - type ExecuteOverweightOrigin = EnsureRoot; -} - -impl cumulus_pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type XcmExecutor = XcmExecutor; -} - -#[cfg(feature = "runtime-benchmarks")] -parameter_types! { - pub ReachableDest: Option = Some(Parent.into()); -} - -pub type LocalOriginToLocation = SignedToAccountId32; - -impl pallet_xcm::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type SendXcmOrigin = EnsureXcmOrigin; - type XcmRouter = XcmRouter; - type ExecuteXcmOrigin = EnsureXcmOrigin; - type XcmExecuteFilter = Everything; - type XcmExecutor = XcmExecutor; - type XcmTeleportFilter = Nothing; - type XcmReserveTransferFilter = Everything; - type Weigher = FixedWeightBounds; - type UniversalLocation = UniversalLocation; - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100; - type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; - type Currency = Balances; - type CurrencyMatcher = (); - type TrustedLockers = (); - type SovereignAccountOf = (); - type MaxLockers = ConstU32<8>; - type WeightInfo = pallet_xcm::TestWeightInfo; - type AdminOrigin = EnsureRoot; - #[cfg(feature = "runtime-benchmarks")] - type ReachableDest = ReachableDest; -} - -pub struct AccountIdToMultiLocation; -impl Convert for AccountIdToMultiLocation { - fn convert(account: AccountId) -> MultiLocation { - X1(Junction::AccountId32 { network: None, id: account.into() }).into() - } -} - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; - -construct_runtime!( - pub enum Runtime where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: frame_system::{Pallet, Call, Storage, Config, Event}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Config, Event}, - ParachainInfo: parachain_info::{Pallet, Storage, Config}, - XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event}, - DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event}, - CumulusXcm: cumulus_pallet_xcm::{Pallet, Event, Origin}, - PolkadotXcm: pallet_xcm::{Pallet, Call, Event, Origin}, - } -); From dc7ff20b3dba914fd1ae41f7e86ca933273a8a9b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 17 May 2023 16:33:08 +0200 Subject: [PATCH 55/60] clean --- xcm/xcm-emulator/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 4afe0fc5850..15d9ea144d3 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -843,7 +843,6 @@ macro_rules! decl_test_networks { #[macro_export] macro_rules! assert_expected_events { ( $chain:ident, vec![$( $event_pat:pat => { $($attr:ident : $condition:expr, )* }, )*] ) => { - // $crate::sp_tracing::enter_span!($crate::sp_tracing::Level::DEBUG, "test-span"); let mut message: Vec = Vec::new(); $( let mut meet_conditions = true; From b21d95d89971b477a433bcbb2f238e777572c362 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 17 May 2023 18:04:18 +0200 Subject: [PATCH 56/60] weight threshold helper --- .../emulated/assets/statemint/src/lib.rs | 4 ++-- .../statemint/src/tests/reserve_transfer.rs | 4 +++- .../emulated/common/src/constants.rs | 2 ++ xcm/xcm-emulator/src/lib.rs | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/parachains/integration-tests/emulated/assets/statemint/src/lib.rs b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs index 6b9acc083a4..1ca39507bb8 100644 --- a/parachains/integration-tests/emulated/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs @@ -8,7 +8,7 @@ pub use codec::Encode; pub use polkadot_core_primitives::InboundDownwardMessage; pub use xcm::v3::{NetworkId::{Polkadot as PolkadotId, Kusama as KusamaId}, Error}; pub use xcm::prelude::*; -pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx, assert_expected_events, cumulus_pallet_dmp_queue}; +pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx, assert_expected_events, cumulus_pallet_dmp_queue, helpers::weight_within_threshold}; pub use integration_tests_common::{ AccountId, PolkadotMockNet, KusamaMockNet, @@ -21,7 +21,7 @@ pub use integration_tests_common::{ CollectivesReceiver, CollectivesSender, BHKusamaSender, BHKusamaReceiver, BHPolkadotSender, BHPolkadotReceiver, PenpalPolkadotSender, PenpalPolkadotReceiver, PenpalKusamaSender, PenpalKusamaReceiver, - constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}, XCM_V3}, + constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}, XCM_V3, REF_TIME_THRESHOLD, PROOF_SIZE_THRESHOLD}, }; #[cfg(test)] diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs index 5b46dc881f6..34f2fb73818 100644 --- a/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs @@ -30,7 +30,9 @@ fn reserve_transfer_native_asset_from_relay_to_assets() { assert_expected_events!( Polkadot, vec![ - RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete { .. })) => {}, + RuntimeEvent::XcmPallet(pallet_xcm::Event::Attempted(Outcome::Complete(weight))) => { + weight: weight_within_threshold((REF_TIME_THRESHOLD, PROOF_SIZE_THRESHOLD), Weight::from_parts(2_000_000_000, 0), *weight), + }, ] ); }); diff --git a/parachains/integration-tests/emulated/common/src/constants.rs b/parachains/integration-tests/emulated/common/src/constants.rs index 10a3a63846c..8804ba62faa 100644 --- a/parachains/integration-tests/emulated/common/src/constants.rs +++ b/parachains/integration-tests/emulated/common/src/constants.rs @@ -13,6 +13,8 @@ use pallet_im_online::sr25519::AuthorityId as ImOnlineId; pub const XCM_V2: u32 = 3; pub const XCM_V3: u32 = 2; +pub const REF_TIME_THRESHOLD: u64 = 33; +pub const PROOF_SIZE_THRESHOLD: u64 = 33; pub mod accounts { use super::*; diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index 15d9ea144d3..ae3bbc7d002 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -884,3 +884,22 @@ macro_rules! bx { Box::new($e) }; } + +pub mod helpers { + use super::Weight; + + pub fn within_threshold(threshold: u64, expected_value: u64, current_value: u64) -> bool { + let margin = (current_value * threshold) / 100; + let lower_limit = expected_value - margin; + let upper_limit = expected_value + margin; + + current_value >= lower_limit && current_value <= upper_limit + } + + pub fn weight_within_threshold((threshold_time, threshold_size): (u64, u64), expected_weight: Weight, weight: Weight) -> bool { + let ref_time_within = within_threshold(threshold_time, expected_weight.ref_time(), weight.ref_time()); + let proof_size_within = within_threshold(threshold_size, expected_weight.proof_size(), weight.proof_size()); + + ref_time_within && proof_size_within + } +} From 478549e84aec09aacee0c2975d2e5dbb56208eea Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 17 May 2023 18:12:50 +0200 Subject: [PATCH 57/60] update readme --- xcm/xcm-emulator/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xcm/xcm-emulator/README.md b/xcm/xcm-emulator/README.md index 384a781fab4..2d92c684f6e 100644 --- a/xcm/xcm-emulator/README.md +++ b/xcm/xcm-emulator/README.md @@ -9,8 +9,9 @@ a zombienet and as all the chains are in one process debugging using Clion is ea ## Limitations -As the channels are mocked, using xcm-emulator tests to test -channel setup would not be appropriate. +As the messages do not physically go through the same messaging infrastructure +there is some code that is not being tested compared to using slower E2E tests. +In future it may be possible to run these XCM emulated tests as E2E tests (without changes). ## Alternatives @@ -77,7 +78,7 @@ Here is a test that upgrades the XCM to v3 and then sends a remark: kusama_runtime::RuntimeOrigin::root(), Some(3) )); - + assert_ok!(test_runtime::PolkadotXcm::send_xcm( Here, MultiLocation::new(1, X1(Parachain(2))), From c4bbcad41362308ec44c8403d1e8f2f4d5a74303 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 17 May 2023 18:27:47 +0200 Subject: [PATCH 58/60] remove cumulus-test-service dependancy --- Cargo.lock | 1 - .../emulated/common/Cargo.toml | 1 - .../emulated/common/src/constants.rs | 22 ++++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0d4490a401..85c7b66afad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4771,7 +4771,6 @@ dependencies = [ "bridge-hub-polkadot-runtime", "collectives-polkadot-runtime", "cumulus-primitives-core", - "cumulus-test-service", "frame-support", "frame-system", "kusama-runtime", diff --git a/parachains/integration-tests/emulated/common/Cargo.toml b/parachains/integration-tests/emulated/common/Cargo.toml index 0f96494453c..8ea8c1d0f8a 100644 --- a/parachains/integration-tests/emulated/common/Cargo.toml +++ b/parachains/integration-tests/emulated/common/Cargo.toml @@ -39,7 +39,6 @@ pallet-xcm = { default-features = false, git = "https://github.com/paritytech/po # Cumulus parachains-common = { path = "../../../common" } parachain-info = { path = "../../../pallets/parachain-info" } -cumulus-test-service = { path = "../../../../test/service" } cumulus-primitives-core = { path = "../../../../primitives/core" } penpal-runtime = { path = "../../../runtimes/testing/penpal" } statemint-runtime = { path = "../../../runtimes/assets/statemint" } diff --git a/parachains/integration-tests/emulated/common/src/constants.rs b/parachains/integration-tests/emulated/common/src/constants.rs index 8804ba62faa..92f341f113e 100644 --- a/parachains/integration-tests/emulated/common/src/constants.rs +++ b/parachains/integration-tests/emulated/common/src/constants.rs @@ -1,11 +1,10 @@ pub use polkadot_runtime_parachains::configuration::HostConfiguration; use polkadot_primitives::{AssignmentId, ValidatorId}; pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; -pub use cumulus_test_service::{get_account_id_from_seed, get_from_seed}; pub use xcm; use grandpa::AuthorityId as GrandpaId; -use sp_core::{sr25519, storage::Storage}; -use sp_runtime::{Perbill, BuildStorage}; +use sp_core::{sr25519, storage::Storage, Pair, Public}; +use sp_runtime::{Perbill, BuildStorage, MultiSignature, traits::{Verify, IdentifyAccount}}; use sp_consensus_babe::AuthorityId as BabeId; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; @@ -16,6 +15,23 @@ pub const XCM_V3: u32 = 2; pub const REF_TIME_THRESHOLD: u64 = 33; pub const PROOF_SIZE_THRESHOLD: u64 = 33; +type AccountPublic = ::Signer; + +/// Helper function to generate a crypto pair from seed +fn get_from_seed(seed: &str) -> ::Public { + TPublic::Pair::from_string(&format!("//{}", seed), None) + .expect("static values are valid; qed") + .public() +} + +/// Helper function to generate an account ID from seed. +fn get_account_id_from_seed(seed: &str) -> AccountId +where + AccountPublic: From<::Public>, +{ + AccountPublic::from(get_from_seed::(seed)).into_account() +} + pub mod accounts { use super::*; pub const ALICE: &str = "Alice"; From 28b418bdbcce638ff59cc4d7929a9fbec4ba453b Mon Sep 17 00:00:00 2001 From: NachoPal Date: Wed, 17 May 2023 18:34:39 +0200 Subject: [PATCH 59/60] fmt --- .../emulated/assets/statemint/src/lib.rs | 47 +++-- .../statemint/src/tests/reserve_transfer.rs | 6 +- .../assets/statemint/src/tests/teleport.rs | 6 +- .../assets/statemint/src/tests/transact.rs | 21 +- .../emulated/common/src/constants.rs | 179 +++++++++++++----- .../emulated/common/src/lib.rs | 18 +- xcm/xcm-emulator/src/lib.rs | 98 ++++++---- 7 files changed, 246 insertions(+), 129 deletions(-) diff --git a/parachains/integration-tests/emulated/assets/statemint/src/lib.rs b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs index 1ca39507bb8..f7ca680a800 100644 --- a/parachains/integration-tests/emulated/assets/statemint/src/lib.rs +++ b/parachains/integration-tests/emulated/assets/statemint/src/lib.rs @@ -1,27 +1,32 @@ +pub use codec::Encode; pub use frame_support::{ - instances::Instance1, - assert_ok, - pallet_prelude::Weight, - traits::{fungibles::Inspect}, + assert_ok, instances::Instance1, pallet_prelude::Weight, traits::fungibles::Inspect, }; -pub use codec::Encode; -pub use polkadot_core_primitives::InboundDownwardMessage; -pub use xcm::v3::{NetworkId::{Polkadot as PolkadotId, Kusama as KusamaId}, Error}; -pub use xcm::prelude::*; -pub use xcm_emulator::{TestExt, RelayChain as Relay, Parachain as Para, bx, assert_expected_events, cumulus_pallet_dmp_queue, helpers::weight_within_threshold}; pub use integration_tests_common::{ - AccountId, - PolkadotMockNet, KusamaMockNet, - Polkadot, Kusama, Statemint, Statemine, PenpalPolkadot, PenpalKusama, - Collectives, BHKusama, BHPolkadot, - PolkadotPallet, KusamaPallet, StateminePallet, StatemintPallet, CollectivesPallet, - BHKusamaPallet, BHPolkadotPallet, - PolkadotSender, PolkadotReceiver, KusamaSender, KusamaReceiver, - StatemintSender, StatemintReceiver, StatemineSender, StatemineReceiver, - CollectivesReceiver, CollectivesSender, BHKusamaSender, BHKusamaReceiver, - BHPolkadotSender, BHPolkadotReceiver, - PenpalPolkadotSender, PenpalPolkadotReceiver, PenpalKusamaSender, PenpalKusamaReceiver, - constants::{accounts::{ALICE, BOB}, polkadot::{ED as POLKADOT_ED}, XCM_V3, REF_TIME_THRESHOLD, PROOF_SIZE_THRESHOLD}, + constants::{ + accounts::{ALICE, BOB}, + polkadot::ED as POLKADOT_ED, + PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V3, + }, + AccountId, BHKusama, BHKusamaPallet, BHKusamaReceiver, BHKusamaSender, BHPolkadot, + BHPolkadotPallet, BHPolkadotReceiver, BHPolkadotSender, Collectives, CollectivesPallet, + CollectivesReceiver, CollectivesSender, Kusama, KusamaMockNet, KusamaPallet, KusamaReceiver, + KusamaSender, PenpalKusama, PenpalKusamaReceiver, PenpalKusamaSender, PenpalPolkadot, + PenpalPolkadotReceiver, PenpalPolkadotSender, Polkadot, PolkadotMockNet, PolkadotPallet, + PolkadotReceiver, PolkadotSender, Statemine, StateminePallet, StatemineReceiver, + StatemineSender, Statemint, StatemintPallet, StatemintReceiver, StatemintSender, +}; +pub use polkadot_core_primitives::InboundDownwardMessage; +pub use xcm::{ + prelude::*, + v3::{ + Error, + NetworkId::{Kusama as KusamaId, Polkadot as PolkadotId}, + }, +}; +pub use xcm_emulator::{ + assert_expected_events, bx, cumulus_pallet_dmp_queue, helpers::weight_within_threshold, + Parachain as Para, RelayChain as Relay, TestExt, }; #[cfg(test)] diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs index 34f2fb73818..55d201c5608 100644 --- a/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/reserve_transfer.rs @@ -8,8 +8,10 @@ fn reserve_transfer_native_asset_from_relay_to_assets() { let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); - let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); - let beneficiary: VersionedMultiLocation = AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); let native_assets: VersionedMultiAssets = (Here, amount).into(); let fee_asset_item = 0; let weight_limit = WeightLimit::Unlimited; diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs index 1c2e4915ad2..163db77ddfd 100644 --- a/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/teleport.rs @@ -8,8 +8,10 @@ fn teleport_native_assets_from_relay_to_assets_para() { let para_receiver_balance_before = Statemint::account_data_of(StatemintReceiver::get()).free; let origin = ::RuntimeOrigin::signed(PolkadotSender::get()); - let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); - let beneficiary: VersionedMultiLocation = AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); + let beneficiary: VersionedMultiLocation = + AccountId32 { network: None, id: StatemintReceiver::get().into() }.into(); let native_assets: VersionedMultiAssets = (Here, amount).into(); let fee_asset_item = 0; let weight_limit = WeightLimit::Unlimited; diff --git a/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs b/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs index 30ef497282d..9220d914e47 100644 --- a/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs +++ b/parachains/integration-tests/emulated/assets/statemint/src/tests/transact.rs @@ -14,27 +14,24 @@ fn transact_sudo_from_relay_to_assets_para() { is_sufficient: true, min_balance: 1000, owner: StatemintSender::get().into(), - }).encode().into(); + }) + .encode() + .into(); // XcmPallet send arguments let sudo_origin = ::RuntimeOrigin::root(); - let assets_para_destination: VersionedMultiLocation = Polkadot::child_location_of(Statemint::para_id()).into(); + let assets_para_destination: VersionedMultiLocation = + Polkadot::child_location_of(Statemint::para_id()).into(); let weight_limit = WeightLimit::Unlimited; let require_weight_at_most = Weight::from_parts(1000000000, 200000); let origin_kind = OriginKind::Superuser; let check_origin = None; - let xcm = VersionedXcm::from( - Xcm(vec![ - UnpaidExecution { weight_limit, check_origin }, - Transact { - require_weight_at_most, - origin_kind, - call, - }, - ]) - ); + let xcm = VersionedXcm::from(Xcm(vec![ + UnpaidExecution { weight_limit, check_origin }, + Transact { require_weight_at_most, origin_kind, call }, + ])); // Send XCM message from Relay Chain Polkadot::execute_with(|| { diff --git a/parachains/integration-tests/emulated/common/src/constants.rs b/parachains/integration-tests/emulated/common/src/constants.rs index 92f341f113e..b9720db4cf0 100644 --- a/parachains/integration-tests/emulated/common/src/constants.rs +++ b/parachains/integration-tests/emulated/common/src/constants.rs @@ -1,14 +1,17 @@ -pub use polkadot_runtime_parachains::configuration::HostConfiguration; -use polkadot_primitives::{AssignmentId, ValidatorId}; -pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; -pub use xcm; use grandpa::AuthorityId as GrandpaId; -use sp_core::{sr25519, storage::Storage, Pair, Public}; -use sp_runtime::{Perbill, BuildStorage, MultiSignature, traits::{Verify, IdentifyAccount}}; -use sp_consensus_babe::AuthorityId as BabeId; -use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; -use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; +pub use parachains_common::{AccountId, AuraId, Balance, BlockNumber, StatemintAuraId}; +use polkadot_primitives::{AssignmentId, ValidatorId}; +pub use polkadot_runtime_parachains::configuration::HostConfiguration; +use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; +use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; +use sp_consensus_babe::AuthorityId as BabeId; +use sp_core::{sr25519, storage::Storage, Pair, Public}; +use sp_runtime::{ + traits::{IdentifyAccount, Verify}, + BuildStorage, MultiSignature, Perbill, +}; +pub use xcm; pub const XCM_V2: u32 = 3; pub const XCM_V3: u32 = 2; @@ -87,10 +90,7 @@ pub mod collators { get_account_id_from_seed::("Alice"), get_from_seed::("Alice"), ), - ( - get_account_id_from_seed::("Bob"), - get_from_seed::("Bob"), - ), + (get_account_id_from_seed::("Bob"), get_from_seed::("Bob")), ] } } @@ -151,9 +151,15 @@ pub mod polkadot { pub fn genesis() -> Storage { let genesis_config = polkadot_runtime::GenesisConfig { - system: polkadot_runtime::SystemConfig { code: polkadot_runtime::WASM_BINARY.unwrap().to_vec() }, + system: polkadot_runtime::SystemConfig { + code: polkadot_runtime::WASM_BINARY.unwrap().to_vec(), + }, balances: polkadot_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), }, indices: polkadot_runtime::IndicesConfig { indices: vec![] }, session: polkadot_runtime::SessionConfig { @@ -180,16 +186,24 @@ pub mod polkadot { minimum_validator_count: 1, stakers: validators::initial_authorities() .iter() - .map(|x| (x.0.clone(), x.1.clone(), STASH, polkadot_runtime::StakerStatus::Validator)) + .map(|x| { + (x.0.clone(), x.1.clone(), STASH, polkadot_runtime::StakerStatus::Validator) + }) + .collect(), + invulnerables: validators::initial_authorities() + .iter() + .map(|x| x.0.clone()) .collect(), - invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(), force_era: pallet_staking::Forcing::ForceNone, slash_reward_fraction: Perbill::from_percent(10), ..Default::default() }, phragmen_election: Default::default(), democracy: Default::default(), - council: polkadot_runtime::CouncilConfig { members: vec![], phantom: Default::default() }, + council: polkadot_runtime::CouncilConfig { + members: vec![], + phantom: Default::default(), + }, technical_committee: polkadot_runtime::TechnicalCommitteeConfig { members: vec![], phantom: Default::default(), @@ -206,9 +220,7 @@ pub mod polkadot { vesting: polkadot_runtime::VestingConfig { vesting: vec![] }, treasury: Default::default(), hrmp: Default::default(), - configuration: polkadot_runtime::ConfigurationConfig { - config: get_host_config(), - }, + configuration: polkadot_runtime::ConfigurationConfig { config: get_host_config() }, paras: Default::default(), xcm_pallet: Default::default(), nomination_pools: Default::default(), @@ -255,9 +267,15 @@ pub mod kusama { pub fn genesis() -> Storage { let genesis_config = kusama_runtime::GenesisConfig { - system: kusama_runtime::SystemConfig { code: kusama_runtime::WASM_BINARY.unwrap().to_vec() }, + system: kusama_runtime::SystemConfig { + code: kusama_runtime::WASM_BINARY.unwrap().to_vec(), + }, balances: kusama_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), }, indices: kusama_runtime::IndicesConfig { indices: vec![] }, session: kusama_runtime::SessionConfig { @@ -284,9 +302,14 @@ pub mod kusama { validator_count: validators::initial_authorities().len() as u32, stakers: validators::initial_authorities() .iter() - .map(|x| (x.0.clone(), x.1.clone(), STASH, kusama_runtime::StakerStatus::Validator)) + .map(|x| { + (x.0.clone(), x.1.clone(), STASH, kusama_runtime::StakerStatus::Validator) + }) + .collect(), + invulnerables: validators::initial_authorities() + .iter() + .map(|x| x.0.clone()) .collect(), - invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(), force_era: pallet_staking::Forcing::NotForcing, slash_reward_fraction: Perbill::from_percent(10), ..Default::default() @@ -302,9 +325,7 @@ pub mod kusama { vesting: kusama_runtime::VestingConfig { vesting: vec![] }, treasury: Default::default(), hrmp: Default::default(), - configuration: kusama_runtime::ConfigurationConfig { - config: get_host_config(), - }, + configuration: kusama_runtime::ConfigurationConfig { config: get_host_config() }, paras: Default::default(), xcm_pallet: Default::default(), nomination_pools: Default::default(), @@ -329,11 +350,19 @@ pub mod statemint { .to_vec(), }, balances: statemint_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), }, parachain_info: statemint_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, collator_selection: statemint_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables_statemint().iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: collators::invulnerables_statemint() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), candidacy_bond: ED * 16, ..Default::default() }, @@ -342,8 +371,8 @@ pub mod statemint { .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id + acc.clone(), // account id + acc, // validator id statemint_runtime::SessionKeys { aura }, // session keys ) }) @@ -375,11 +404,19 @@ pub mod statemine { .to_vec(), }, balances: statemine_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), }, parachain_info: statemine_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, collator_selection: statemine_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), candidacy_bond: ED * 16, ..Default::default() }, @@ -388,8 +425,8 @@ pub mod statemine { .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id + acc.clone(), // account id + acc, // validator id statemine_runtime::SessionKeys { aura }, // session keys ) }) @@ -421,11 +458,19 @@ pub mod penpal { .to_vec(), }, balances: penpal_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), }, parachain_info: penpal_runtime::ParachainInfoConfig { parachain_id: para_id.into() }, collator_selection: penpal_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), candidacy_bond: ED * 16, ..Default::default() }, @@ -434,8 +479,8 @@ pub mod penpal { .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id + acc.clone(), // account id + acc, // validator id penpal_runtime::SessionKeys { aura }, // session keys ) }) @@ -470,11 +515,21 @@ pub mod collectives { .to_vec(), }, balances: collectives_polkadot_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), }, - parachain_info: collectives_polkadot_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, collator_selection: collectives_polkadot_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), candidacy_bond: ED * 16, ..Default::default() }, @@ -483,8 +538,8 @@ pub mod collectives { .into_iter() .map(|(acc, aura)| { ( - acc.clone(), // account id - acc, // validator id + acc.clone(), // account id + acc, // validator id collectives_polkadot_runtime::SessionKeys { aura }, // session keys ) }) @@ -519,11 +574,21 @@ pub mod bridge_hub_kusama { .to_vec(), }, balances: bridge_hub_kusama_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), }, - parachain_info: bridge_hub_kusama_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, collator_selection: bridge_hub_kusama_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), candidacy_bond: ED * 16, ..Default::default() }, @@ -557,18 +622,28 @@ pub mod bridge_hub_polkadot { pub const ED: Balance = bridge_hub_polkadot_runtime::constants::currency::EXISTENTIAL_DEPOSIT; pub fn genesis() -> Storage { - let genesis_config = bridge_hub_polkadot_runtime::GenesisConfig { + let genesis_config = bridge_hub_polkadot_runtime::GenesisConfig { system: bridge_hub_polkadot_runtime::SystemConfig { code: bridge_hub_polkadot_runtime::WASM_BINARY .expect("WASM binary was not build, please build it!") .to_vec(), }, balances: bridge_hub_polkadot_runtime::BalancesConfig { - balances: accounts::init_balances().iter().cloned().map(|k| (k, ED * 4096)).collect(), + balances: accounts::init_balances() + .iter() + .cloned() + .map(|k| (k, ED * 4096)) + .collect(), + }, + parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { + parachain_id: PARA_ID.into(), }, - parachain_info: bridge_hub_polkadot_runtime::ParachainInfoConfig { parachain_id: PARA_ID.into() }, collator_selection: bridge_hub_polkadot_runtime::CollatorSelectionConfig { - invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(), + invulnerables: collators::invulnerables() + .iter() + .cloned() + .map(|(acc, _)| acc) + .collect(), candidacy_bond: ED * 16, ..Default::default() }, diff --git a/parachains/integration-tests/emulated/common/src/lib.rs b/parachains/integration-tests/emulated/common/src/lib.rs index f7a627ff346..0d0928998a0 100644 --- a/parachains/integration-tests/emulated/common/src/lib.rs +++ b/parachains/integration-tests/emulated/common/src/lib.rs @@ -1,15 +1,19 @@ pub mod constants; -use frame_support::{ - sp_io, sp_tracing, - parameter_types +pub use constants::{ + accounts::{ALICE, BOB}, + bridge_hub_kusama, bridge_hub_polkadot, collectives, kusama, penpal, polkadot, statemine, + statemint, }; +use frame_support::{parameter_types, sp_io, sp_tracing}; +pub use parachains_common::{AccountId, AuraId, Balance, BlockNumber, StatemintAuraId}; +pub use sp_core::{sr25519, storage::Storage, Get}; use xcm::prelude::*; -use xcm_emulator::{decl_test_networks, decl_test_parachains, decl_test_relay_chains, TestExt, RelayChain, Parachain}; +use xcm_emulator::{ + decl_test_networks, decl_test_parachains, decl_test_relay_chains, Parachain, RelayChain, + TestExt, +}; use xcm_executor::traits::Convert; -pub use constants::{polkadot, kusama, statemint, statemine, penpal, collectives, bridge_hub_kusama, bridge_hub_polkadot, accounts::{ALICE, BOB}}; -pub use sp_core::{Get, sr25519, storage::Storage}; -pub use parachains_common::{BlockNumber, AccountId, Balance, AuraId, StatemintAuraId}; decl_test_relay_chains! { pub struct Polkadot { diff --git a/xcm/xcm-emulator/src/lib.rs b/xcm/xcm-emulator/src/lib.rs index ae3bbc7d002..ad9cb2873f4 100644 --- a/xcm/xcm-emulator/src/lib.rs +++ b/xcm/xcm-emulator/src/lib.rs @@ -14,24 +14,23 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -pub use codec::Encode; -pub use paste; pub use casey::pascal; -pub use log; +pub use codec::Encode; pub use frame_support::{ + sp_runtime::BuildStorage, traits::{Get, Hooks}, weights::Weight, - sp_runtime::BuildStorage, }; -pub use pallet_balances::AccountData; pub use frame_system::AccountInfo; +pub use log; +pub use pallet_balances::AccountData; +pub use paste; pub use sp_arithmetic::traits::Bounded; +pub use sp_core::storage::Storage; pub use sp_io::TestExternalities; -pub use sp_std::{cell::RefCell, collections::{vec_deque::VecDeque}, marker::PhantomData}; +pub use sp_std::{cell::RefCell, collections::vec_deque::VecDeque, marker::PhantomData}; pub use sp_trie::StorageProof; -pub use sp_core::storage::Storage; -pub use cumulus_test_service::get_account_id_from_seed; pub use cumulus_pallet_dmp_queue; pub use cumulus_pallet_parachain_system; pub use cumulus_pallet_xcmp_queue; @@ -41,17 +40,18 @@ pub use cumulus_primitives_core::{ }; pub use cumulus_primitives_parachain_inherent::ParachainInherentData; pub use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder; +pub use cumulus_test_service::get_account_id_from_seed; pub use parachain_info; -pub use parachains_common::{BlockNumber, AccountId}; +pub use parachains_common::{AccountId, BlockNumber}; pub use polkadot_primitives; pub use polkadot_runtime_parachains::{ dmp, ump::{MessageId, UmpSink, XcmSink}, }; +pub use std::{collections::HashMap, thread::LocalKey}; pub use xcm::{v3::prelude::*, VersionedXcm}; pub use xcm_executor::XcmExecutor; -pub use std::{thread::LocalKey, collections::HashMap}; thread_local! { /// Downward messages, each message is: `(to_para_id, [(relay_block_number, msg)])` @@ -119,18 +119,37 @@ pub trait NetworkComponent { N::_para_ids() } - fn send_horizontal_messages< - I: Iterator)>, - >(to_para_id: u32, iter: I) { - HORIZONTAL_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); + fn send_horizontal_messages)>>( + to_para_id: u32, + iter: I, + ) { + HORIZONTAL_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((to_para_id, iter.collect())) + }); } fn send_upward_message(from_para_id: u32, msg: Vec) { - UPWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((from_para_id, msg))); + UPWARD_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((from_para_id, msg)) + }); } - fn send_downward_messages(to_para_id: u32, iter: impl Iterator)>) { - DOWNWARD_MESSAGES.with(|b| b.borrow_mut().get_mut(Self::network_name()).unwrap().push_back((to_para_id, iter.collect()))); + fn send_downward_messages( + to_para_id: u32, + iter: impl Iterator)>, + ) { + DOWNWARD_MESSAGES.with(|b| { + b.borrow_mut() + .get_mut(Self::network_name()) + .unwrap() + .push_back((to_para_id, iter.collect())) + }); } fn hrmp_channel_parachain_inherent_data( @@ -145,7 +164,7 @@ pub trait NetworkComponent { } } -pub trait RelayChain: UmpSink { +pub trait RelayChain: UmpSink { type Runtime; type RuntimeOrigin; type RuntimeCall; @@ -241,11 +260,14 @@ macro_rules! __impl_xcm_handlers_for_relay_chain { use $crate::{TestExt, UmpSink}; Self::execute_with(|| { - $crate::XcmSink::<$crate::XcmExecutor<::XcmConfig>, ::Runtime>::process_upward_message(origin, msg, max_weight) + $crate::XcmSink::< + $crate::XcmExecutor<::XcmConfig>, + ::Runtime, + >::process_upward_message(origin, msg, max_weight) }) } } - } + }; } #[macro_export] @@ -330,7 +352,6 @@ macro_rules! __impl_test_ext_for_relay_chain { #[macro_export] macro_rules! __impl_relay { ($network_name:ident, $relay_chain:ty) => { - impl $crate::NetworkComponent<$network_name> for $relay_chain { fn network_name() -> &'static str { stringify!($network_name) @@ -367,10 +388,13 @@ macro_rules! __impl_relay { } pub fn events() -> Vec<::RuntimeEvent> { - ::System::events().iter().map(|record| record.event.clone()).collect() + ::System::events() + .iter() + .map(|record| record.event.clone()) + .collect() } } - } + }; } // Parachain Implementation @@ -469,7 +493,7 @@ macro_rules! __impl_xcm_handlers_for_parachain { }) } } - } + }; } #[macro_export] @@ -588,7 +612,6 @@ macro_rules! __impl_test_ext_for_parachain { #[macro_export] macro_rules! __impl_parachain { ($network_name:ident, $parachain:ty) => { - impl $crate::NetworkComponent<$network_name> for $parachain { fn network_name() -> &'static str { stringify!($network_name) @@ -629,7 +652,10 @@ macro_rules! __impl_parachain { } pub fn events() -> Vec<::RuntimeEvent> { - ::System::events().iter().map(|record| record.event.clone()).collect() + ::System::events() + .iter() + .map(|record| record.event.clone()) + .collect() } fn prepare_for_xcmp() { @@ -650,7 +676,7 @@ macro_rules! __impl_parachain { }); } } - } + }; } // Network Implementation @@ -880,9 +906,9 @@ macro_rules! assert_expected_events { #[macro_export] macro_rules! bx { - ($e:expr) => { - Box::new($e) - }; + ($e:expr) => { + Box::new($e) + }; } pub mod helpers { @@ -896,9 +922,15 @@ pub mod helpers { current_value >= lower_limit && current_value <= upper_limit } - pub fn weight_within_threshold((threshold_time, threshold_size): (u64, u64), expected_weight: Weight, weight: Weight) -> bool { - let ref_time_within = within_threshold(threshold_time, expected_weight.ref_time(), weight.ref_time()); - let proof_size_within = within_threshold(threshold_size, expected_weight.proof_size(), weight.proof_size()); + pub fn weight_within_threshold( + (threshold_time, threshold_size): (u64, u64), + expected_weight: Weight, + weight: Weight, + ) -> bool { + let ref_time_within = + within_threshold(threshold_time, expected_weight.ref_time(), weight.ref_time()); + let proof_size_within = + within_threshold(threshold_size, expected_weight.proof_size(), weight.proof_size()); ref_time_within && proof_size_within } From 8c3b5ea4cdd0e4c840737fc6666de4fb43b8fb25 Mon Sep 17 00:00:00 2001 From: NachoPal Date: Thu, 18 May 2023 11:27:07 +0200 Subject: [PATCH 60/60] comment docs --- xcm/xcm-emulator/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xcm/xcm-emulator/README.md b/xcm/xcm-emulator/README.md index 2d92c684f6e..267258d758b 100644 --- a/xcm/xcm-emulator/README.md +++ b/xcm/xcm-emulator/README.md @@ -21,7 +21,7 @@ repo) is the perfect tool for this. ## How to use -1. Set up a relay chain: +