Skip to content
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

[xcm-emulator] Unignore cumulus integration tests #1247

Merged
merged 19 commits into from
Sep 1, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,19 @@ asset-hub-kusama-runtime = { path = "../../../../runtimes/assets/asset-hub-kusam
# Local
xcm-emulator = { path = "../../../../../xcm/xcm-emulator", default-features = false}
integration-tests-common = { path = "../../common", default-features = false}

[features]
runtime-benchmarks = [
"asset-hub-kusama-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"integration-tests-common/runtime-benchmarks",
"pallet-asset-conversion/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub use integration_tests_common::{
xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
AssetHubKusama, AssetHubKusamaPallet, AssetHubKusamaReceiver, AssetHubKusamaSender, Kusama,
KusamaPallet, KusamaReceiver, KusamaSender, PenpalKusamaA, PenpalKusamaAPallet,
PenpalKusamaAReceiver, PenpalKusamaASender,
PenpalKusamaAReceiver, PenpalKusamaASender, PenpalKusamaB, PenpalKusamaBPallet,
};
pub use parachains_common::{AccountId, Balance};
pub use xcm::{
Expand Down Expand Up @@ -87,4 +87,5 @@ pub fn system_para_test_args(
}

#[cfg(test)]
#[cfg(not(feature = "runtime-benchmarks"))]
mod tests;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const MAX_MESSAGE_SIZE: u32 = 8192;

/// Opening HRMP channels between Parachains should work
#[test]
#[cfg(feature = "FIXME-IGNORED")] // <https://github.com/paritytech/cumulus/issues/3027>
fn open_hrmp_channel_between_paras_works() {
// Parchain A init values
let para_a_id = PenpalKusamaA::para_id();
Expand Down Expand Up @@ -110,6 +109,8 @@ fn open_hrmp_channel_between_paras_works() {
PenpalKusamaB::assert_xcm_pallet_sent();
});

PenpalKusamaB::execute_with(|| {});

Kusama::execute_with(|| {
type RuntimeEvent = <Kusama as Chain>::RuntimeEvent;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,72 +126,73 @@ fn send_transact_native_from_system_para_to_relay_fails() {
/// Parachain should be able to send XCM paying its fee with sufficient asset
/// in the System Parachain
#[test]
#[ignore]
fn send_xcm_from_para_to_system_para_paying_fee_with_assets_works() {
// let para_sovereign_account = AssetHubKusama::sovereign_account_id_of(
// AssetHubKusama::sibling_location_of(PenpalKusamaA::para_id()),
// );

// // Force create and mint assets for Parachain's sovereign account
// AssetHubKusama::force_create_and_mint_asset(
// ASSET_ID,
// ASSET_MIN_BALANCE,
// true,
// para_sovereign_account.clone(),
// ASSET_MIN_BALANCE * 1000000000,
// );

// // We just need a call that can pass the `SafeCallFilter`
// // Call values are not relevant
// let call = AssetHubKusama::force_create_asset_call(
// ASSET_ID,
// para_sovereign_account.clone(),
// true,
// ASSET_MIN_BALANCE,
// );

// let origin_kind = OriginKind::SovereignAccount;
// let fee_amount = ASSET_MIN_BALANCE * 1000000;
// let native_asset =
// (X2(PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())), fee_amount).into();

// let root_origin = <PenpalKusamaA as Chain>::RuntimeOrigin::root();
// let system_para_destination =
// PenpalKusamaA::sibling_location_of(AssetHubKusama::para_id()).into();
// let xcm = xcm_transact_paid_execution(
// call,
// origin_kind,
// native_asset,
// para_sovereign_account.clone(),
// );

// PenpalKusamaA::execute_with(|| {
// assert_ok!(<PenpalKusamaA as PenpalKusamaAPallet>::PolkadotXcm::send(
// root_origin,
// bx!(system_para_destination),
// bx!(xcm),
// ));

// PenpalKusamaA::assert_xcm_pallet_sent();
// });

// AssetHubKusama::execute_with(|| {
// type RuntimeEvent = <AssetHubKusama as Chain>::RuntimeEvent;

// AssetHubKusama::assert_xcmp_queue_success(Some(Weight::from_parts(2_176_414_000, 203_593)));

// assert_expected_events!(
// AssetHubKusama,
// vec![
// RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => {
// asset_id: *asset_id == ASSET_ID,
// owner: *owner == para_sovereign_account,
// balance: *balance == fee_amount,
// },
// RuntimeEvent::Assets(pallet_assets::Event::Issued { asset_id, .. }) => {
// asset_id: *asset_id == ASSET_ID,
// },
// ]
// );
// });
let para_sovereign_account = AssetHubKusama::sovereign_account_id_of(
AssetHubKusama::sibling_location_of(PenpalKusamaA::para_id()),
);

// Force create and mint assets for Parachain's sovereign account
AssetHubKusama::force_create_and_mint_asset(
ASSET_ID,
ASSET_MIN_BALANCE,
true,
para_sovereign_account.clone(),
ASSET_MIN_BALANCE * 1000000000,
);

// We just need a call that can pass the `SafeCallFilter`
// Call values are not relevant
let call = AssetHubKusama::force_create_asset_call(
ASSET_ID,
para_sovereign_account.clone(),
true,
ASSET_MIN_BALANCE,
);

let origin_kind = OriginKind::SovereignAccount;
let fee_amount = ASSET_MIN_BALANCE * 1000000;
let native_asset =
(X2(PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())), fee_amount).into();

let root_origin = <PenpalKusamaA as Chain>::RuntimeOrigin::root();
let system_para_destination =
PenpalKusamaA::sibling_location_of(AssetHubKusama::para_id()).into();
let xcm = xcm_transact_paid_execution(
call,
origin_kind,
native_asset,
para_sovereign_account.clone(),
);

PenpalKusamaA::execute_with(|| {
assert_ok!(<PenpalKusamaA as PenpalKusamaAPallet>::PolkadotXcm::send(
root_origin,
bx!(system_para_destination),
bx!(xcm),
));

PenpalKusamaA::assert_xcm_pallet_sent();
});

PenpalKusamaA::execute_with(|| {});

AssetHubKusama::execute_with(|| {
type RuntimeEvent = <AssetHubKusama as Chain>::RuntimeEvent;

AssetHubKusama::assert_xcmp_queue_success(Some(Weight::from_parts(2_176_414_000, 203_593)));

assert_expected_events!(
AssetHubKusama,
vec![
RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => {
asset_id: *asset_id == ASSET_ID,
owner: *owner == para_sovereign_account,
balance: *balance == fee_amount,
},
RuntimeEvent::Assets(pallet_assets::Event::Issued { asset_id, .. }) => {
asset_id: *asset_id == ASSET_ID,
},
]
);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ fn limited_teleport_native_assets_from_relay_to_system_para_works() {
/// Limited Teleport of native asset from System Parachain to Relay Chain
/// should work when there is enough balance in Relay Chain's `CheckAccount`
#[test]
#[cfg(feature = "FIXME-IGNORED")] // <https://github.com/paritytech/cumulus/issues/3027>
fn limited_teleport_native_assets_back_from_system_para_to_relay_works() {
// Dependency - Relay Chain's `CheckAccount` should have enough balance
limited_teleport_native_assets_from_relay_to_system_para_works();
Expand Down Expand Up @@ -226,7 +225,6 @@ fn limited_teleport_native_assets_back_from_system_para_to_relay_works() {
/// Limited Teleport of native asset from System Parachain to Relay Chain
/// should't work when there is not enough balance in Relay Chain's `CheckAccount`
#[test]
#[cfg(feature = "FIXME-IGNORED")] // <https://github.com/paritytech/cumulus/issues/3027>
fn limited_teleport_native_assets_from_system_para_to_relay_fails() {
// Init values for Relay Chain
let amount_to_send: Balance = ASSET_HUB_KUSAMA_ED * 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,19 @@ asset-hub-kusama-runtime = { path = "../../../../runtimes/assets/asset-hub-kusam
# Local
xcm-emulator = { path = "../../../../../xcm/xcm-emulator", default-features = false}
integration-tests-common = { path = "../../common", default-features = false}

[features]
runtime-benchmarks = [
"asset-hub-kusama-runtime/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"integration-tests-common/runtime-benchmarks",
"pallet-asset-conversion/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
]
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ pub use integration_tests_common::{
},
xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
AssetHubPolkadot, AssetHubPolkadotPallet, AssetHubPolkadotReceiver, AssetHubPolkadotSender,
PenpalPolkadotA, PenpalPolkadotAReceiver, Polkadot, PolkadotPallet, PolkadotReceiver,
PolkadotSender,
PenpalPolkadotA, PenpalPolkadotAPallet, PenpalPolkadotAReceiver, PenpalPolkadotB,
PenpalPolkadotBPallet, Polkadot, PolkadotPallet, PolkadotReceiver, PolkadotSender,
};
pub use parachains_common::{AccountId, Balance};
pub use xcm::{
Expand Down Expand Up @@ -87,4 +87,5 @@ pub fn system_para_test_args(
}

#[cfg(test)]
#[cfg(not(feature = "runtime-benchmarks"))]
mod tests;
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const MAX_MESSAGE_SIZE: u32 = 8192;

/// Opening HRMP channels between Parachains should work
#[test]
#[cfg(feature = "FIXME-IGNORED")] // <https://github.com/paritytech/cumulus/issues/3027>
fn open_hrmp_channel_between_paras_works() {
// Parchain A init values
let para_a_id = PenpalPolkadotA::para_id();
Expand Down Expand Up @@ -110,6 +109,8 @@ fn open_hrmp_channel_between_paras_works() {
PenpalPolkadotB::assert_xcm_pallet_sent();
});

PenpalPolkadotB::execute_with(|| {});

Polkadot::execute_with(|| {
type RuntimeEvent = <Polkadot as Chain>::RuntimeEvent;

Expand Down
Loading