Skip to content

Commit 7710483

Browse files
Bridges: emulated tests small nits/improvements (#7322)
This PR includes minor fixes identified during work on the larger PR: [https://github.com/paritytech/polkadot-sdk/issues/6906](https://github.com/paritytech/polkadot-sdk/issues/6906). Specifically, this PR removes the use of `open_bridge_between_asset_hub_rococo_and_asset_hub_westend`, which is no longer relevant for BridgeHubs, as bridges are now created with genesis settings. This function was used in the generic `test_dry_run_transfer_across_pk_bridge` macro, which could cause compilation issues when used in other contexts (e.g. fellows repo). --------- Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a2c63e8 commit 7710483

File tree

8 files changed

+9
-100
lines changed

8 files changed

+9
-100
lines changed

cumulus/parachains/integration-tests/emulated/common/src/macros.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,8 @@ macro_rules! test_dry_run_transfer_across_pk_bridge {
644644
let transfer_amount = 10_000_000_000_000u128;
645645
let initial_balance = transfer_amount * 10;
646646

647-
// Bridge setup.
647+
// AssetHub setup.
648648
$sender_asset_hub::force_xcm_version($destination, XCM_VERSION);
649-
open_bridge_between_asset_hub_rococo_and_asset_hub_westend();
650649

651650
<$sender_asset_hub as TestExt>::execute_with(|| {
652651
type Runtime = <$sender_asset_hub as Chain>::Runtime;

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/asset_transfers.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ fn send_assets_over_bridge<F: FnOnce()>(send_fn: F) {
2525
AssetHubRococo::force_xcm_version(asset_hub_westend_location(), XCM_VERSION);
2626
BridgeHubRococo::force_xcm_version(bridge_hub_westend_location(), XCM_VERSION);
2727

28-
// open bridge
29-
open_bridge_between_asset_hub_rococo_and_asset_hub_westend();
30-
3128
// send message over bridge
3229
send_fn();
3330

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/mod.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ pub(crate) fn bridged_roc_at_ah_westend() -> Location {
5151
}
5252

5353
// WND and wWND
54-
pub(crate) fn wnd_at_ah_westend() -> Location {
55-
Parent.into()
56-
}
5754
pub(crate) fn bridged_wnd_at_ah_rococo() -> Location {
5855
Location::new(2, [GlobalConsensus(ByGenesis(WESTEND_GENESIS_HASH))])
5956
}
@@ -240,43 +237,3 @@ pub(crate) fn assert_bridge_hub_westend_message_received() {
240237
);
241238
})
242239
}
243-
244-
pub(crate) fn open_bridge_between_asset_hub_rococo_and_asset_hub_westend() {
245-
use testnet_parachains_constants::{
246-
rococo::currency::UNITS as ROC, westend::currency::UNITS as WND,
247-
};
248-
249-
// open AHR -> AHW
250-
BridgeHubRococo::fund_para_sovereign(AssetHubRococo::para_id(), ROC * 5);
251-
AssetHubRococo::open_bridge(
252-
AssetHubRococo::sibling_location_of(BridgeHubRococo::para_id()),
253-
[
254-
GlobalConsensus(ByGenesis(WESTEND_GENESIS_HASH)),
255-
Parachain(AssetHubWestend::para_id().into()),
256-
]
257-
.into(),
258-
Some((
259-
(roc_at_ah_rococo(), ROC * 1).into(),
260-
BridgeHubRococo::sovereign_account_id_of(BridgeHubRococo::sibling_location_of(
261-
AssetHubRococo::para_id(),
262-
)),
263-
)),
264-
);
265-
266-
// open AHW -> AHR
267-
BridgeHubWestend::fund_para_sovereign(AssetHubWestend::para_id(), WND * 5);
268-
AssetHubWestend::open_bridge(
269-
AssetHubWestend::sibling_location_of(BridgeHubWestend::para_id()),
270-
[
271-
GlobalConsensus(ByGenesis(ROCOCO_GENESIS_HASH)),
272-
Parachain(AssetHubRococo::para_id().into()),
273-
]
274-
.into(),
275-
Some((
276-
(wnd_at_ah_westend(), WND * 1).into(),
277-
BridgeHubWestend::sovereign_account_id_of(BridgeHubWestend::sibling_location_of(
278-
AssetHubWestend::para_id(),
279-
)),
280-
)),
281-
);
282-
}

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/send_xcm.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
7474
// fund sender
7575
AssetHubRococo::fund_accounts(vec![(AssetHubRococoSender::get().into(), amount * 10)]);
7676

77-
// open bridge
78-
open_bridge_between_asset_hub_rococo_and_asset_hub_westend();
79-
8077
// Initially set only default version on all runtimes
8178
let newer_xcm_version = xcm::prelude::XCM_VERSION;
8279
let older_xcm_version = newer_xcm_version - 1;

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/asset_transfers.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ fn send_assets_over_bridge<F: FnOnce()>(send_fn: F) {
2626
AssetHubWestend::force_xcm_version(asset_hub_rococo_location(), XCM_VERSION);
2727
BridgeHubWestend::force_xcm_version(bridge_hub_rococo_location(), XCM_VERSION);
2828

29-
// open bridge
30-
open_bridge_between_asset_hub_rococo_and_asset_hub_westend();
31-
3229
// send message over bridge
3330
send_fn();
3431

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/mod.rs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ pub(crate) fn bridged_wnd_at_ah_rococo() -> Location {
5252
}
5353

5454
// ROC and wROC
55-
pub(crate) fn roc_at_ah_rococo() -> Location {
56-
Parent.into()
57-
}
5855
pub(crate) fn bridged_roc_at_ah_westend() -> Location {
5956
Location::new(2, [GlobalConsensus(ByGenesis(ROCOCO_GENESIS_HASH))])
6057
}
@@ -250,43 +247,3 @@ pub(crate) fn assert_bridge_hub_rococo_message_received() {
250247
);
251248
})
252249
}
253-
254-
pub(crate) fn open_bridge_between_asset_hub_rococo_and_asset_hub_westend() {
255-
use testnet_parachains_constants::{
256-
rococo::currency::UNITS as ROC, westend::currency::UNITS as WND,
257-
};
258-
259-
// open AHR -> AHW
260-
BridgeHubRococo::fund_para_sovereign(AssetHubRococo::para_id(), ROC * 5);
261-
AssetHubRococo::open_bridge(
262-
AssetHubRococo::sibling_location_of(BridgeHubRococo::para_id()),
263-
[
264-
GlobalConsensus(ByGenesis(WESTEND_GENESIS_HASH)),
265-
Parachain(AssetHubWestend::para_id().into()),
266-
]
267-
.into(),
268-
Some((
269-
(roc_at_ah_rococo(), ROC * 1).into(),
270-
BridgeHubRococo::sovereign_account_id_of(BridgeHubRococo::sibling_location_of(
271-
AssetHubRococo::para_id(),
272-
)),
273-
)),
274-
);
275-
276-
// open AHW -> AHR
277-
BridgeHubWestend::fund_para_sovereign(AssetHubWestend::para_id(), WND * 5);
278-
AssetHubWestend::open_bridge(
279-
AssetHubWestend::sibling_location_of(BridgeHubWestend::para_id()),
280-
[
281-
GlobalConsensus(ByGenesis(ROCOCO_GENESIS_HASH)),
282-
Parachain(AssetHubRococo::para_id().into()),
283-
]
284-
.into(),
285-
Some((
286-
(wnd_at_ah_westend(), WND * 1).into(),
287-
BridgeHubWestend::sovereign_account_id_of(BridgeHubWestend::sibling_location_of(
288-
AssetHubWestend::para_id(),
289-
)),
290-
)),
291-
);
292-
}

cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/send_xcm.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ fn send_xcm_through_opened_lane_with_different_xcm_version_on_hops_works() {
7474
// fund sender
7575
AssetHubWestend::fund_accounts(vec![(AssetHubWestendSender::get().into(), amount * 10)]);
7676

77-
// open bridge
78-
open_bridge_between_asset_hub_rococo_and_asset_hub_westend();
79-
8077
// Initially set only default version on all runtimes
8178
let newer_xcm_version = xcm::prelude::XCM_VERSION;
8279
let older_xcm_version = newer_xcm_version - 1;

prdoc/pr_7322.prdoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
title: 'Bridges: emulated tests small nits/improvements'
2+
doc:
3+
- audience: Runtime Dev
4+
description: |-
5+
This PR removes the use of `open_bridge_between_asset_hub_rococo_and_asset_hub_westend`. This function was used in the generic `test_dry_run_transfer_across_pk_bridge` macro, which could cause compilation issues when used in other contexts (e.g. fellows repo).
6+
crates:
7+
- name: emulated-integration-tests-common
8+
bump: patch

0 commit comments

Comments
 (0)