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

Commit

Permalink
Fix breaking test
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Nov 27, 2023
1 parent c0995ea commit b8bc017
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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
Expand Up @@ -16,3 +16,4 @@ asset-hub-rococo-emulated-chain = { path = "../../chains/parachains/assets/asset
asset-hub-westend-emulated-chain = { path = "../../chains/parachains/assets/asset-hub-westend" }
bridge-hub-rococo-emulated-chain = { path = "../../chains/parachains/bridges/bridge-hub-rococo" }
bridge-hub-westend-emulated-chain = { path = "../../chains/parachains/bridges/bridge-hub-westend" }
penpal-emulated-chain = { path = "../../chains/parachains/testing/penpal" }
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use asset_hub_rococo_emulated_chain::AssetHubRococo;
use asset_hub_westend_emulated_chain::AssetHubWestend;
use bridge_hub_rococo_emulated_chain::BridgeHubRococo;
use bridge_hub_westend_emulated_chain::BridgeHubWestend;
use penpal_emulated_chain::PenpalA;
use rococo_emulated_chain::Rococo;
use westend_emulated_chain::Westend;

Expand All @@ -43,6 +44,7 @@ decl_test_networks! {
parachains = vec![
AssetHubRococo,
BridgeHubRococo,
PenpalA,
],
bridge = RococoWestendMockBridge

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,36 @@ fn send_token_to_penpal() {
});
BridgeHubRococo::fund_accounts(vec![(asset_hub_sovereign.clone(), INITIAL_FUND)]);

// Fund ethereum sovereign in asset hub
AssetHubRococo::fund_accounts(vec![(AssetHubRococoReceiver::get(), INITIAL_FUND)]);

PenpalA::fund_accounts(vec![
(PenpalAReceiver::get(), INITIAL_FUND),
(PenpalASender::get(), INITIAL_FUND),
]);

let weth_asset_id: MultiLocation =
let weth_asset_location: MultiLocation =
(Parent, Parent, Ethereum { chain_id: 15 }, AccountKey20 { network: None, key: WETH })
.into();
let weth_asset_id = weth_asset_location.into();

let origin_location =
MultiLocation { parents: 2, interior: weth_asset_location.interior.split_last().0 };

// Fund ethereum sovereign in asset hub
let ethereum_sovereign: AccountId =
hex!("da4d66c3651dc151264eee5460493210338e41a7bbfca91a520e438daf180bf5").into();
AssetHubRococo::fund_accounts(vec![(ethereum_sovereign.clone(), INITIAL_FUND)]);
// Create asset on assethub.
AssetHubRococo::execute_with(|| {
assert_ok!(<AssetHubRococo as AssetHubRococoPallet>::ForeignAssets::create(
pallet_xcm::Origin::Xcm(origin_location).into(),
weth_asset_id,
asset_hub_sovereign.clone().into(),
1000,
));

assert!(<AssetHubRococo as AssetHubRococoPallet>::ForeignAssets::asset_exists(
weth_asset_id
));
});

// Create asset on penpal.
PenpalA::execute_with(|| {
Expand All @@ -253,7 +272,7 @@ fn send_token_to_penpal() {
1000,
));

//assert!(<PenpalA as PenpalAPallet>::Assets::asset_exists(weth_asset_id));
assert!(<PenpalA as PenpalAPallet>::ForeignAssets::asset_exists(weth_asset_id));
});

let message_id_: H256 = [1; 32].into();
Expand All @@ -262,12 +281,6 @@ fn send_token_to_penpal() {
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() },
});
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, ASSETHUB_PARA_ID.into()).unwrap();
let message = VersionedMessage::V1(MessageV1 {
chain_id: CHAIN_ID,
command: Command::SendToken {
Expand Down

0 comments on commit b8bc017

Please sign in to comment.