From f1dcd9fa2f61e2eabec07eb0eb3bab79b914f4c2 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 14 Aug 2025 11:00:29 +0200 Subject: [PATCH 1/3] Remove TODO - create_pool_with_native_on --- integration-tests/emulated/helpers/src/lib.rs | 79 ------------------- .../bridges/bridge-hub-polkadot/src/lib.rs | 5 +- 2 files changed, 2 insertions(+), 82 deletions(-) diff --git a/integration-tests/emulated/helpers/src/lib.rs b/integration-tests/emulated/helpers/src/lib.rs index e5a1dbed88..753746e39b 100644 --- a/integration-tests/emulated/helpers/src/lib.rs +++ b/integration-tests/emulated/helpers/src/lib.rs @@ -31,85 +31,6 @@ pub use xcm_emulator::Chain; pub mod common; -/// TODO: when bumping to polkadot-sdk stable2506, -/// remove this crate altogether and get the macros from `emulated-integration-tests-common`. -/// note: $asset needs to be prefunded outside this function -#[macro_export] -macro_rules! create_pool_with_native_on { - ( $chain:ident, $asset:expr, $is_foreign:expr, $asset_owner:expr ) => { - $crate::create_pool_with_native_on!( - $chain, - $asset, - $is_foreign, - $asset_owner, - 1_000_000_000_000, - 2_000_000_000_000 - ); - }; - - ( $chain:ident, $asset:expr, $is_foreign:expr, $asset_owner:expr, $native_amount:expr, $asset_amount:expr ) => { - $crate::paste::paste! { - <$chain>::execute_with(|| { - type RuntimeEvent = <$chain as $crate::Chain>::RuntimeEvent; - let owner = $asset_owner; - let signed_owner = <$chain as $crate::Chain>::RuntimeOrigin::signed(owner.clone()); - let native_asset = Location::parent(); - - if $is_foreign { - assert_ok!(<$chain as [<$chain Pallet>]>::ForeignAssets::mint( - signed_owner.clone(), - $asset.clone().into(), - owner.clone().into(), - 10_000_000_000_000, // For it to have more than enough. - )); - } else { - let asset_id = match $asset.clone().interior.last() { - Some(GeneralIndex(id)) => *id as u32, - _ => unreachable!(), - }; - assert_ok!(<$chain as [<$chain Pallet>]>::Assets::mint( - signed_owner.clone(), - asset_id.into(), - owner.clone().into(), - 10_000_000_000_000, // For it to have more than enough. - )); - } - - assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::create_pool( - signed_owner.clone(), - Box::new(native_asset.clone()), - Box::new($asset.clone().try_into().unwrap()), - )); - - assert_expected_events!( - $chain, - vec![ - RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::PoolCreated { .. }) => {}, - ] - ); - - assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::add_liquidity( - signed_owner, - Box::new(native_asset), - Box::new($asset), - $native_amount, - $asset_amount, - 0, - 0, - owner.into() - )); - - assert_expected_events!( - $chain, - vec![ - RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::LiquidityAdded { .. }) => {}, - ] - ); - }); - } - }; -} - #[macro_export] macro_rules! test_relay_is_trusted_teleporter { ( $sender_relay:ty, vec![$( $receiver_para:ty ),+], ($assets:expr, $amount:expr), $xcm_call:ident ) => { diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs index 06dd4fc576..a0c563c37f 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs @@ -36,8 +36,8 @@ pub use bp_messages::LegacyLaneId; pub use emulated_integration_tests_common::{ accounts::{ALICE, BOB}, impls::Inspect, - test_parachain_is_trusted_teleporter, test_parachain_is_trusted_teleporter_for_relay, - test_relay_is_trusted_teleporter, + create_pool_with_native_on, test_parachain_is_trusted_teleporter, + test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, xcm_emulator::{ assert_expected_events, bx, helpers::weight_within_threshold, Chain, Parachain as Para, RelayChain as Relay, Test, TestArgs, TestContext, TestExt, @@ -47,7 +47,6 @@ pub use emulated_integration_tests_common::{ }; pub use integration_tests_helpers::{ common::snowbridge::{MIN_ETHER_BALANCE, WETH}, - create_pool_with_native_on, }; pub use kusama_polkadot_system_emulated_network::{ asset_hub_kusama_emulated_chain::{ From 32e890e3d4fc60bbe7c94ca42dfa561d9b823309 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 14 Aug 2025 11:03:30 +0200 Subject: [PATCH 2/3] Remove more TODOs --- .../collectives-polkadot/src/tests/fellowship.rs | 2 +- .../tests/people/people-kusama/src/tests/governance.rs | 7 ++----- .../tests/people/people-polkadot/src/tests/governance.rs | 4 ++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs index 7dfabc06d8..5bed825397 100644 --- a/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs +++ b/integration-tests/emulated/tests/collectives/collectives-polkadot/src/tests/fellowship.rs @@ -36,7 +36,7 @@ fn fellows_whitelist_call() { UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind: OriginKind::Xcm, - fallback_max_weight: Some(Weight::from_parts(5_000_000_000, 500_000)), + fallback_max_weight: None, call: PolkadotCall::Whitelist( pallet_whitelist::Call::::whitelist_call { call_hash } ) diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs index b7a432e202..a1d8ee136b 100644 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs +++ b/integration-tests/emulated/tests/people/people-kusama/src/tests/governance.rs @@ -48,10 +48,7 @@ fn relay_commands_add_registrar() { UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind, - // TODO: - // This and the below weight data in the XCM can be removed once XCMv5 is - // used. - fallback_max_weight: Some(Weight::from_parts(5_000_000_000, 500_000)), + fallback_max_weight: None, call: add_registrar_call.encode().into(), } ]))), @@ -110,7 +107,7 @@ fn relay_commands_add_registrar_wrong_origin() { UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind, - fallback_max_weight: Some(Weight::from_parts(5_000_000_000, 500_000)), + fallback_max_weight: None, call: add_registrar_call.encode().into(), } ]))), diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs index 1b156a5207..7d8c6d054d 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs +++ b/integration-tests/emulated/tests/people/people-polkadot/src/tests/governance.rs @@ -48,7 +48,7 @@ fn relay_commands_add_registrar() { UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind, - fallback_max_weight: Some(Weight::from_parts(5_000_000_000, 500_000)), + fallback_max_weight: None, call: add_registrar_call.encode().into(), } ]))), @@ -107,7 +107,7 @@ fn relay_commands_add_registrar_wrong_origin() { UnpaidExecution { weight_limit: Unlimited, check_origin: None }, Transact { origin_kind, - fallback_max_weight: Some(Weight::from_parts(5_000_000_000, 500_000)), + fallback_max_weight: None, call: add_registrar_call.encode().into(), } ]))), From d8d31d39cb8b0d77d4d07429192f2f2d75800415 Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Thu, 14 Aug 2025 11:13:31 +0200 Subject: [PATCH 3/3] fmt --- .../tests/bridges/bridge-hub-polkadot/src/lib.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs index a0c563c37f..ce667e3acc 100644 --- a/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs +++ b/integration-tests/emulated/tests/bridges/bridge-hub-polkadot/src/lib.rs @@ -35,9 +35,10 @@ pub use bp_messages::LegacyLaneId; // Cumulus pub use emulated_integration_tests_common::{ accounts::{ALICE, BOB}, + create_pool_with_native_on, impls::Inspect, - create_pool_with_native_on, test_parachain_is_trusted_teleporter, - test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter, + test_parachain_is_trusted_teleporter, test_parachain_is_trusted_teleporter_for_relay, + test_relay_is_trusted_teleporter, xcm_emulator::{ assert_expected_events, bx, helpers::weight_within_threshold, Chain, Parachain as Para, RelayChain as Relay, Test, TestArgs, TestContext, TestExt, @@ -45,9 +46,7 @@ pub use emulated_integration_tests_common::{ xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution}, ASSETS_PALLET_ID, PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, XCM_V4, }; -pub use integration_tests_helpers::{ - common::snowbridge::{MIN_ETHER_BALANCE, WETH}, -}; +pub use integration_tests_helpers::common::snowbridge::{MIN_ETHER_BALANCE, WETH}; pub use kusama_polkadot_system_emulated_network::{ asset_hub_kusama_emulated_chain::{ genesis::ED as ASSET_HUB_KUSAMA_ED, AssetHubKusamaParaPallet as AssetHubKusamaPallet,