-
Notifications
You must be signed in to change notification settings - Fork 141
Fix and re-enable some xcm tests #1009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,27 +18,36 @@ use crate::*; | |
| /// Relay Chain should be able to execute `Transact` instructions in System Parachain | ||
| /// when `OriginKind::Superuser`. | ||
| #[test] | ||
| #[ignore] | ||
| fn send_transact_as_superuser_from_relay_to_asset_hub_works() { | ||
| AssetHubKusama::force_create_asset_from_relay_as_root( | ||
| ASSET_ID, | ||
| ASSET_MIN_BALANCE, | ||
| true, | ||
| AssetHubKusamaSender::get(), | ||
| None, | ||
| ) | ||
| Kusama::execute_with(|| { | ||
| // send xcm transact to AssetHubKusama from root account on Relay | ||
| let call = <AssetHubKusama as Chain>::RuntimeCall::System(frame_system::Call::< | ||
| <AssetHubKusama as Chain>::Runtime, | ||
| >::remark { | ||
| remark: vec![], | ||
| }) | ||
| .encode() | ||
| .into(); | ||
| let root = <Kusama as Chain>::RuntimeOrigin::root(); | ||
| let asset_hub_location = Kusama::child_location_of(AssetHubKusama::para_id()).into(); | ||
| let xcm = xcm_transact_unpaid_execution(call, OriginKind::Superuser); | ||
| Dmp::make_parachain_reachable(AssetHubKusama::para_id()); | ||
| assert_ok!(<Kusama as KusamaPallet>::XcmPallet::send( | ||
| root, | ||
| bx!(asset_hub_location), | ||
| bx!(xcm), | ||
| )); | ||
| Kusama::assert_xcm_pallet_sent(); | ||
| }); | ||
| AssetHubKusama::execute_with(|| { | ||
| AssetHubKusama::assert_xcmp_queue_success(None); | ||
| }); | ||
| } | ||
|
|
||
| /// We tests two things here: | ||
| /// - Parachain should be able to send XCM paying its fee at Asset Hub using KSM | ||
| /// - Parachain should be able to create a new Foreign Asset at Asset Hub | ||
| #[test] | ||
| fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { | ||
| pub fn penpal_register_foreign_asset_on_asset_hub(asset_location_on_penpal: Location) { | ||
| let para_sovereign_account = AssetHubKusama::sovereign_account_id_of( | ||
| AssetHubKusama::sibling_location_of(PenpalA::para_id()), | ||
| ); | ||
| let asset_location_on_penpal = | ||
| Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())]); | ||
| let foreign_asset_at_asset_hub = Location::new(1, [Parachain(PenpalA::para_id().into())]) | ||
| .appended_with(asset_location_on_penpal) | ||
| .unwrap(); | ||
|
|
@@ -104,11 +113,20 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { | |
| }); | ||
| } | ||
|
|
||
| /// We tests two things here: | ||
| /// - Parachain should be able to send XCM paying its fee at Asset Hub using KSM | ||
| /// - Parachain should be able to create a new Foreign Asset at Asset Hub | ||
| #[test] | ||
| fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { | ||
| let asset_location_on_penpal = | ||
| Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())]); | ||
| penpal_register_foreign_asset_on_asset_hub(asset_location_on_penpal); | ||
| } | ||
|
|
||
| /// We tests two things here: | ||
| /// - Parachain should be able to send XCM paying its fee at Asset Hub using a pool | ||
| /// - Parachain should be able to create a new Asset at Asset Hub | ||
| #[test] | ||
| #[ignore] | ||
| fn send_xcm_from_para_to_asset_hub_paying_fee_from_pool() { | ||
| let asset_native: Location = asset_hub_kusama_runtime::xcm_config::KsmLocation::get(); | ||
| let asset_one = Location { | ||
|
|
@@ -118,7 +136,6 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_from_pool() { | |
| let penpal = AssetHubKusama::sovereign_account_id_of(AssetHubKusama::sibling_location_of( | ||
| PenpalA::para_id(), | ||
| )); | ||
|
|
||
| AssetHubKusama::execute_with(|| { | ||
| type RuntimeEvent = <AssetHubKusama as Chain>::RuntimeEvent; | ||
|
|
||
|
|
@@ -189,14 +206,23 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_from_pool() { | |
| )); | ||
| }); | ||
|
|
||
| let penpal_para_id = PenpalA::para_id(); | ||
| PenpalA::execute_with(|| { | ||
| // send xcm transact from `penpal` account which has only `ASSET_ID` tokens on | ||
| // `AssetHubKusama` | ||
| let call = AssetHubKusama::force_create_asset_call( | ||
| ASSET_ID + 1000, | ||
| penpal.clone(), | ||
| true, | ||
| let foreign_asset_at_asset_hub = Location::new( | ||
| 1, | ||
| [ | ||
| Parachain(penpal_para_id.into()), | ||
| PalletInstance(ASSETS_PALLET_ID), | ||
| GeneralIndex(ASSET_ID.into()), | ||
| ], | ||
| ); | ||
| let para_sovereign_account = AssetHubKusama::sovereign_account_id_of( | ||
| AssetHubKusama::sibling_location_of(penpal_para_id), | ||
| ); | ||
| let call = AssetHubKusama::create_foreign_asset_call( | ||
| foreign_asset_at_asset_hub.clone(), | ||
| ASSET_MIN_BALANCE, | ||
| para_sovereign_account, | ||
|
Comment on lines
+222
to
+225
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| ); | ||
|
|
||
| let penpal_root = <PenpalA as Chain>::RuntimeOrigin::root(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,27 +18,36 @@ use crate::*; | |
| /// Relay Chain should be able to execute `Transact` instructions in System Parachain | ||
| /// when `OriginKind::Superuser`. | ||
| #[test] | ||
| #[ignore] | ||
| fn send_transact_as_superuser_from_relay_to_asset_hub_works() { | ||
| AssetHubPolkadot::force_create_asset_from_relay_as_root( | ||
| ASSET_ID, | ||
| ASSET_MIN_BALANCE, | ||
| true, | ||
| AssetHubPolkadotSender::get(), | ||
| None, | ||
| ) | ||
| Polkadot::execute_with(|| { | ||
| // send xcm transact to AssetHubPolkadot from root account on Relay | ||
| let call = <AssetHubPolkadot as Chain>::RuntimeCall::System(frame_system::Call::< | ||
| <AssetHubPolkadot as Chain>::Runtime, | ||
| >::remark { | ||
| remark: vec![], | ||
| }) | ||
| .encode() | ||
| .into(); | ||
| let root = <Polkadot as Chain>::RuntimeOrigin::root(); | ||
| let asset_hub_location = Polkadot::child_location_of(AssetHubPolkadot::para_id()).into(); | ||
| let xcm = xcm_transact_unpaid_execution(call, OriginKind::Superuser); | ||
| Dmp::make_parachain_reachable(AssetHubPolkadot::para_id()); | ||
| assert_ok!(<Polkadot as PolkadotPallet>::XcmPallet::send( | ||
| root, | ||
| bx!(asset_hub_location), | ||
| bx!(xcm), | ||
| )); | ||
| Polkadot::assert_xcm_pallet_sent(); | ||
| }); | ||
| AssetHubPolkadot::execute_with(|| { | ||
| AssetHubPolkadot::assert_xcmp_queue_success(None); | ||
| }); | ||
| } | ||
|
|
||
| /// We tests two things here: | ||
| /// - Parachain should be able to send XCM paying its fee at Asset Hub using DOT | ||
| /// - Parachain should be able to create a new Foreign Asset at Asset Hub | ||
| #[test] | ||
| fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { | ||
| pub fn penpal_register_foreign_asset_on_asset_hub(asset_location_on_penpal: Location) { | ||
| let para_sovereign_account = AssetHubPolkadot::sovereign_account_id_of( | ||
| AssetHubPolkadot::sibling_location_of(PenpalA::para_id()), | ||
| ); | ||
| let asset_location_on_penpal = | ||
| Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())]); | ||
| let foreign_asset_at_asset_hub = Location::new(1, [Parachain(PenpalA::para_id().into())]) | ||
| .appended_with(asset_location_on_penpal) | ||
| .unwrap(); | ||
|
|
@@ -104,11 +113,20 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { | |
| }); | ||
| } | ||
|
|
||
| /// We tests two things here: | ||
| /// - Parachain should be able to send XCM paying its fee at Asset Hub using DOT | ||
| /// - Parachain should be able to create a new Foreign Asset at Asset Hub | ||
| #[test] | ||
| fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { | ||
| let asset_location_on_penpal = | ||
| Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())]); | ||
| penpal_register_foreign_asset_on_asset_hub(asset_location_on_penpal); | ||
| } | ||
|
|
||
| /// We tests two things here: | ||
| /// - Parachain should be able to send XCM paying its fee at Asset Hub using a pool | ||
| /// - Parachain should be able to create a new Asset at Asset Hub | ||
| #[test] | ||
| #[ignore] | ||
| fn send_xcm_from_para_to_asset_hub_paying_fee_from_pool() { | ||
| use frame_support::traits::fungible::Mutate; | ||
|
|
||
|
|
@@ -120,7 +138,6 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_from_pool() { | |
| let penpal = AssetHubPolkadot::sovereign_account_id_of(AssetHubPolkadot::sibling_location_of( | ||
| PenpalB::para_id(), | ||
| )); | ||
|
|
||
| AssetHubPolkadot::execute_with(|| { | ||
| type RuntimeEvent = <AssetHubPolkadot as Chain>::RuntimeEvent; | ||
|
|
||
|
|
@@ -196,14 +213,23 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_from_pool() { | |
| )); | ||
| }); | ||
|
|
||
| let penpal_para_id = PenpalB::para_id(); | ||
| PenpalB::execute_with(|| { | ||
| // send xcm transact from `penpal` account which as only `ASSET_ID` tokens on | ||
| // `AssetHubPolkadot` | ||
| let call = AssetHubPolkadot::force_create_asset_call( | ||
| ASSET_ID + 1000, | ||
| penpal.clone(), | ||
| true, | ||
| let foreign_asset_at_asset_hub = Location::new( | ||
| 1, | ||
| [ | ||
| Parachain(penpal_para_id.into()), | ||
| PalletInstance(ASSETS_PALLET_ID), | ||
| GeneralIndex(ASSET_ID.into()), | ||
| ], | ||
| ); | ||
| let para_sovereign_account = AssetHubPolkadot::sovereign_account_id_of( | ||
| AssetHubPolkadot::sibling_location_of(penpal_para_id), | ||
| ); | ||
| let call = AssetHubPolkadot::create_foreign_asset_call( | ||
| foreign_asset_at_asset_hub.clone(), | ||
| ASSET_MIN_BALANCE, | ||
| para_sovereign_account, | ||
|
Comment on lines
+229
to
+232
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
| ); | ||
|
|
||
| let penpal_root = <PenpalB as Chain>::RuntimeOrigin::root(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function
penpal_register_foreign_asset_on_asset_hubis nearly identical to the one added inintegration-tests/emulated/tests/assets/asset-hub-polkadot/src/tests/send.rs. Consider moving this logic to a shared helper to avoid code duplication.