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

Removed xcm::v2 for integration tests #360

Merged
merged 1 commit into from
Jun 26, 2024
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
2 changes: 1 addition & 1 deletion chain-spec-generator/src/system_parachains_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const BRIDGE_HUB_POLKADOT_ED: Balance = bridge_hub_polkadot_runtime::Existential

const BRIDGE_HUB_KUSAMA_ED: Balance = bridge_hub_kusama_runtime::ExistentialDeposit::get();

//const ENCOINTER_KUSAMA_ED: Balance = encointer_kusama_runtime::ExistentialDeposit::get();
const ENCOINTER_KUSAMA_ED: Balance = encointer_kusama_runtime::ExistentialDeposit::get();

const CORETIME_KUSAMA_ED: Balance = coretime_kusama_runtime::ExistentialDeposit::get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ fn send_xcm_from_kusama_relay_to_polkadot_asset_hub_should_fail_on_not_applicabl
#[test]
fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
// Initially set only default version on all runtimes
AssetHubKusama::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
BridgeHubKusama::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
BridgeHubPolkadot::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
AssetHubPolkadot::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
let newer_xcm_version = xcm::prelude::XCM_VERSION;
let older_xcm_version = newer_xcm_version - 1;

AssetHubKusama::force_default_xcm_version(Some(older_xcm_version));
BridgeHubKusama::force_default_xcm_version(Some(older_xcm_version));
BridgeHubPolkadot::force_default_xcm_version(Some(older_xcm_version));
AssetHubPolkadot::force_default_xcm_version(Some(older_xcm_version));

// prepare data
let destination = asset_hub_polkadot_location();
Expand All @@ -87,42 +90,12 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
);

// set destination version
AssetHubKusama::force_xcm_version(destination.clone(), xcm::v3::prelude::XCM_VERSION);

// TODO: remove this block, when removing `xcm:v2`
{
// send XCM from AssetHubKusama - fails - AssetHubKusama is set to the default/safe `2`
// version, which does not have the `ExportMessage` instruction. If the default `2` is
// changed to `3`, then this assert can go away"
assert_err!(
send_asset_from_asset_hub_kusama(destination.clone(), (native_token.clone(), amount)),
DispatchError::Module(sp_runtime::ModuleError {
index: 31,
error: [1, 0, 0, 0],
message: Some("SendFailure")
})
);

// set exact version for BridgeHubPolkadot to `2` without `ExportMessage` instruction
AssetHubKusama::force_xcm_version(
ParentThen(Parachain(BridgeHubKusama::para_id().into()).into()).into(),
xcm::v2::prelude::XCM_VERSION,
);
// send XCM from AssetHubKusama - fails - `ExportMessage` is not in `2`
assert_err!(
send_asset_from_asset_hub_kusama(destination.clone(), (native_token.clone(), amount)),
DispatchError::Module(sp_runtime::ModuleError {
index: 31,
error: [1, 0, 0, 0],
message: Some("SendFailure")
})
);
}
AssetHubKusama::force_xcm_version(destination.clone(), newer_xcm_version);

// set version with `ExportMessage` for BridgeHubKusama
AssetHubKusama::force_xcm_version(
ParentThen(Parachain(BridgeHubKusama::para_id().into()).into()).into(),
xcm::v3::prelude::XCM_VERSION,
newer_xcm_version,
);
// send XCM from AssetHubKusama - ok
assert_ok!(send_asset_from_asset_hub_kusama(
Expand All @@ -134,14 +107,11 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
assert_bridge_hub_kusama_message_accepted(false);

// set version for remote BridgeHub on BridgeHubKusama
BridgeHubKusama::force_xcm_version(
bridge_hub_polkadot_location(),
xcm::v3::prelude::XCM_VERSION,
);
BridgeHubKusama::force_xcm_version(bridge_hub_polkadot_location(), newer_xcm_version);
// set version for AssetHubPolkadot on BridgeHubPolkadot
BridgeHubPolkadot::force_xcm_version(
ParentThen(Parachain(AssetHubPolkadot::para_id().into()).into()).into(),
xcm::v3::prelude::XCM_VERSION,
newer_xcm_version,
);

// send XCM from AssetHubKusama - ok
Expand All @@ -164,20 +134,4 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
]
);
});

// TODO: remove this block, when removing `xcm:v2`
{
// set `2` version for remote BridgeHub on BridgeHubKusama, which does not have
// `UniversalOrigin` and `DescendOrigin`
BridgeHubKusama::force_xcm_version(
bridge_hub_polkadot_location(),
xcm::v2::prelude::XCM_VERSION,
);

// send XCM from AssetHubKusama - ok
assert_ok!(send_asset_from_asset_hub_kusama(destination, (native_token, amount)));
// message is not accepted on the local BridgeHub (`DestinationUnsupported`) because we
// cannot add `UniversalOrigin` and `DescendOrigin`
assert_bridge_hub_kusama_message_accepted(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,13 @@ fn send_xcm_from_polkadot_relay_to_kusama_asset_hub_should_fail_on_not_applicabl
#[test]
fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
// Initially set only default version on all runtimes
AssetHubKusama::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
BridgeHubKusama::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
BridgeHubPolkadot::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
AssetHubPolkadot::force_default_xcm_version(Some(xcm::v2::prelude::XCM_VERSION));
let newer_xcm_version = xcm::prelude::XCM_VERSION;
let older_xcm_version = newer_xcm_version - 1;

AssetHubKusama::force_default_xcm_version(Some(older_xcm_version));
BridgeHubKusama::force_default_xcm_version(Some(older_xcm_version));
BridgeHubPolkadot::force_default_xcm_version(Some(older_xcm_version));
AssetHubPolkadot::force_default_xcm_version(Some(older_xcm_version));

// prepare data
let destination = asset_hub_kusama_location();
Expand All @@ -87,42 +90,12 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
);

// set destination version
AssetHubPolkadot::force_xcm_version(destination.clone(), xcm::v3::prelude::XCM_VERSION);

// TODO: remove this block, when removing `xcm:v2`
{
// send XCM from AssetHubKusama - fails - AssetHubKusama is set to the default/safe `2`
// version, which does not have the `ExportMessage` instruction. If the default `2` is
// changed to `3`, then this assert can go away"
assert_err!(
send_asset_from_asset_hub_polkadot(destination.clone(), (native_token.clone(), amount)),
DispatchError::Module(sp_runtime::ModuleError {
index: 31,
error: [1, 0, 0, 0],
message: Some("SendFailure")
})
);

// set exact version for BridgeHubPolkadot to `2` without `ExportMessage` instruction
AssetHubPolkadot::force_xcm_version(
ParentThen(Parachain(BridgeHubPolkadot::para_id().into()).into()).into(),
xcm::v2::prelude::XCM_VERSION,
);
// send XCM from AssetHubPolkadot - fails - `ExportMessage` is not in `2`
assert_err!(
send_asset_from_asset_hub_polkadot(destination.clone(), (native_token.clone(), amount)),
DispatchError::Module(sp_runtime::ModuleError {
index: 31,
error: [1, 0, 0, 0],
message: Some("SendFailure")
})
);
}
AssetHubPolkadot::force_xcm_version(destination.clone(), newer_xcm_version);

// set version with `ExportMessage` for BridgeHubPolkadot
AssetHubPolkadot::force_xcm_version(
ParentThen(Parachain(BridgeHubPolkadot::para_id().into()).into()).into(),
xcm::v3::prelude::XCM_VERSION,
newer_xcm_version,
);
// send XCM from AssetHubPolkadot - ok
assert_ok!(send_asset_from_asset_hub_polkadot(
Expand All @@ -134,14 +107,11 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
assert_bridge_hub_polkadot_message_accepted(false);

// set version for remote BridgeHub on BridgeHubPolkadot
BridgeHubPolkadot::force_xcm_version(
bridge_hub_kusama_location(),
xcm::v3::prelude::XCM_VERSION,
);
BridgeHubPolkadot::force_xcm_version(bridge_hub_kusama_location(), newer_xcm_version);
// set version for AssetHubKusama on BridgeHubKusama
BridgeHubKusama::force_xcm_version(
ParentThen(Parachain(AssetHubKusama::para_id().into()).into()).into(),
xcm::v3::prelude::XCM_VERSION,
newer_xcm_version,
);

// send XCM from AssetHubPolkadot - ok
Expand All @@ -164,20 +134,4 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
]
);
});

// TODO: remove this block, when removing `xcm:v2`
{
// set `2` version for remote BridgeHub on BridgeHubKusama, which does not have
// `UniversalOrigin` and `DescendOrigin`
BridgeHubPolkadot::force_xcm_version(
bridge_hub_kusama_location(),
xcm::v2::prelude::XCM_VERSION,
);

// send XCM from AssetHubPolkadot - ok
assert_ok!(send_asset_from_asset_hub_polkadot(destination, (native_token, amount)));
// message is not accepted on the local BridgeHub (`DestinationUnsupported`) because we
// cannot add `UniversalOrigin` and `DescendOrigin`
assert_bridge_hub_polkadot_message_accepted(false);
}
}
Loading