Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 0 additions & 79 deletions integration-tests/emulated/helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ pub use bp_messages::LegacyLaneId;
// Cumulus
pub use emulated_integration_tests_common::{
accounts::{ALICE, BOB},
create_pool_with_native_on,
impls::Inspect,
test_parachain_is_trusted_teleporter, test_parachain_is_trusted_teleporter_for_relay,
test_relay_is_trusted_teleporter,
Expand All @@ -45,10 +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},
create_pool_with_native_on,
};
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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::<PolkadotRuntime>::whitelist_call { call_hash }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
]))),
Expand Down Expand Up @@ -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(),
}
]))),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
]))),
Expand Down Expand Up @@ -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(),
}
]))),
Expand Down