Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Check channel in outbound queue #73

Merged
merged 3 commits into from
Dec 19, 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 @@ -22,6 +22,7 @@ use emulated_integration_tests_common::{
};
use parachains_common::Balance;

pub const ASSETHUB_PARA_ID: u32 = 1000;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use AssetHubRococo::para_id() here?

Also perhaps the BridgeHub PARA_ID is also available in some constant provided by the bridges team

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would require adding more dependencies. If this is out of date, the tests will fail. So I think it's simpler and protected against change.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok cool

pub const PARA_ID: u32 = 1013;
pub const ED: Balance = parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;

Expand Down Expand Up @@ -64,6 +65,11 @@ pub fn genesis() -> Storage {
owner: Some(get_account_id_from_seed::<sr25519::Public>(accounts::BOB)),
..Default::default()
},
ethereum_system: bridge_hub_rococo_runtime::EthereumSystemConfig {
para_id: PARA_ID.into(),
asset_hub_para_id: ASSETHUB_PARA_ID.into(),
..Default::default()
},
..Default::default()
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use sp_core::H256;

const INITIAL_FUND: u128 = 5_000_000_000 * ROCOCO_ED;
const CHAIN_ID: u64 = 11155111;
const ASSETHUB_PARA_ID: u32 = 1000;
const TREASURY_ACCOUNT: [u8; 32] =
hex!("6d6f646c70792f74727372790000000000000000000000000000000000000000");
const WETH: [u8; 20] = hex!("87d1f7fdfEe7f651FaBc8bFCB6E086C278b77A7d");
Expand Down Expand Up @@ -192,7 +191,7 @@ fn register_token() {
BridgeHubRococo::fund_accounts(vec![(
BridgeHubRococo::sovereign_account_id_of(MultiLocation {
parents: 1,
interior: X1(Parachain(ASSETHUB_PARA_ID)),
interior: X1(Parachain(AssetHubRococo::para_id().into())),
}),
INITIAL_FUND,
)]);
Expand All @@ -208,7 +207,7 @@ fn register_token() {
command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE },
});
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, ASSETHUB_PARA_ID.into()).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();

assert_expected_events!(
BridgeHubRococo,
Expand All @@ -234,7 +233,7 @@ fn register_token() {
fn send_token_to_penpal() {
let asset_hub_sovereign = BridgeHubRococo::sovereign_account_id_of(MultiLocation {
parents: 1,
interior: X1(Parachain(ASSETHUB_PARA_ID)),
interior: X1(Parachain(AssetHubRococo::para_id().into())),
});
BridgeHubRococo::fund_accounts(vec![(asset_hub_sovereign.clone(), INITIAL_FUND)]);

Expand Down Expand Up @@ -300,7 +299,7 @@ fn send_token_to_penpal() {
},
});
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, ASSETHUB_PARA_ID.into()).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();

assert_expected_events!(
BridgeHubRococo,
Expand Down Expand Up @@ -339,7 +338,7 @@ fn send_token() {
BridgeHubRococo::fund_accounts(vec![(
BridgeHubRococo::sovereign_account_id_of(MultiLocation {
parents: 1,
interior: X1(Parachain(ASSETHUB_PARA_ID)),
interior: X1(Parachain(AssetHubRococo::para_id().into())),
}),
INITIAL_FUND,
)]);
Expand All @@ -358,7 +357,7 @@ fn send_token() {
command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE },
});
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, ASSETHUB_PARA_ID.into()).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();
let message = VersionedMessage::V1(MessageV1 {
chain_id: CHAIN_ID,
command: Command::SendToken {
Expand All @@ -369,7 +368,7 @@ fn send_token() {
},
});
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, ASSETHUB_PARA_ID.into()).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();

assert_expected_events!(
BridgeHubRococo,
Expand All @@ -395,7 +394,7 @@ fn send_token() {
fn reserve_transfer_token() {
let assethub_sovereign = BridgeHubRococo::sovereign_account_id_of(MultiLocation {
parents: 1,
interior: X1(Parachain(ASSETHUB_PARA_ID)),
interior: X1(Parachain(AssetHubRococo::para_id().into())),
});

AssetHubRococo::force_default_xcm_version(Some(XCM_VERSION));
Expand All @@ -418,12 +417,13 @@ fn reserve_transfer_token() {
type RuntimeEvent = <BridgeHubRococo as Chain>::RuntimeEvent;
type EthereumInboundQueue =
<BridgeHubRococo as BridgeHubRococoPallet>::EthereumInboundQueue;

let message = VersionedMessage::V1(MessageV1 {
chain_id: CHAIN_ID,
command: Command::RegisterToken { token: WETH.into(), fee: XCM_FEE },
});
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, ASSETHUB_PARA_ID.into()).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();
let message = VersionedMessage::V1(MessageV1 {
chain_id: CHAIN_ID,
command: Command::SendToken {
Expand All @@ -434,7 +434,7 @@ fn reserve_transfer_token() {
},
});
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, ASSETHUB_PARA_ID.into()).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, AssetHubRococo::para_id().into()).unwrap();

assert_expected_events!(
BridgeHubRococo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ impl snowbridge_outbound_queue::Config for Runtime {
type WeightToFee = WeightToFee;
type WeightInfo = weights::snowbridge_outbound_queue::WeightInfo<Runtime>;
type PricingParameters = EthereumSystem;
type Channels = EthereumSystem;
}

#[cfg(not(feature = "beacon-spec-mainnet"))]
Expand Down
Loading