From 9c6257247c21b033d806e8ca4cecabd3e644b35c Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Mon, 3 Apr 2023 17:27:15 +0100 Subject: [PATCH 01/14] add statemint-runtime to integration tests --- Cargo.lock | 135 ++++++++++++++++++ runtime/integration-tests/pendulum/Cargo.toml | 2 + runtime/integration-tests/pendulum/src/lib.rs | 12 ++ 3 files changed, 149 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 2931e95d5..9ba0025ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6068,6 +6068,39 @@ dependencies = [ "libm 0.1.4", ] +[[package]] +name = "pallet-asset-tx-payment" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.37#f38bd6671d460293c93062cc1e4fe9e9e490cb29" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-transaction-payment", + "parity-scale-codec", + "scale-info", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", +] + +[[package]] +name = "pallet-assets" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.37#f38bd6671d460293c93062cc1e4fe9e9e490cb29" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-aura" version = "4.0.0-dev" @@ -7010,6 +7043,21 @@ dependencies = [ "sp-std", ] +[[package]] +name = "pallet-uniques" +version = "4.0.0-dev" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.37#f38bd6671d460293c93062cc1e4fe9e9e490cb29" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-runtime", + "sp-std", +] + [[package]] name = "pallet-utility" version = "4.0.0-dev" @@ -7128,6 +7176,32 @@ dependencies = [ "sp-std", ] +[[package]] +name = "parachains-common" +version = "1.0.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +dependencies = [ + "cumulus-primitives-utility", + "frame-support", + "frame-system", + "pallet-asset-tx-payment", + "pallet-assets", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "parity-scale-codec", + "polkadot-primitives", + "scale-info", + "sp-consensus-aura", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "substrate-wasm-builder", + "xcm", + "xcm-executor", +] + [[package]] name = "parity-db" version = "0.4.6" @@ -12049,6 +12123,66 @@ dependencies = [ "spacewalk-primitives", ] +[[package]] +name = "statemint-runtime" +version = "1.0.0" +source = "git+https://github.com/paritytech/cumulus.git?branch=polkadot-v0.9.37#09418fc04c2608b123f36ca80f16df3d2096753b" +dependencies = [ + "cumulus-pallet-aura-ext", + "cumulus-pallet-dmp-queue", + "cumulus-pallet-parachain-system", + "cumulus-pallet-session-benchmarking", + "cumulus-pallet-xcm", + "cumulus-pallet-xcmp-queue", + "cumulus-primitives-core", + "cumulus-primitives-timestamp", + "cumulus-primitives-utility", + "frame-executive", + "frame-support", + "frame-system", + "frame-system-rpc-runtime-api", + "log", + "pallet-asset-tx-payment", + "pallet-assets", + "pallet-aura", + "pallet-authorship", + "pallet-balances", + "pallet-collator-selection", + "pallet-multisig", + "pallet-proxy", + "pallet-session", + "pallet-timestamp", + "pallet-transaction-payment", + "pallet-transaction-payment-rpc-runtime-api", + "pallet-uniques", + "pallet-utility", + "pallet-xcm", + "parachain-info", + "parachains-common", + "parity-scale-codec", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-runtime-common", + "polkadot-runtime-constants", + "scale-info", + "smallvec", + "sp-api", + "sp-block-builder", + "sp-consensus-aura", + "sp-core", + "sp-inherents", + "sp-offchain", + "sp-runtime", + "sp-session", + "sp-std", + "sp-transaction-pool", + "sp-version", + "substrate-wasm-builder", + "xcm", + "xcm-builder", + "xcm-executor", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -14457,6 +14591,7 @@ dependencies = [ "sp-io", "sp-runtime", "sp-std", + "statemint-runtime", "xcm", "xcm-builder", "xcm-emulator", diff --git a/runtime/integration-tests/pendulum/Cargo.toml b/runtime/integration-tests/pendulum/Cargo.toml index cc513ffa9..a8e7a3c7d 100644 --- a/runtime/integration-tests/pendulum/Cargo.toml +++ b/runtime/integration-tests/pendulum/Cargo.toml @@ -36,3 +36,5 @@ orml-tokens = {git = "https://github.com/open-web3-stack/open-runtime-module-lib cumulus-pallet-dmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.37"} orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", default-features = false, branch = "polkadot-v0.9.37" } pendulum-runtime = { path = "../../pendulum"} + +statemint-runtime = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index ac9c745b9..e941d2a98 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -43,6 +43,16 @@ decl_test_parachain! { } } +// decl_test_parachain! { +// pub struct Statemine { +// Runtime = statemine_runtime::Runtime, +// RuntimeOrigin = statemine_runtime::RuntimeOrigin, +// XcmpMessageHandler = statemine_runtime::XcmpQueue, +// DmpMessageHandler = statemine_runtime::DmpQueue, +// new_ext = para_ext(1000), +// } +// } + decl_test_network! { pub struct MockNet { relay_chain = Relay, @@ -328,3 +338,5 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { assert_eq!(after_bob_free_balance, dot(100) + transfer_dot_amount - FEE); }); } + + From 313e09b1a550a28a8922380c764fb6161dcdc42b Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Mon, 3 Apr 2023 17:43:05 +0100 Subject: [PATCH 02/14] add Statemint to RelayNet as system chain 1000 --- runtime/integration-tests/pendulum/src/lib.rs | 80 ++++++++++++++++--- 1 file changed, 69 insertions(+), 11 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index e941d2a98..4db40225a 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -43,20 +43,21 @@ decl_test_parachain! { } } -// decl_test_parachain! { -// pub struct Statemine { -// Runtime = statemine_runtime::Runtime, -// RuntimeOrigin = statemine_runtime::RuntimeOrigin, -// XcmpMessageHandler = statemine_runtime::XcmpQueue, -// DmpMessageHandler = statemine_runtime::DmpQueue, -// new_ext = para_ext(1000), -// } -// } +decl_test_parachain! { + pub struct Statemine { + Runtime = statemint_runtime::Runtime, + RuntimeOrigin = statemint_runtime::RuntimeOrigin, + XcmpMessageHandler = statemint_runtime::XcmpQueue, + DmpMessageHandler = statemint_runtime::DmpQueue, + new_ext = para_ext_statemint(1000), + } +} decl_test_network! { pub struct MockNet { relay_chain = Relay, parachains = vec![ + (1000, Statemine), (2094, PendulumParachain), ], } @@ -152,6 +153,65 @@ impl ExtBuilderPendulum { } } +pub struct ExtStatemintBuilder { + balances: Vec<(AccountId, u128, Balance)>, + parachain_id: u32, +} + +impl Default for ExtStatemintBuilder { + fn default() -> Self { + Self { balances: vec![], parachain_id: 1000 } + } +} + +impl ExtStatemintBuilder { + pub fn balances(mut self, balances: Vec<(AccountId, u128, Balance)>) -> Self { + self.balances = balances; + self + } + + #[allow(dead_code)] + pub fn parachain_id(mut self, parachain_id: u32) -> Self { + self.parachain_id = parachain_id; + self + } + + pub fn build(self) -> sp_io::TestExternalities { + use statemint_runtime::Runtime as StatemintRuntime; + + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + + pallet_balances::GenesisConfig:: { balances: vec![] } + .assimilate_storage(&mut t) + .unwrap(); + + >::assimilate_storage( + ¶chain_info::GenesisConfig { parachain_id: self.parachain_id.into() }, + &mut t, + ) + .unwrap(); + + >::assimilate_storage( + &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, + &mut t, + ) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} + +pub fn para_ext_statemint(parachain_id: u32) -> sp_io::TestExternalities { + ExtStatemintBuilder::default() + .balances(vec![]) + .parachain_id(parachain_id) + .build() +} + fn default_parachains_host_configuration() -> HostConfiguration { HostConfiguration { minimum_validation_upgrade_delay: 5, @@ -338,5 +398,3 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { assert_eq!(after_bob_free_balance, dot(100) + transfer_dot_amount - FEE); }); } - - From 5c8cf2fb3a2222e433324ba56621cc218960ed53 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Mon, 3 Apr 2023 21:03:48 +0100 Subject: [PATCH 03/14] add statemine_transfer_asset_to_pendulum unit tests --- Cargo.lock | 1 + runtime/integration-tests/pendulum/Cargo.toml | 2 + runtime/integration-tests/pendulum/src/lib.rs | 82 ++++++++++++++++++- 3 files changed, 82 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ba0025ed..07104e149 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14571,6 +14571,7 @@ name = "xcm-simulator-example" version = "0.1.0" dependencies = [ "cumulus-pallet-dmp-queue", + "cumulus-pallet-xcmp-queue", "frame-support", "frame-system", "orml-tokens 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library.git?branch=polkadot-v0.9.37)", diff --git a/runtime/integration-tests/pendulum/Cargo.toml b/runtime/integration-tests/pendulum/Cargo.toml index a8e7a3c7d..ae634aa70 100644 --- a/runtime/integration-tests/pendulum/Cargo.toml +++ b/runtime/integration-tests/pendulum/Cargo.toml @@ -38,3 +38,5 @@ orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-l pendulum-runtime = { path = "../../pendulum"} statemint-runtime = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37" } + +cumulus-pallet-xcmp-queue = {git = "https://github.com/paritytech/cumulus", default-features = false, branch = "polkadot-v0.9.37"} diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 4db40225a..25c1ba68d 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -1,13 +1,13 @@ use frame_support::{ assert_ok, - traits::{fungibles::Inspect, GenesisBuild}, + traits::{fungibles::Inspect, Currency, GenesisBuild}, }; use pendulum_runtime::{Balances, PendulumCurrencyId, Runtime, System, Tokens}; use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; -use polkadot_parachain::primitives::Id as ParaId; +use polkadot_parachain::primitives::{Id as ParaId, Sibling}; use polkadot_primitives::v2::{MAX_CODE_SIZE, MAX_POV_SIZE}; use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_runtime::traits::AccountIdConversion; +use sp_runtime::{traits::AccountIdConversion, MultiAddress}; use xcm::{ latest::{ AssetId, Fungibility, Junction, Junction::*, Junctions::*, MultiAsset, MultiLocation, @@ -17,6 +17,9 @@ use xcm::{ VersionedMultiLocation, }; const DOT_FEE: Balance = 3200000000; +const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint +pub const UNIT: Balance = 1_000_000_000_000; +pub const TEN: Balance = 10_000_000_000_000; use xcm_emulator::{ decl_test_network, decl_test_parachain, decl_test_relay_chain, Junctions, TestExt, Weight, }; @@ -398,3 +401,76 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { assert_eq!(after_bob_free_balance, dot(100) + transfer_dot_amount - FEE); }); } + +#[test] +fn statemine_transfer_asset_to_pendulum() { + let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); + + Statemine::execute_with(|| { + use statemint_runtime::*; + + let origin = RuntimeOrigin::signed(ALICE.into()); + Balances::make_free_balance_be(&ALICE.into(), TEN); + Balances::make_free_balance_be(&BOB.into(), UNIT); + + // If using non root, create custom asset cost 0.1 Dot + // We're using force_create here to make sure asset is sufficient. + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + true, + UNIT / 100 + )); + + assert_ok!(Assets::mint( + origin.clone(), + ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + 1000 * UNIT + )); + + // need to have some DOT to be able to receive user assets + Balances::make_free_balance_be(¶_2094, UNIT); + + assert_ok!(PolkadotXcm::limited_reserve_transfer_assets( + origin.clone(), + Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), + Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), + Box::new((X2(PalletInstance(50), GeneralIndex(ASSET_ID as u128)), TEN).into()), + 0, + WeightLimit::Unlimited + )); + + assert_eq!(990 * UNIT, Assets::balance(ASSET_ID, &AccountId::from(ALICE))); + assert_eq!(0, Assets::balance(ASSET_ID, &AccountId::from(BOB))); + + assert_eq!(TEN, Assets::balance(ASSET_ID, ¶_2094)); + // the DOT balance of sibling parachain sovereign account is not changed + assert_eq!(UNIT, Balances::free_balance(¶_2094)); + }); + + // Rerun the Statemine::execute to actually send the egress message via XCM + Statemine::execute_with(|| {}); + + PendulumParachain::execute_with(|| { + use pendulum_runtime::{RuntimeEvent, System}; + for i in System::events().iter() { + println!(" Pendulum_runtime {:?}", i); + } + + assert!(System::events() + .iter() + .any(|r| matches!(r.event, RuntimeEvent::Tokens(orml_tokens::Event::Endowed { .. })))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::Tokens(orml_tokens::Event::Deposited { .. }) + ))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) + ))); + }); +} From 81b6305542e227139d77cd8db21d8e6880d033ab Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Mon, 3 Apr 2023 21:11:16 +0100 Subject: [PATCH 04/14] check BOB balance in statemine_transfer_asset_to_pendulum test --- runtime/integration-tests/pendulum/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 25c1ba68d..3930f75b0 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -472,5 +472,14 @@ fn statemine_transfer_asset_to_pendulum() { r.event, RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) ))); + + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(1), + &BOB.into() + ), + TEN + ); + }); } From 7e1fd2cb541ddfe778a120c47f853be8c1e98d49 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Mon, 3 Apr 2023 22:14:23 +0100 Subject: [PATCH 05/14] add statemine_transfer_asset_to_statemint --- runtime/integration-tests/pendulum/src/lib.rs | 70 ++++++++++++++++++- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 3930f75b0..354413efc 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -1,8 +1,10 @@ use frame_support::{ assert_ok, - traits::{fungibles::Inspect, Currency, GenesisBuild}, + traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, +}; +use pendulum_runtime::{ + Balances, PendulumCurrencyId, Runtime, RuntimeOrigin, System, Tokens, XTokens, }; -use pendulum_runtime::{Balances, PendulumCurrencyId, Runtime, System, Tokens}; use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; use polkadot_parachain::primitives::{Id as ParaId, Sibling}; use polkadot_primitives::v2::{MAX_CODE_SIZE, MAX_POV_SIZE}; @@ -406,6 +408,16 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { fn statemine_transfer_asset_to_pendulum() { let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); + PendulumParachain::execute_with(|| { + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(1), + &BOB.into() + ), + 0 + ); + }); + Statemine::execute_with(|| { use statemint_runtime::*; @@ -480,6 +492,60 @@ fn statemine_transfer_asset_to_pendulum() { ), TEN ); + }); +} + +#[test] +fn statemine_transfer_asset_to_statemint() { + statemine_transfer_asset_to_pendulum(); + + Statemine::execute_with(|| {}); + + PendulumParachain::execute_with(|| { + assert_eq!(TEN, Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB))); + // ensure sender has enough PEN balance to be charged as fee + assert_ok!(Balances::mint_into(&AccountId::from(BOB), TEN)); + + assert_ok!(XTokens::transfer( + RuntimeOrigin::signed(BOB.into()), + PendulumCurrencyId::XCM(1), + UNIT * 1, + Box::new( + MultiLocation::new( + 1, + X2( + Parachain(1000), + Junction::AccountId32 { network: NetworkId::Any, id: BOB.into() } + ) + ) + .into() + ), + WeightLimit::Limited(10_000_000_000), + )); + + assert_eq!( + TEN - 1 * UNIT, //inital balance - one unit + Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB)) + ); + + // for i in System::events().iter() { + // println!(" Pendulum_runtime {:?}", i); + // } + + use pendulum_runtime::{RuntimeEvent, System}; + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) + ))); + + // assert_eq!(TEN - ksm_fee_amount, Tokens::free_balance(KSM, &AccountId::from(BOB))); + }); + + Statemine::execute_with(|| { + use statemint_runtime::*; + // https://github.com/paritytech/cumulus/pull/1278 support using self sufficient asset + // for paying xcm execution fee on Statemine. + assert_eq!(990_000_000_000, Assets::balance(ASSET_ID, &AccountId::from(BOB))); }); } From bdd4a7b566508fad521281d90b8cbe70aba536e1 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 10:30:19 +0100 Subject: [PATCH 06/14] rename statemine to statemint. because this is tests for polkadot net --- runtime/integration-tests/pendulum/src/lib.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 354413efc..87ab26b1d 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -49,7 +49,7 @@ decl_test_parachain! { } decl_test_parachain! { - pub struct Statemine { + pub struct Statemint { Runtime = statemint_runtime::Runtime, RuntimeOrigin = statemint_runtime::RuntimeOrigin, XcmpMessageHandler = statemint_runtime::XcmpQueue, @@ -62,7 +62,7 @@ decl_test_network! { pub struct MockNet { relay_chain = Relay, parachains = vec![ - (1000, Statemine), + (1000, Statemint), (2094, PendulumParachain), ], } @@ -405,7 +405,7 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { } #[test] -fn statemine_transfer_asset_to_pendulum() { +fn statemint_transfer_asset_to_pendulum() { let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); PendulumParachain::execute_with(|| { @@ -418,7 +418,7 @@ fn statemine_transfer_asset_to_pendulum() { ); }); - Statemine::execute_with(|| { + Statemint::execute_with(|| { use statemint_runtime::*; let origin = RuntimeOrigin::signed(ALICE.into()); @@ -462,8 +462,8 @@ fn statemine_transfer_asset_to_pendulum() { assert_eq!(UNIT, Balances::free_balance(¶_2094)); }); - // Rerun the Statemine::execute to actually send the egress message via XCM - Statemine::execute_with(|| {}); + // Rerun the Statemint::execute to actually send the egress message via XCM + Statemint::execute_with(|| {}); PendulumParachain::execute_with(|| { use pendulum_runtime::{RuntimeEvent, System}; @@ -496,10 +496,10 @@ fn statemine_transfer_asset_to_pendulum() { } #[test] -fn statemine_transfer_asset_to_statemint() { - statemine_transfer_asset_to_pendulum(); +fn statemint_transfer_asset_to_statemint() { + statemint_transfer_asset_to_pendulum(); - Statemine::execute_with(|| {}); + Statemint::execute_with(|| {}); PendulumParachain::execute_with(|| { assert_eq!(TEN, Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB))); @@ -541,11 +541,11 @@ fn statemine_transfer_asset_to_statemint() { // assert_eq!(TEN - ksm_fee_amount, Tokens::free_balance(KSM, &AccountId::from(BOB))); }); - Statemine::execute_with(|| { + Statemint::execute_with(|| { use statemint_runtime::*; // https://github.com/paritytech/cumulus/pull/1278 support using self sufficient asset - // for paying xcm execution fee on Statemine. + // for paying xcm execution fee on Statemint. assert_eq!(990_000_000_000, Assets::balance(ASSET_ID, &AccountId::from(BOB))); }); } From 86714cefe83cc3ff941bb45af102dacd78b90802 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 13:05:09 +0100 Subject: [PATCH 07/14] add statemint_transfer_incorrect_asset_to_pendulum_fails --- runtime/integration-tests/pendulum/src/lib.rs | 79 ++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 87ab26b1d..d3a893278 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -20,6 +20,7 @@ use xcm::{ }; const DOT_FEE: Balance = 3200000000; const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint +const INCORRECT_ASSET_ID: u32 = 0; pub const UNIT: Balance = 1_000_000_000_000; pub const TEN: Balance = 10_000_000_000_000; use xcm_emulator::{ @@ -399,11 +400,87 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - // println!("BOB DOT AFTER balance on relay chain {} ", after_bob_free_balance); assert_eq!(after_bob_free_balance, dot(100) + transfer_dot_amount - FEE); }); } +#[test] +fn statemint_transfer_incorrect_asset_to_pendulum_fails() { + let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); + + PendulumParachain::execute_with(|| { + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(1), + &BOB.into() + ), + 0 + ); + }); + + Statemint::execute_with(|| { + use statemint_runtime::*; + + let origin = RuntimeOrigin::signed(ALICE.into()); + Balances::make_free_balance_be(&ALICE.into(), TEN); + Balances::make_free_balance_be(&BOB.into(), UNIT); + + // If using non root, create custom asset cost 0.1 Dot + // We're using force_create here to make sure asset is sufficient. + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + INCORRECT_ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + true, + UNIT / 100 + )); + + assert_ok!(Assets::mint( + origin.clone(), + INCORRECT_ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + 1000 * UNIT + )); + + // need to have some DOT to be able to receive user assets + Balances::make_free_balance_be(¶_2094, UNIT); + + assert_ok!(PolkadotXcm::limited_reserve_transfer_assets( + origin.clone(), + Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), + Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), + Box::new( + (X2(PalletInstance(50), GeneralIndex(INCORRECT_ASSET_ID as u128)), TEN).into() + ), + 0, + WeightLimit::Unlimited + )); + + assert_eq!(990 * UNIT, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(ALICE))); + assert_eq!(0, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(BOB))); + + assert_eq!(TEN, Assets::balance(INCORRECT_ASSET_ID, ¶_2094)); + // the DOT balance of sibling parachain sovereign account is not changed + assert_eq!(UNIT, Balances::free_balance(¶_2094)); + }); + + // Rerun the Statemint::execute to actually send the egress message via XCM + Statemint::execute_with(|| {}); + + PendulumParachain::execute_with(|| { + use pendulum_runtime::{RuntimeEvent, System}; + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { + message_hash: _, + error: xcm::v2::Error::FailedToTransactAsset(..), + weight: _ + }) + ))); + }); +} + #[test] fn statemint_transfer_asset_to_pendulum() { let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); From e246b32edba3c290e1929087e9a6b0ecbf9bdcdb Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 13:29:22 +0100 Subject: [PATCH 08/14] move pendulum and statemint configuration from lib.rs to setup.rs --- runtime/integration-tests/pendulum/src/lib.rs | 138 +----------------- .../integration-tests/pendulum/src/setup.rs | 103 +++++++++++++ 2 files changed, 111 insertions(+), 130 deletions(-) create mode 100644 runtime/integration-tests/pendulum/src/setup.rs diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index d3a893278..423075fa7 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -27,10 +27,17 @@ use xcm_emulator::{ decl_test_network, decl_test_parachain, decl_test_relay_chain, Junctions, TestExt, Weight, }; +mod setup; +use setup::*; + pub const ALICE: [u8; 32] = [4u8; 32]; pub const BOB: [u8; 32] = [5u8; 32]; pub const INITIAL_BALANCE: u128 = 1_000_000_000; +pub fn dot(amount: Balance) -> Balance { + amount * 10u128.saturating_pow(9) +} + decl_test_relay_chain! { pub struct Relay { Runtime = polkadot_runtime::Runtime, @@ -80,7 +87,7 @@ pub fn relay_ext() -> sp_io::TestExternalities { balances: vec![ (AccountId::from(ALICE), dot(100000)), (AccountId::from(BOB), dot(100)), - (ParaId::from(2094).into_account_truncating(), 10 * dot(100000)), + (para_account_id(2094), 10 * dot(100000)), ], } .assimilate_storage(&mut t) @@ -100,16 +107,6 @@ pub fn relay_ext() -> sp_io::TestExternalities { ext } -pub struct ExtBuilderPendulum { - balances: Vec<(AccountId, PendulumCurrencyId, Balance)>, - parachain_id: u32, -} -impl Default for ExtBuilderPendulum { - fn default() -> Self { - Self { balances: vec![], parachain_id: 2094 } - } -} - pub fn para_ext_pendulum(parachain_id: u32) -> sp_io::TestExternalities { ExtBuilderPendulum::default() .balances(vec![]) @@ -117,100 +114,6 @@ pub fn para_ext_pendulum(parachain_id: u32) -> sp_io::TestExternalities { .build() } -impl ExtBuilderPendulum { - pub fn balances(mut self, balances: Vec<(AccountId, PendulumCurrencyId, Balance)>) -> Self { - self.balances = balances; - self - } - pub fn parachain_id(mut self, parachain_id: u32) -> Self { - self.parachain_id = parachain_id; - self - } - pub fn build(self) -> sp_io::TestExternalities { - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - // let native_currency_id = Pendulum_runtime::Native::get(); - pallet_balances::GenesisConfig:: { - balances: vec![ - (AccountId::from(ALICE), INITIAL_BALANCE), - (AccountId::from(BOB), INITIAL_BALANCE), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - orml_tokens::GenesisConfig:: { - balances: vec![(AccountId::from(BOB), PendulumCurrencyId::XCM(0), dot(100))], - } - .assimilate_storage(&mut t) - .unwrap(); - >::assimilate_storage( - ¶chain_info::GenesisConfig { parachain_id: self.parachain_id.into() }, - &mut t, - ) - .unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) - .unwrap(); - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} - -pub struct ExtStatemintBuilder { - balances: Vec<(AccountId, u128, Balance)>, - parachain_id: u32, -} - -impl Default for ExtStatemintBuilder { - fn default() -> Self { - Self { balances: vec![], parachain_id: 1000 } - } -} - -impl ExtStatemintBuilder { - pub fn balances(mut self, balances: Vec<(AccountId, u128, Balance)>) -> Self { - self.balances = balances; - self - } - - #[allow(dead_code)] - pub fn parachain_id(mut self, parachain_id: u32) -> Self { - self.parachain_id = parachain_id; - self - } - - pub fn build(self) -> sp_io::TestExternalities { - use statemint_runtime::Runtime as StatemintRuntime; - - let mut t = frame_system::GenesisConfig::default() - .build_storage::() - .unwrap(); - - pallet_balances::GenesisConfig:: { balances: vec![] } - .assimilate_storage(&mut t) - .unwrap(); - - >::assimilate_storage( - ¶chain_info::GenesisConfig { parachain_id: self.parachain_id.into() }, - &mut t, - ) - .unwrap(); - - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) - .unwrap(); - - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext - } -} - pub fn para_ext_statemint(parachain_id: u32) -> sp_io::TestExternalities { ExtStatemintBuilder::default() .balances(vec![]) @@ -256,30 +159,17 @@ fn default_parachains_host_configuration() -> HostConfiguration { } } -pub fn dot(amount: Balance) -> Balance { - amount * one(9) -} - -pub fn one(decimals: u32) -> Balance { - 10u128.saturating_pow(decimals.into()) -} - #[test] fn transfer_polkadot_from_relay_chain_to_pendulum() { MockNet::reset(); let transfer_amount: Balance = dot(20); - println!("transfer DOT amount : {} ", transfer_amount); - let mut balance_before = 0; let mut orml_tokens_before = 0; PendulumParachain::execute_with(|| { - balance_before = Balances::free_balance(&ALICE.into()); - println!("Alice balance_before {}", balance_before); let orml_tokens_before = pendulum_runtime::Tokens::balance( pendulum_runtime::PendulumCurrencyId::XCM(0), &ALICE.into(), ); - println!("Alice orml tokens DOT before {}", orml_tokens_before); }); Relay::execute_with(|| { @@ -292,20 +182,8 @@ fn transfer_polkadot_from_relay_chain_to_pendulum() { )); }); - Relay::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, System}; - for i in System::events().iter() { - println!("polkadot_runtime {:?}", i); - } - }); - - println!("____________________________________________________"); - PendulumParachain::execute_with(|| { use pendulum_runtime::{RuntimeEvent, System, Tokens}; - for i in System::events().iter() { - println!(" Pendulum_runtime {:?}", i); - } assert!(System::events().iter().any(|r| matches!( r.event, diff --git a/runtime/integration-tests/pendulum/src/setup.rs b/runtime/integration-tests/pendulum/src/setup.rs new file mode 100644 index 000000000..b4a6c5d1d --- /dev/null +++ b/runtime/integration-tests/pendulum/src/setup.rs @@ -0,0 +1,103 @@ +use super::*; +pub struct ExtBuilderPendulum { + balances: Vec<(AccountId, PendulumCurrencyId, Balance)>, + parachain_id: u32, +} +impl Default for ExtBuilderPendulum { + fn default() -> Self { + Self { balances: vec![], parachain_id: 2094 } + } +} + +impl ExtBuilderPendulum { + pub fn balances(mut self, balances: Vec<(AccountId, PendulumCurrencyId, Balance)>) -> Self { + self.balances = balances; + self + } + pub fn parachain_id(mut self, parachain_id: u32) -> Self { + self.parachain_id = parachain_id; + self + } + pub fn build(self) -> sp_io::TestExternalities { + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + pallet_balances::GenesisConfig:: { + balances: vec![ + (AccountId::from(ALICE), INITIAL_BALANCE), + (AccountId::from(BOB), INITIAL_BALANCE), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + + orml_tokens::GenesisConfig:: { + balances: vec![(AccountId::from(BOB), PendulumCurrencyId::XCM(0), dot(100))], + } + .assimilate_storage(&mut t) + .unwrap(); + >::assimilate_storage( + ¶chain_info::GenesisConfig { parachain_id: self.parachain_id.into() }, + &mut t, + ) + .unwrap(); + >::assimilate_storage( + &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, + &mut t, + ) + .unwrap(); + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} + +pub struct ExtStatemintBuilder { + balances: Vec<(AccountId, u128, Balance)>, + parachain_id: u32, +} + +impl Default for ExtStatemintBuilder { + fn default() -> Self { + Self { balances: vec![], parachain_id: 1000 } + } +} + +impl ExtStatemintBuilder { + pub fn balances(mut self, balances: Vec<(AccountId, u128, Balance)>) -> Self { + self.balances = balances; + self + } + + #[allow(dead_code)] + pub fn parachain_id(mut self, parachain_id: u32) -> Self { + self.parachain_id = parachain_id; + self + } + + pub fn build(self) -> sp_io::TestExternalities { + use statemint_runtime::Runtime as StatemintRuntime; + + let mut t = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + + pallet_balances::GenesisConfig:: { balances: vec![] } + .assimilate_storage(&mut t) + .unwrap(); + + >::assimilate_storage( + ¶chain_info::GenesisConfig { parachain_id: self.parachain_id.into() }, + &mut t, + ) + .unwrap(); + + >::assimilate_storage( + &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, + &mut t, + ) + .unwrap(); + + let mut ext = sp_io::TestExternalities::new(t); + ext.execute_with(|| System::set_block_number(1)); + ext + } +} From dfb569002111ba87cacde902143387be2d5d0805 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 13:32:31 +0100 Subject: [PATCH 09/14] move test from lib.rs to test.rs --- runtime/integration-tests/pendulum/src/lib.rs | 14 +- .../integration-tests/pendulum/src/tests.rs | 334 ++++++++++++++++++ 2 files changed, 336 insertions(+), 12 deletions(-) create mode 100644 runtime/integration-tests/pendulum/src/tests.rs diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 423075fa7..9271e83d6 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -30,6 +30,8 @@ use xcm_emulator::{ mod setup; use setup::*; +mod tests; + pub const ALICE: [u8; 32] = [4u8; 32]; pub const BOB: [u8; 32] = [5u8; 32]; pub const INITIAL_BALANCE: u128 = 1_000_000_000; @@ -216,7 +218,6 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - // println!("BOB DOT BEFORE balance on relay chain {} ", after_bob_free_balance); assert_eq!(after_bob_free_balance, dot(100)); }); @@ -238,9 +239,6 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { PendulumParachain::execute_with(|| { use pendulum_runtime::{RuntimeEvent, System}; - // for i in System::events().iter() { - // println!(" Pendulum_runtime {:?}", i); - // } assert!(System::events().iter().any(|r| matches!( r.event, @@ -256,10 +254,6 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { Relay::execute_with(|| { use polkadot_runtime::{RuntimeEvent, System}; - // for i in System::events().iter() { - // println!("polkadot_runtime {:?}", i); - // } - assert!(System::events().iter().any(|r| matches!( r.event, RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) @@ -483,10 +477,6 @@ fn statemint_transfer_asset_to_statemint() { Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB)) ); - // for i in System::events().iter() { - // println!(" Pendulum_runtime {:?}", i); - // } - use pendulum_runtime::{RuntimeEvent, System}; assert!(System::events().iter().any(|r| matches!( r.event, diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs new file mode 100644 index 000000000..edcc01d53 --- /dev/null +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -0,0 +1,334 @@ +use crate::*; +#[test] +fn transfer_polkadot_from_relay_chain_to_pendulum() { + MockNet::reset(); + + let transfer_amount: Balance = dot(20); + let mut orml_tokens_before = 0; + PendulumParachain::execute_with(|| { + let orml_tokens_before = pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(0), + &ALICE.into(), + ); + }); + + Relay::execute_with(|| { + assert_ok!(polkadot_runtime::XcmPallet::reserve_transfer_assets( + polkadot_runtime::RuntimeOrigin::signed(ALICE.into()), + Box::new(Parachain(2094).into().into()), + Box::new(Junction::AccountId32 { network: NetworkId::Any, id: ALICE }.into().into()), + Box::new((Here, transfer_amount).into()), + 0 + )); + }); + + PendulumParachain::execute_with(|| { + use pendulum_runtime::{RuntimeEvent, System, Tokens}; + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::Tokens(orml_tokens::Event::Deposited { .. }) + ))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { .. }) + ))); + }); + + PendulumParachain::execute_with(|| { + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(0), + &ALICE.into() + ), + orml_tokens_before + transfer_amount - DOT_FEE + ); + }); +} + +#[test] +fn transfer_polkadot_from_pendulum_to_relay_chain() { + MockNet::reset(); + + let transfer_dot_amount: Balance = dot(10); + let FEE = 421434140; + + Relay::execute_with(|| { + let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); + assert_eq!(after_bob_free_balance, dot(100)); + }); + + PendulumParachain::execute_with(|| { + assert_ok!(pendulum_runtime::XTokens::transfer( + pendulum_runtime::RuntimeOrigin::signed(BOB.into()), + pendulum_runtime::PendulumCurrencyId::XCM(0), + transfer_dot_amount, + Box::new( + MultiLocation::new( + 1, + Junctions::X1(Junction::AccountId32 { id: BOB, network: NetworkId::Any }) + ) + .into() + ), + WeightLimit::Limited(4_000_000_000), + )); + }); + + PendulumParachain::execute_with(|| { + use pendulum_runtime::{RuntimeEvent, System}; + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::Tokens(orml_tokens::Event::Withdrawn { .. }) + ))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XTokens(orml_xtokens::Event::TransferredMultiAssets { .. }) + ))); + }); + + Relay::execute_with(|| { + use polkadot_runtime::{RuntimeEvent, System}; + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) + ))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) + ))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::Ump(polkadot_runtime_parachains::ump::Event::ExecutedUpward { .. }) + ))); + }); + + Relay::execute_with(|| { + let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); + assert_eq!(after_bob_free_balance, dot(100) + transfer_dot_amount - FEE); + }); +} + +#[test] +fn statemint_transfer_incorrect_asset_to_pendulum_fails() { + let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); + + PendulumParachain::execute_with(|| { + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(1), + &BOB.into() + ), + 0 + ); + }); + + Statemint::execute_with(|| { + use statemint_runtime::*; + + let origin = RuntimeOrigin::signed(ALICE.into()); + Balances::make_free_balance_be(&ALICE.into(), TEN); + Balances::make_free_balance_be(&BOB.into(), UNIT); + + // If using non root, create custom asset cost 0.1 Dot + // We're using force_create here to make sure asset is sufficient. + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + INCORRECT_ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + true, + UNIT / 100 + )); + + assert_ok!(Assets::mint( + origin.clone(), + INCORRECT_ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + 1000 * UNIT + )); + + // need to have some DOT to be able to receive user assets + Balances::make_free_balance_be(¶_2094, UNIT); + + assert_ok!(PolkadotXcm::limited_reserve_transfer_assets( + origin.clone(), + Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), + Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), + Box::new( + (X2(PalletInstance(50), GeneralIndex(INCORRECT_ASSET_ID as u128)), TEN).into() + ), + 0, + WeightLimit::Unlimited + )); + + assert_eq!(990 * UNIT, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(ALICE))); + assert_eq!(0, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(BOB))); + + assert_eq!(TEN, Assets::balance(INCORRECT_ASSET_ID, ¶_2094)); + // the DOT balance of sibling parachain sovereign account is not changed + assert_eq!(UNIT, Balances::free_balance(¶_2094)); + }); + + // Rerun the Statemint::execute to actually send the egress message via XCM + Statemint::execute_with(|| {}); + + PendulumParachain::execute_with(|| { + use pendulum_runtime::{RuntimeEvent, System}; + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { + message_hash: _, + error: xcm::v2::Error::FailedToTransactAsset(..), + weight: _ + }) + ))); + }); +} + +#[test] +fn statemint_transfer_asset_to_pendulum() { + let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); + + PendulumParachain::execute_with(|| { + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(1), + &BOB.into() + ), + 0 + ); + }); + + Statemint::execute_with(|| { + use statemint_runtime::*; + + let origin = RuntimeOrigin::signed(ALICE.into()); + Balances::make_free_balance_be(&ALICE.into(), TEN); + Balances::make_free_balance_be(&BOB.into(), UNIT); + + // If using non root, create custom asset cost 0.1 Dot + // We're using force_create here to make sure asset is sufficient. + assert_ok!(Assets::force_create( + RuntimeOrigin::root(), + ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + true, + UNIT / 100 + )); + + assert_ok!(Assets::mint( + origin.clone(), + ASSET_ID.into(), + MultiAddress::Id(ALICE.into()), + 1000 * UNIT + )); + + // need to have some DOT to be able to receive user assets + Balances::make_free_balance_be(¶_2094, UNIT); + + assert_ok!(PolkadotXcm::limited_reserve_transfer_assets( + origin.clone(), + Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), + Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), + Box::new((X2(PalletInstance(50), GeneralIndex(ASSET_ID as u128)), TEN).into()), + 0, + WeightLimit::Unlimited + )); + + assert_eq!(990 * UNIT, Assets::balance(ASSET_ID, &AccountId::from(ALICE))); + assert_eq!(0, Assets::balance(ASSET_ID, &AccountId::from(BOB))); + + assert_eq!(TEN, Assets::balance(ASSET_ID, ¶_2094)); + // the DOT balance of sibling parachain sovereign account is not changed + assert_eq!(UNIT, Balances::free_balance(¶_2094)); + }); + + // Rerun the Statemint::execute to actually send the egress message via XCM + Statemint::execute_with(|| {}); + + PendulumParachain::execute_with(|| { + use pendulum_runtime::{RuntimeEvent, System}; + for i in System::events().iter() { + println!(" Pendulum_runtime {:?}", i); + } + + assert!(System::events() + .iter() + .any(|r| matches!(r.event, RuntimeEvent::Tokens(orml_tokens::Event::Endowed { .. })))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::Tokens(orml_tokens::Event::Deposited { .. }) + ))); + + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) + ))); + + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(1), + &BOB.into() + ), + TEN + ); + }); +} + +#[test] +fn statemint_transfer_asset_to_statemint() { + statemint_transfer_asset_to_pendulum(); + + Statemint::execute_with(|| {}); + + PendulumParachain::execute_with(|| { + assert_eq!(TEN, Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB))); + // ensure sender has enough PEN balance to be charged as fee + assert_ok!(Balances::mint_into(&AccountId::from(BOB), TEN)); + + assert_ok!(XTokens::transfer( + RuntimeOrigin::signed(BOB.into()), + PendulumCurrencyId::XCM(1), + UNIT * 1, + Box::new( + MultiLocation::new( + 1, + X2( + Parachain(1000), + Junction::AccountId32 { network: NetworkId::Any, id: BOB.into() } + ) + ) + .into() + ), + WeightLimit::Limited(10_000_000_000), + )); + + assert_eq!( + TEN - 1 * UNIT, //inital balance - one unit + Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB)) + ); + + use pendulum_runtime::{RuntimeEvent, System}; + assert!(System::events().iter().any(|r| matches!( + r.event, + RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) + ))); + + // assert_eq!(TEN - ksm_fee_amount, Tokens::free_balance(KSM, &AccountId::from(BOB))); + }); + + Statemint::execute_with(|| { + use statemint_runtime::*; + + // https://github.com/paritytech/cumulus/pull/1278 support using self sufficient asset + // for paying xcm execution fee on Statemint. + assert_eq!(990_000_000_000, Assets::balance(ASSET_ID, &AccountId::from(BOB))); + }); +} From dad2c0cb1befa63ed6e9cb7b1197f1517b89fa10 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 13:59:37 +0100 Subject: [PATCH 10/14] move polkadot net configuration to polkadot_test_net --- runtime/integration-tests/pendulum/src/lib.rs | 471 +----------------- .../pendulum/src/polkadot_test_net.rs | 121 +++++ .../integration-tests/pendulum/src/tests.rs | 2 +- 3 files changed, 129 insertions(+), 465 deletions(-) create mode 100644 runtime/integration-tests/pendulum/src/polkadot_test_net.rs diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 9271e83d6..cb94d018b 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -26,471 +26,14 @@ pub const TEN: Balance = 10_000_000_000_000; use xcm_emulator::{ decl_test_network, decl_test_parachain, decl_test_relay_chain, Junctions, TestExt, Weight, }; - -mod setup; -use setup::*; - -mod tests; - -pub const ALICE: [u8; 32] = [4u8; 32]; -pub const BOB: [u8; 32] = [5u8; 32]; -pub const INITIAL_BALANCE: u128 = 1_000_000_000; - pub fn dot(amount: Balance) -> Balance { amount * 10u128.saturating_pow(9) } +pub const ALICE: [u8; 32] = [4u8; 32]; +pub const BOB: [u8; 32] = [5u8; 32]; +pub const INITIAL_BALANCE: u128 = 1_000_000_000; -decl_test_relay_chain! { - pub struct Relay { - Runtime = polkadot_runtime::Runtime, - XcmConfig = polkadot_runtime::xcm_config::XcmConfig, - new_ext = relay_ext(), - } -} - -decl_test_parachain! { - pub struct PendulumParachain { - Runtime = pendulum_runtime::Runtime, - RuntimeOrigin = pendulum_runtime::RuntimeOrigin, - XcmpMessageHandler = pendulum_runtime::XcmpQueue, - DmpMessageHandler = pendulum_runtime::DmpQueue, - new_ext = para_ext_pendulum(2094), - } -} - -decl_test_parachain! { - pub struct Statemint { - Runtime = statemint_runtime::Runtime, - RuntimeOrigin = statemint_runtime::RuntimeOrigin, - XcmpMessageHandler = statemint_runtime::XcmpQueue, - DmpMessageHandler = statemint_runtime::DmpQueue, - new_ext = para_ext_statemint(1000), - } -} - -decl_test_network! { - pub struct MockNet { - relay_chain = Relay, - parachains = vec![ - (1000, Statemint), - (2094, PendulumParachain), - ], - } -} - -pub fn para_account_id(id: u32) -> polkadot_core_primitives::AccountId { - ParaId::from(id).into_account_truncating() -} - -pub fn relay_ext() -> sp_io::TestExternalities { - use polkadot_runtime::{Runtime, System}; - let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); - pallet_balances::GenesisConfig:: { - balances: vec![ - (AccountId::from(ALICE), dot(100000)), - (AccountId::from(BOB), dot(100)), - (para_account_id(2094), 10 * dot(100000)), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - polkadot_runtime_parachains::configuration::GenesisConfig:: { - config: default_parachains_host_configuration(), - } - .assimilate_storage(&mut t) - .unwrap(); - >::assimilate_storage( - &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, - &mut t, - ) - .unwrap(); - let mut ext = sp_io::TestExternalities::new(t); - ext.execute_with(|| System::set_block_number(1)); - ext -} - -pub fn para_ext_pendulum(parachain_id: u32) -> sp_io::TestExternalities { - ExtBuilderPendulum::default() - .balances(vec![]) - .parachain_id(parachain_id) - .build() -} - -pub fn para_ext_statemint(parachain_id: u32) -> sp_io::TestExternalities { - ExtStatemintBuilder::default() - .balances(vec![]) - .parachain_id(parachain_id) - .build() -} - -fn default_parachains_host_configuration() -> HostConfiguration { - HostConfiguration { - minimum_validation_upgrade_delay: 5, - validation_upgrade_cooldown: 5u32, - validation_upgrade_delay: 5, - 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_ref_time(4 * 1_000_000_000), - 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() - } -} - -#[test] -fn transfer_polkadot_from_relay_chain_to_pendulum() { - MockNet::reset(); - - let transfer_amount: Balance = dot(20); - let mut orml_tokens_before = 0; - PendulumParachain::execute_with(|| { - let orml_tokens_before = pendulum_runtime::Tokens::balance( - pendulum_runtime::PendulumCurrencyId::XCM(0), - &ALICE.into(), - ); - }); - - Relay::execute_with(|| { - assert_ok!(polkadot_runtime::XcmPallet::reserve_transfer_assets( - polkadot_runtime::RuntimeOrigin::signed(ALICE.into()), - Box::new(Parachain(2094).into().into()), - Box::new(Junction::AccountId32 { network: NetworkId::Any, id: ALICE }.into().into()), - Box::new((Here, transfer_amount).into()), - 0 - )); - }); - - PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System, Tokens}; - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Tokens(orml_tokens::Event::Deposited { .. }) - ))); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::DmpQueue(cumulus_pallet_dmp_queue::Event::ExecutedDownward { .. }) - ))); - }); - - PendulumParachain::execute_with(|| { - assert_eq!( - pendulum_runtime::Tokens::balance( - pendulum_runtime::PendulumCurrencyId::XCM(0), - &ALICE.into() - ), - orml_tokens_before + transfer_amount - DOT_FEE - ); - }); -} - -#[test] -fn transfer_polkadot_from_pendulum_to_relay_chain() { - MockNet::reset(); - - let transfer_dot_amount: Balance = dot(10); - let FEE = 421434140; - - Relay::execute_with(|| { - let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!(after_bob_free_balance, dot(100)); - }); - - PendulumParachain::execute_with(|| { - assert_ok!(pendulum_runtime::XTokens::transfer( - pendulum_runtime::RuntimeOrigin::signed(BOB.into()), - pendulum_runtime::PendulumCurrencyId::XCM(0), - transfer_dot_amount, - Box::new( - MultiLocation::new( - 1, - Junctions::X1(Junction::AccountId32 { id: BOB, network: NetworkId::Any }) - ) - .into() - ), - WeightLimit::Limited(4_000_000_000), - )); - }); - - PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System}; - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Tokens(orml_tokens::Event::Withdrawn { .. }) - ))); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XTokens(orml_xtokens::Event::TransferredMultiAssets { .. }) - ))); - }); - - Relay::execute_with(|| { - use polkadot_runtime::{RuntimeEvent, System}; - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Balances(pallet_balances::Event::Withdraw { .. }) - ))); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Balances(pallet_balances::Event::Deposit { .. }) - ))); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Ump(polkadot_runtime_parachains::ump::Event::ExecutedUpward { .. }) - ))); - }); - - Relay::execute_with(|| { - let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!(after_bob_free_balance, dot(100) + transfer_dot_amount - FEE); - }); -} - -#[test] -fn statemint_transfer_incorrect_asset_to_pendulum_fails() { - let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); - - PendulumParachain::execute_with(|| { - assert_eq!( - pendulum_runtime::Tokens::balance( - pendulum_runtime::PendulumCurrencyId::XCM(1), - &BOB.into() - ), - 0 - ); - }); - - Statemint::execute_with(|| { - use statemint_runtime::*; - - let origin = RuntimeOrigin::signed(ALICE.into()); - Balances::make_free_balance_be(&ALICE.into(), TEN); - Balances::make_free_balance_be(&BOB.into(), UNIT); - - // If using non root, create custom asset cost 0.1 Dot - // We're using force_create here to make sure asset is sufficient. - assert_ok!(Assets::force_create( - RuntimeOrigin::root(), - INCORRECT_ASSET_ID.into(), - MultiAddress::Id(ALICE.into()), - true, - UNIT / 100 - )); - - assert_ok!(Assets::mint( - origin.clone(), - INCORRECT_ASSET_ID.into(), - MultiAddress::Id(ALICE.into()), - 1000 * UNIT - )); - - // need to have some DOT to be able to receive user assets - Balances::make_free_balance_be(¶_2094, UNIT); - - assert_ok!(PolkadotXcm::limited_reserve_transfer_assets( - origin.clone(), - Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), - Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), - Box::new( - (X2(PalletInstance(50), GeneralIndex(INCORRECT_ASSET_ID as u128)), TEN).into() - ), - 0, - WeightLimit::Unlimited - )); - - assert_eq!(990 * UNIT, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(ALICE))); - assert_eq!(0, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(BOB))); - - assert_eq!(TEN, Assets::balance(INCORRECT_ASSET_ID, ¶_2094)); - // the DOT balance of sibling parachain sovereign account is not changed - assert_eq!(UNIT, Balances::free_balance(¶_2094)); - }); - - // Rerun the Statemint::execute to actually send the egress message via XCM - Statemint::execute_with(|| {}); - - PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System}; - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { - message_hash: _, - error: xcm::v2::Error::FailedToTransactAsset(..), - weight: _ - }) - ))); - }); -} - -#[test] -fn statemint_transfer_asset_to_pendulum() { - let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); - - PendulumParachain::execute_with(|| { - assert_eq!( - pendulum_runtime::Tokens::balance( - pendulum_runtime::PendulumCurrencyId::XCM(1), - &BOB.into() - ), - 0 - ); - }); - - Statemint::execute_with(|| { - use statemint_runtime::*; - - let origin = RuntimeOrigin::signed(ALICE.into()); - Balances::make_free_balance_be(&ALICE.into(), TEN); - Balances::make_free_balance_be(&BOB.into(), UNIT); - - // If using non root, create custom asset cost 0.1 Dot - // We're using force_create here to make sure asset is sufficient. - assert_ok!(Assets::force_create( - RuntimeOrigin::root(), - ASSET_ID.into(), - MultiAddress::Id(ALICE.into()), - true, - UNIT / 100 - )); - - assert_ok!(Assets::mint( - origin.clone(), - ASSET_ID.into(), - MultiAddress::Id(ALICE.into()), - 1000 * UNIT - )); - - // need to have some DOT to be able to receive user assets - Balances::make_free_balance_be(¶_2094, UNIT); - - assert_ok!(PolkadotXcm::limited_reserve_transfer_assets( - origin.clone(), - Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), - Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), - Box::new((X2(PalletInstance(50), GeneralIndex(ASSET_ID as u128)), TEN).into()), - 0, - WeightLimit::Unlimited - )); - - assert_eq!(990 * UNIT, Assets::balance(ASSET_ID, &AccountId::from(ALICE))); - assert_eq!(0, Assets::balance(ASSET_ID, &AccountId::from(BOB))); - - assert_eq!(TEN, Assets::balance(ASSET_ID, ¶_2094)); - // the DOT balance of sibling parachain sovereign account is not changed - assert_eq!(UNIT, Balances::free_balance(¶_2094)); - }); - - // Rerun the Statemint::execute to actually send the egress message via XCM - Statemint::execute_with(|| {}); - - PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System}; - for i in System::events().iter() { - println!(" Pendulum_runtime {:?}", i); - } - - assert!(System::events() - .iter() - .any(|r| matches!(r.event, RuntimeEvent::Tokens(orml_tokens::Event::Endowed { .. })))); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::Tokens(orml_tokens::Event::Deposited { .. }) - ))); - - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Success { .. }) - ))); - - assert_eq!( - pendulum_runtime::Tokens::balance( - pendulum_runtime::PendulumCurrencyId::XCM(1), - &BOB.into() - ), - TEN - ); - }); -} - -#[test] -fn statemint_transfer_asset_to_statemint() { - statemint_transfer_asset_to_pendulum(); - - Statemint::execute_with(|| {}); - - PendulumParachain::execute_with(|| { - assert_eq!(TEN, Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB))); - // ensure sender has enough PEN balance to be charged as fee - assert_ok!(Balances::mint_into(&AccountId::from(BOB), TEN)); - - assert_ok!(XTokens::transfer( - RuntimeOrigin::signed(BOB.into()), - PendulumCurrencyId::XCM(1), - UNIT * 1, - Box::new( - MultiLocation::new( - 1, - X2( - Parachain(1000), - Junction::AccountId32 { network: NetworkId::Any, id: BOB.into() } - ) - ) - .into() - ), - WeightLimit::Limited(10_000_000_000), - )); - - assert_eq!( - TEN - 1 * UNIT, //inital balance - one unit - Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB)) - ); - - use pendulum_runtime::{RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( - r.event, - RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. }) - ))); - - // assert_eq!(TEN - ksm_fee_amount, Tokens::free_balance(KSM, &AccountId::from(BOB))); - }); - - Statemint::execute_with(|| { - use statemint_runtime::*; - - // https://github.com/paritytech/cumulus/pull/1278 support using self sufficient asset - // for paying xcm execution fee on Statemint. - assert_eq!(990_000_000_000, Assets::balance(ASSET_ID, &AccountId::from(BOB))); - }); -} +mod setup; +use setup::*; +mod polkadot_test_net; +mod tests; diff --git a/runtime/integration-tests/pendulum/src/polkadot_test_net.rs b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs new file mode 100644 index 000000000..9391a5506 --- /dev/null +++ b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs @@ -0,0 +1,121 @@ +use crate::*; +decl_test_relay_chain! { + pub struct Relay { + Runtime = polkadot_runtime::Runtime, + XcmConfig = polkadot_runtime::xcm_config::XcmConfig, + new_ext = relay_ext(), + } +} + +decl_test_parachain! { + pub struct PendulumParachain { + Runtime = pendulum_runtime::Runtime, + RuntimeOrigin = pendulum_runtime::RuntimeOrigin, + XcmpMessageHandler = pendulum_runtime::XcmpQueue, + DmpMessageHandler = pendulum_runtime::DmpQueue, + new_ext = para_ext_pendulum(2094), + } +} + +decl_test_parachain! { + pub struct Statemint { + Runtime = statemint_runtime::Runtime, + RuntimeOrigin = statemint_runtime::RuntimeOrigin, + XcmpMessageHandler = statemint_runtime::XcmpQueue, + DmpMessageHandler = statemint_runtime::DmpQueue, + new_ext = para_ext_statemint(1000), + } +} + +decl_test_network! { + pub struct MockNet { + relay_chain = Relay, + parachains = vec![ + (1000, Statemint), + (2094, PendulumParachain), + ], + } +} + +pub fn para_account_id(id: u32) -> polkadot_core_primitives::AccountId { + ParaId::from(id).into_account_truncating() +} + +pub fn relay_ext() -> sp_io::TestExternalities { + use polkadot_runtime::{Runtime, System}; + let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); + pallet_balances::GenesisConfig:: { + balances: vec![ + (AccountId::from(ALICE), dot(100000)), + (AccountId::from(BOB), dot(100)), + (para_account_id(2094), 10 * dot(100000)), + ], + } + .assimilate_storage(&mut t) + .unwrap(); + polkadot_runtime_parachains::configuration::GenesisConfig:: { + config: default_parachains_host_configuration(), + } + .assimilate_storage(&mut t) + .unwrap(); + >::assimilate_storage( + &pallet_xcm::GenesisConfig { safe_xcm_version: Some(2) }, + &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() -> HostConfiguration { + HostConfiguration { + minimum_validation_upgrade_delay: 5, + validation_upgrade_cooldown: 5u32, + validation_upgrade_delay: 5, + 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_ref_time(4 * 1_000_000_000), + 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 para_ext_pendulum(parachain_id: u32) -> sp_io::TestExternalities { + ExtBuilderPendulum::default() + .balances(vec![]) + .parachain_id(parachain_id) + .build() +} + +pub fn para_ext_statemint(parachain_id: u32) -> sp_io::TestExternalities { + ExtStatemintBuilder::default() + .balances(vec![]) + .parachain_id(parachain_id) + .build() +} diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index edcc01d53..f8adc78ce 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -1,4 +1,4 @@ -use crate::*; +use crate::{polkadot_test_net::*, *}; #[test] fn transfer_polkadot_from_relay_chain_to_pendulum() { MockNet::reset(); From 8085e30067a1ff61ef70d2eee5a869ff1d17ebbc Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 14:33:27 +0100 Subject: [PATCH 11/14] split tests, setup and polkadot_test_net to different files --- runtime/integration-tests/pendulum/src/lib.rs | 39 +------------------ .../pendulum/src/polkadot_test_net.rs | 14 ++++++- .../integration-tests/pendulum/src/setup.rs | 19 +++++++++ .../integration-tests/pendulum/src/tests.rs | 38 ++++++++++++++++-- 4 files changed, 69 insertions(+), 41 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index cb94d018b..552378512 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -1,39 +1,4 @@ -use frame_support::{ - assert_ok, - traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, -}; -use pendulum_runtime::{ - Balances, PendulumCurrencyId, Runtime, RuntimeOrigin, System, Tokens, XTokens, -}; -use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; -use polkadot_parachain::primitives::{Id as ParaId, Sibling}; -use polkadot_primitives::v2::{MAX_CODE_SIZE, MAX_POV_SIZE}; -use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_runtime::{traits::AccountIdConversion, MultiAddress}; -use xcm::{ - latest::{ - AssetId, Fungibility, Junction, Junction::*, Junctions::*, MultiAsset, MultiLocation, - NetworkId, WeightLimit, - }, - v2::{Instruction::WithdrawAsset, Xcm}, - VersionedMultiLocation, -}; -const DOT_FEE: Balance = 3200000000; -const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint -const INCORRECT_ASSET_ID: u32 = 0; -pub const UNIT: Balance = 1_000_000_000_000; -pub const TEN: Balance = 10_000_000_000_000; -use xcm_emulator::{ - decl_test_network, decl_test_parachain, decl_test_relay_chain, Junctions, TestExt, Weight, -}; -pub fn dot(amount: Balance) -> Balance { - amount * 10u128.saturating_pow(9) -} -pub const ALICE: [u8; 32] = [4u8; 32]; -pub const BOB: [u8; 32] = [5u8; 32]; -pub const INITIAL_BALANCE: u128 = 1_000_000_000; - -mod setup; -use setup::*; +#![cfg(test)] mod polkadot_test_net; +mod setup; mod tests; diff --git a/runtime/integration-tests/pendulum/src/polkadot_test_net.rs b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs index 9391a5506..19dab90e7 100644 --- a/runtime/integration-tests/pendulum/src/polkadot_test_net.rs +++ b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs @@ -1,4 +1,16 @@ -use crate::*; +use crate::setup::{dot, ExtBuilderPendulum, ExtStatemintBuilder, ALICE, BOB}; +use frame_support::{ + assert_ok, + traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, +}; +use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; +use polkadot_parachain::primitives::{Id as ParaId, Sibling}; +use polkadot_primitives::v2::{MAX_CODE_SIZE, MAX_POV_SIZE}; +use polkadot_runtime_parachains::configuration::HostConfiguration; +use sp_runtime::{traits::AccountIdConversion, MultiAddress}; +use xcm_emulator::{ + decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt, Weight, +}; decl_test_relay_chain! { pub struct Relay { Runtime = polkadot_runtime::Runtime, diff --git a/runtime/integration-tests/pendulum/src/setup.rs b/runtime/integration-tests/pendulum/src/setup.rs index b4a6c5d1d..ab08891b0 100644 --- a/runtime/integration-tests/pendulum/src/setup.rs +++ b/runtime/integration-tests/pendulum/src/setup.rs @@ -1,4 +1,23 @@ use super::*; +use pendulum_runtime::{ + Balances, PendulumCurrencyId, Runtime, RuntimeOrigin, System, Tokens, XTokens, +}; + +use frame_support::{ + assert_ok, + traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, +}; + +use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; +use polkadot_parachain::primitives::{Id as ParaId, Sibling}; + +pub fn dot(amount: Balance) -> Balance { + amount * 10u128.saturating_pow(9) +} +pub const ALICE: [u8; 32] = [4u8; 32]; +pub const BOB: [u8; 32] = [5u8; 32]; +pub const INITIAL_BALANCE: u128 = 1_000_000_000; + pub struct ExtBuilderPendulum { balances: Vec<(AccountId, PendulumCurrencyId, Balance)>, parachain_id: u32, diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index f8adc78ce..dce551de4 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -1,4 +1,37 @@ -use crate::{polkadot_test_net::*, *}; +use crate::{polkadot_test_net::*, setup::*, *}; + +use sp_runtime::{traits::AccountIdConversion, MultiAddress}; + +use xcm_emulator::{Junctions, TestExt}; + +use xcm::{ + latest::{ + AssetId, Fungibility, Junction, Junction::*, Junctions::*, MultiAsset, MultiLocation, + NetworkId, WeightLimit, + }, + v2::{Instruction::WithdrawAsset, Xcm}, + VersionedMultiLocation, +}; + +use pendulum_runtime::{ + Balances, PendulumCurrencyId, Runtime, RuntimeOrigin, System, Tokens, XTokens, +}; + +use frame_support::{ + assert_ok, + traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, +}; + +use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; +use polkadot_parachain::primitives::{Id as ParaId, Sibling}; + +const DOT_FEE: Balance = 3200000000; +const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint +const INCORRECT_ASSET_ID: u32 = 0; +const FEE: u128 = 421434140; +pub const UNIT: Balance = 1_000_000_000_000; +pub const TEN: Balance = 10_000_000_000_000; + #[test] fn transfer_polkadot_from_relay_chain_to_pendulum() { MockNet::reset(); @@ -6,7 +39,7 @@ fn transfer_polkadot_from_relay_chain_to_pendulum() { let transfer_amount: Balance = dot(20); let mut orml_tokens_before = 0; PendulumParachain::execute_with(|| { - let orml_tokens_before = pendulum_runtime::Tokens::balance( + orml_tokens_before = pendulum_runtime::Tokens::balance( pendulum_runtime::PendulumCurrencyId::XCM(0), &ALICE.into(), ); @@ -52,7 +85,6 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { MockNet::reset(); let transfer_dot_amount: Balance = dot(10); - let FEE = 421434140; Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); From 1920517f95a31faf22199c50b2b14c8316dec385 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 15:14:05 +0100 Subject: [PATCH 12/14] remove unused import in all files --- .../pendulum/src/polkadot_test_net.rs | 16 ++++----- .../integration-tests/pendulum/src/setup.rs | 15 ++------ .../integration-tests/pendulum/src/tests.rs | 34 ++++++------------- 3 files changed, 19 insertions(+), 46 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/polkadot_test_net.rs b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs index 19dab90e7..bba21cf92 100644 --- a/runtime/integration-tests/pendulum/src/polkadot_test_net.rs +++ b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs @@ -1,16 +1,12 @@ use crate::setup::{dot, ExtBuilderPendulum, ExtStatemintBuilder, ALICE, BOB}; -use frame_support::{ - assert_ok, - traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, -}; -use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; -use polkadot_parachain::primitives::{Id as ParaId, Sibling}; +use frame_support::traits::GenesisBuild; +use polkadot_core_primitives::{AccountId, BlockNumber}; +use polkadot_parachain::primitives::Id as ParaId; use polkadot_primitives::v2::{MAX_CODE_SIZE, MAX_POV_SIZE}; use polkadot_runtime_parachains::configuration::HostConfiguration; -use sp_runtime::{traits::AccountIdConversion, MultiAddress}; -use xcm_emulator::{ - decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt, Weight, -}; +use sp_runtime::traits::AccountIdConversion; +use xcm_emulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, Weight}; + decl_test_relay_chain! { pub struct Relay { Runtime = polkadot_runtime::Runtime, diff --git a/runtime/integration-tests/pendulum/src/setup.rs b/runtime/integration-tests/pendulum/src/setup.rs index ab08891b0..4ecec011c 100644 --- a/runtime/integration-tests/pendulum/src/setup.rs +++ b/runtime/integration-tests/pendulum/src/setup.rs @@ -1,15 +1,6 @@ -use super::*; -use pendulum_runtime::{ - Balances, PendulumCurrencyId, Runtime, RuntimeOrigin, System, Tokens, XTokens, -}; - -use frame_support::{ - assert_ok, - traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, -}; - -use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; -use polkadot_parachain::primitives::{Id as ParaId, Sibling}; +use frame_support::traits::GenesisBuild; +use pendulum_runtime::{PendulumCurrencyId, Runtime, System}; +use polkadot_core_primitives::{AccountId, Balance}; pub fn dot(amount: Balance) -> Balance { amount * 10u128.saturating_pow(9) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index dce551de4..2037fcee8 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -1,36 +1,22 @@ -use crate::{polkadot_test_net::*, setup::*, *}; - -use sp_runtime::{traits::AccountIdConversion, MultiAddress}; - -use xcm_emulator::{Junctions, TestExt}; - -use xcm::{ - latest::{ - AssetId, Fungibility, Junction, Junction::*, Junctions::*, MultiAsset, MultiLocation, - NetworkId, WeightLimit, - }, - v2::{Instruction::WithdrawAsset, Xcm}, - VersionedMultiLocation, -}; - -use pendulum_runtime::{ - Balances, PendulumCurrencyId, Runtime, RuntimeOrigin, System, Tokens, XTokens, -}; - +use crate::{polkadot_test_net::*, setup::*}; use frame_support::{ assert_ok, - traits::{fungible::Mutate, fungibles::Inspect, Currency, GenesisBuild}, + traits::{fungible::Mutate, fungibles::Inspect, Currency}, }; +use pendulum_runtime::{Balances, PendulumCurrencyId, RuntimeOrigin, Tokens, XTokens}; +use sp_runtime::{traits::AccountIdConversion, MultiAddress}; +use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, NetworkId, WeightLimit}; +use xcm_emulator::{Junctions, TestExt}; -use polkadot_core_primitives::{AccountId, Balance, BlockNumber}; -use polkadot_parachain::primitives::{Id as ParaId, Sibling}; +use polkadot_core_primitives::{AccountId, Balance}; +use polkadot_parachain::primitives::Sibling; const DOT_FEE: Balance = 3200000000; const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint const INCORRECT_ASSET_ID: u32 = 0; -const FEE: u128 = 421434140; pub const UNIT: Balance = 1_000_000_000_000; pub const TEN: Balance = 10_000_000_000_000; +const FEE: u128 = 421434140; #[test] fn transfer_polkadot_from_relay_chain_to_pendulum() { @@ -56,7 +42,7 @@ fn transfer_polkadot_from_relay_chain_to_pendulum() { }); PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System, Tokens}; + use pendulum_runtime::{RuntimeEvent, System}; assert!(System::events().iter().any(|r| matches!( r.event, From 2f18be69312712afbe64875988c7674429ca12ca Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 15:15:50 +0100 Subject: [PATCH 13/14] rename to pendulum-runtime-integration-tests --- Cargo.lock | 223 +++++++++--------- runtime/integration-tests/pendulum/Cargo.toml | 2 +- 2 files changed, 113 insertions(+), 112 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07104e149..d07f07308 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,9 +57,9 @@ dependencies = [ [[package]] name = "aead" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" +checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ "crypto-common", "generic-array 0.14.7", @@ -119,7 +119,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" dependencies = [ - "aead 0.5.1", + "aead 0.5.2", "aes 0.8.2", "cipher 0.4.4", "ctr 0.9.2", @@ -472,7 +472,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.5", + "rustix 0.37.7", "slab", "socket2", "waker-fn", @@ -495,7 +495,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -1100,7 +1100,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -1196,9 +1196,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core2" @@ -2006,9 +2006,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.1" +version = "4.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" +checksum = "03d928d978dbec61a1167414f5ec534f24bea0d7a0d24dd9b6233d3d8223e585" dependencies = [ "cfg-if", "fiat-crypto", @@ -2042,7 +2042,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -2059,7 +2059,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -2527,22 +2527,22 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" +checksum = "0044ebdf7fbb2a772e0c0233a9d3173c5cd8af8ae7078d4c5188af44ffffaa4b" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" +checksum = "9d2c772ccdbdfd1967b4f5d79d17c98ebf92009fdcc838db7aa434462f600c26" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.13", ] [[package]] @@ -2553,7 +2553,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -2751,9 +2751,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ace6ec7cc19c8ed33a32eaa9ea692d7faea05006b5356b9e2b668ec4bc3955" +checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" [[package]] name = "file-per-thread-logger" @@ -3328,7 +3328,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -3751,16 +3751,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.55" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "716f12fbcfac6ffab0a5e9ec51d0a0ff70503742bb2dc7b99396394c9dc323f0" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.47.0", + "windows 0.48.0", ] [[package]] @@ -3982,7 +3982,7 @@ checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes 1.0.9", - "rustix 0.37.5", + "rustix 0.37.7", "windows-sys 0.45.0", ] @@ -4358,9 +4358,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" [[package]] name = "libloading" @@ -5074,7 +5074,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.5", + "rustix 0.37.7", ] [[package]] @@ -7515,6 +7515,40 @@ dependencies = [ "zenlink-protocol-runtime-api", ] +[[package]] +name = "pendulum-runtime-integration-tests" +version = "0.1.0" +dependencies = [ + "cumulus-pallet-dmp-queue", + "cumulus-pallet-xcmp-queue", + "frame-support", + "frame-system", + "orml-tokens 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-xtokens", + "pallet-balances", + "pallet-xcm", + "parachain-info", + "parity-scale-codec", + "pendulum-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-runtime", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "statemint-runtime", + "xcm", + "xcm-builder", + "xcm-emulator", + "xcm-executor", + "xcm-simulator", +] + [[package]] name = "percent-encoding" version = "2.2.0" @@ -7551,7 +7585,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -8934,9 +8968,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.54" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -9346,7 +9380,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -9718,9 +9752,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.5" +version = "0.37.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e78cc525325c06b4a7ff02db283472f3c042b7ff0c391f96c6d5ac6f4f91b75" +checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" dependencies = [ "bitflags", "errno 0.3.0", @@ -11092,7 +11126,7 @@ checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -11278,14 +11312,14 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" +checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" dependencies = [ "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.1", + "curve25519-dalek 4.0.0-rc.2", "rand_core 0.6.4", "ring", "rustc_version 0.4.0", @@ -12067,9 +12101,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0959fd6f767df20b231736396e4f602171e00d95205676286e79d4a4eb67bef" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" @@ -12469,9 +12503,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79d9531f94112cfc3e4c8f5f02cb2b58f72c97b7efd85f70203cc6d8efda5927" +checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" dependencies = [ "proc-macro2", "quote", @@ -12532,7 +12566,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.5", + "rustix 0.37.7", "windows-sys 0.45.0", ] @@ -12568,7 +12602,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -12739,7 +12773,7 @@ checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] @@ -13505,7 +13539,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01bf50edb2ea9d922aa75a7bf3c15e26a6c9e2d18c56e862b49737a582901729" dependencies = [ - "spin 0.9.7", + "spin 0.9.8", "wasmi_arena", "wasmi_core 0.5.0", "wasmparser-nostd", @@ -13870,7 +13904,7 @@ dependencies = [ "tokio", "webpki 0.21.4", "webrtc-util", - "x25519-dalek 2.0.0-pre.1", + "x25519-dalek 2.0.0-rc.2", "x509-parser 0.13.2", ] @@ -14156,11 +14190,11 @@ dependencies = [ [[package]] name = "windows" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2649ff315bee4c98757f15dac226efe3d81927adbb6e882084bb1ee3e0c330a7" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.47.0", + "windows-targets 0.48.0", ] [[package]] @@ -14217,17 +14251,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f8996d3f43b4b2d44327cd71b7b0efd1284ab60e6e9d0e8b630e18555d87d3e" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm 0.47.0", - "windows_aarch64_msvc 0.47.0", - "windows_i686_gnu 0.47.0", - "windows_i686_msvc 0.47.0", - "windows_x86_64_gnu 0.47.0", - "windows_x86_64_gnullvm 0.47.0", - "windows_x86_64_msvc 0.47.0", + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -14238,9 +14272,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831d567d53d4f3cb1db332b68e6e2b6260228eb4d99a777d8b2e8ed794027c90" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" @@ -14262,9 +14296,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a42d54a417c60ce4f0e31661eed628f0fa5aca73448c093ec4d45fab4c51cdf" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" @@ -14286,9 +14320,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1925beafdbb22201a53a483db861a5644123157c1c3cee83323a2ed565d71e3" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" @@ -14310,9 +14344,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8ef8f2f1711b223947d9b69b596cf5a4e452c930fb58b6fc3fdae7d0ec6b31" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" @@ -14334,9 +14368,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acaa0c2cf0d2ef99b61c308a0c3dbae430a51b7345dedec470bd8f53f5a3642" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" @@ -14346,9 +14380,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a0628f71be1d11e17ca4a0e9e15b3a5180f6fbf1c2d55e3ba3f850378052c1" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" @@ -14370,9 +14404,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.47.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6e62c256dc6d40b8c8707df17df8d774e60e39db723675241e7c15e910bce7" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" @@ -14414,12 +14448,13 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-pre.1" +version = "2.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +checksum = "fabd6e16dd08033932fc3265ad4510cc2eab24656058a6dcb107ffe274abcc95" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.0.0-rc.2", "rand_core 0.6.4", + "serde", "zeroize", ] @@ -14566,40 +14601,6 @@ dependencies = [ "xcm-executor", ] -[[package]] -name = "xcm-simulator-example" -version = "0.1.0" -dependencies = [ - "cumulus-pallet-dmp-queue", - "cumulus-pallet-xcmp-queue", - "frame-support", - "frame-system", - "orml-tokens 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "orml-xtokens", - "pallet-balances", - "pallet-xcm", - "parachain-info", - "parity-scale-codec", - "pendulum-runtime", - "polkadot-core-primitives", - "polkadot-parachain", - "polkadot-primitives", - "polkadot-runtime", - "polkadot-runtime-common", - "polkadot-runtime-parachains", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "statemint-runtime", - "xcm", - "xcm-builder", - "xcm-emulator", - "xcm-executor", - "xcm-simulator", -] - [[package]] name = "yamux" version = "0.10.2" @@ -14674,7 +14675,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.12", + "syn 2.0.13", ] [[package]] diff --git a/runtime/integration-tests/pendulum/Cargo.toml b/runtime/integration-tests/pendulum/Cargo.toml index ae634aa70..9aed1e5b7 100644 --- a/runtime/integration-tests/pendulum/Cargo.toml +++ b/runtime/integration-tests/pendulum/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "xcm-simulator-example" +name = "pendulum-runtime-integration-tests" description = "Examples of xcm-simulator usage." authors = ["Pendulum"] edition = "2021" From 18c90a83c3f47d8f783b6d11276c07dd60ffb8fd Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Tue, 4 Apr 2023 15:15:50 +0100 Subject: [PATCH 14/14] Revert "rename to pendulum-runtime-integration-tests" This reverts commit 2f18be69312712afbe64875988c7674429ca12ca. --- Cargo.lock | 223 +++++++++--------- runtime/integration-tests/pendulum/Cargo.toml | 2 +- 2 files changed, 112 insertions(+), 113 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d07f07308..07104e149 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -57,9 +57,9 @@ dependencies = [ [[package]] name = "aead" -version = "0.5.2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" dependencies = [ "crypto-common", "generic-array 0.14.7", @@ -119,7 +119,7 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" dependencies = [ - "aead 0.5.2", + "aead 0.5.1", "aes 0.8.2", "cipher 0.4.4", "ctr 0.9.2", @@ -472,7 +472,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.7", + "rustix 0.37.5", "slab", "socket2", "waker-fn", @@ -495,7 +495,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -1100,7 +1100,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -1196,9 +1196,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "core2" @@ -2006,9 +2006,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.2" +version = "4.0.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d928d978dbec61a1167414f5ec534f24bea0d7a0d24dd9b6233d3d8223e585" +checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" dependencies = [ "cfg-if", "fiat-crypto", @@ -2042,7 +2042,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -2059,7 +2059,7 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -2527,22 +2527,22 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.7.6" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0044ebdf7fbb2a772e0c0233a9d3173c5cd8af8ae7078d4c5188af44ffffaa4b" +checksum = "e75d4cd21b95383444831539909fbb14b9dc3fdceb2a6f5d36577329a1f55ccb" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.7.6" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d2c772ccdbdfd1967b4f5d79d17c98ebf92009fdcc838db7aa434462f600c26" +checksum = "f58dc3c5e468259f19f2d46304a6b28f1c3d034442e14b322d2b850e36f6d5ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 1.0.109", ] [[package]] @@ -2553,7 +2553,7 @@ checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -2751,9 +2751,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.1.20" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" +checksum = "93ace6ec7cc19c8ed33a32eaa9ea692d7faea05006b5356b9e2b668ec4bc3955" [[package]] name = "file-per-thread-logger" @@ -3328,7 +3328,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -3751,16 +3751,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "716f12fbcfac6ffab0a5e9ec51d0a0ff70503742bb2dc7b99396394c9dc323f0" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows 0.48.0", + "windows 0.47.0", ] [[package]] @@ -3982,7 +3982,7 @@ checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes 1.0.9", - "rustix 0.37.7", + "rustix 0.37.5", "windows-sys 0.45.0", ] @@ -4358,9 +4358,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.141" +version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "libloading" @@ -5074,7 +5074,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.7", + "rustix 0.37.5", ] [[package]] @@ -7515,40 +7515,6 @@ dependencies = [ "zenlink-protocol-runtime-api", ] -[[package]] -name = "pendulum-runtime-integration-tests" -version = "0.1.0" -dependencies = [ - "cumulus-pallet-dmp-queue", - "cumulus-pallet-xcmp-queue", - "frame-support", - "frame-system", - "orml-tokens 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library.git?branch=polkadot-v0.9.37)", - "orml-xtokens", - "pallet-balances", - "pallet-xcm", - "parachain-info", - "parity-scale-codec", - "pendulum-runtime", - "polkadot-core-primitives", - "polkadot-parachain", - "polkadot-primitives", - "polkadot-runtime", - "polkadot-runtime-common", - "polkadot-runtime-parachains", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std", - "statemint-runtime", - "xcm", - "xcm-builder", - "xcm-emulator", - "xcm-executor", - "xcm-simulator", -] - [[package]] name = "percent-encoding" version = "2.2.0" @@ -7585,7 +7551,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -8968,9 +8934,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534" dependencies = [ "unicode-ident", ] @@ -9380,7 +9346,7 @@ checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -9752,9 +9718,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.7" +version = "0.37.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" +checksum = "0e78cc525325c06b4a7ff02db283472f3c042b7ff0c391f96c6d5ac6f4f91b75" dependencies = [ "bitflags", "errno 0.3.0", @@ -11126,7 +11092,7 @@ checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -11312,14 +11278,14 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" +checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" dependencies = [ "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.2", + "curve25519-dalek 4.0.0-rc.1", "rand_core 0.6.4", "ring", "rustc_version 0.4.0", @@ -12101,9 +12067,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.8" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +checksum = "c0959fd6f767df20b231736396e4f602171e00d95205676286e79d4a4eb67bef" [[package]] name = "spki" @@ -12503,9 +12469,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.13" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "79d9531f94112cfc3e4c8f5f02cb2b58f72c97b7efd85f70203cc6d8efda5927" dependencies = [ "proc-macro2", "quote", @@ -12566,7 +12532,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.7", + "rustix 0.37.5", "windows-sys 0.45.0", ] @@ -12602,7 +12568,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -12773,7 +12739,7 @@ checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] @@ -13539,7 +13505,7 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01bf50edb2ea9d922aa75a7bf3c15e26a6c9e2d18c56e862b49737a582901729" dependencies = [ - "spin 0.9.8", + "spin 0.9.7", "wasmi_arena", "wasmi_core 0.5.0", "wasmparser-nostd", @@ -13904,7 +13870,7 @@ dependencies = [ "tokio", "webpki 0.21.4", "webrtc-util", - "x25519-dalek 2.0.0-rc.2", + "x25519-dalek 2.0.0-pre.1", "x509-parser 0.13.2", ] @@ -14190,11 +14156,11 @@ dependencies = [ [[package]] name = "windows" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "2649ff315bee4c98757f15dac226efe3d81927adbb6e882084bb1ee3e0c330a7" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.47.0", ] [[package]] @@ -14251,17 +14217,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "2f8996d3f43b4b2d44327cd71b7b0efd1284ab60e6e9d0e8b630e18555d87d3e" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.47.0", + "windows_aarch64_msvc 0.47.0", + "windows_i686_gnu 0.47.0", + "windows_i686_msvc 0.47.0", + "windows_x86_64_gnu 0.47.0", + "windows_x86_64_gnullvm 0.47.0", + "windows_x86_64_msvc 0.47.0", ] [[package]] @@ -14272,9 +14238,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "831d567d53d4f3cb1db332b68e6e2b6260228eb4d99a777d8b2e8ed794027c90" [[package]] name = "windows_aarch64_msvc" @@ -14296,9 +14262,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "6a42d54a417c60ce4f0e31661eed628f0fa5aca73448c093ec4d45fab4c51cdf" [[package]] name = "windows_i686_gnu" @@ -14320,9 +14286,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "c1925beafdbb22201a53a483db861a5644123157c1c3cee83323a2ed565d71e3" [[package]] name = "windows_i686_msvc" @@ -14344,9 +14310,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "3a8ef8f2f1711b223947d9b69b596cf5a4e452c930fb58b6fc3fdae7d0ec6b31" [[package]] name = "windows_x86_64_gnu" @@ -14368,9 +14334,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "7acaa0c2cf0d2ef99b61c308a0c3dbae430a51b7345dedec470bd8f53f5a3642" [[package]] name = "windows_x86_64_gnullvm" @@ -14380,9 +14346,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "e5a0628f71be1d11e17ca4a0e9e15b3a5180f6fbf1c2d55e3ba3f850378052c1" [[package]] name = "windows_x86_64_msvc" @@ -14404,9 +14370,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "9d6e62c256dc6d40b8c8707df17df8d774e60e39db723675241e7c15e910bce7" [[package]] name = "winnow" @@ -14448,13 +14414,12 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-rc.2" +version = "2.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabd6e16dd08033932fc3265ad4510cc2eab24656058a6dcb107ffe274abcc95" +checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" dependencies = [ - "curve25519-dalek 4.0.0-rc.2", + "curve25519-dalek 3.2.0", "rand_core 0.6.4", - "serde", "zeroize", ] @@ -14601,6 +14566,40 @@ dependencies = [ "xcm-executor", ] +[[package]] +name = "xcm-simulator-example" +version = "0.1.0" +dependencies = [ + "cumulus-pallet-dmp-queue", + "cumulus-pallet-xcmp-queue", + "frame-support", + "frame-system", + "orml-tokens 0.4.1-dev (git+https://github.com/open-web3-stack/open-runtime-module-library.git?branch=polkadot-v0.9.37)", + "orml-xtokens", + "pallet-balances", + "pallet-xcm", + "parachain-info", + "parity-scale-codec", + "pendulum-runtime", + "polkadot-core-primitives", + "polkadot-parachain", + "polkadot-primitives", + "polkadot-runtime", + "polkadot-runtime-common", + "polkadot-runtime-parachains", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "statemint-runtime", + "xcm", + "xcm-builder", + "xcm-emulator", + "xcm-executor", + "xcm-simulator", +] + [[package]] name = "yamux" version = "0.10.2" @@ -14675,7 +14674,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.12", ] [[package]] diff --git a/runtime/integration-tests/pendulum/Cargo.toml b/runtime/integration-tests/pendulum/Cargo.toml index 9aed1e5b7..ae634aa70 100644 --- a/runtime/integration-tests/pendulum/Cargo.toml +++ b/runtime/integration-tests/pendulum/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "pendulum-runtime-integration-tests" +name = "xcm-simulator-example" description = "Examples of xcm-simulator usage." authors = ["Pendulum"] edition = "2021"