Skip to content

Commit

Permalink
Merge pull request #8 from bkontur/bko-snowbridge-itests
Browse files Browse the repository at this point in the history
Fix `send_weth_asset_from_asset_hub_to_ethereum` test asserts
  • Loading branch information
vgeddes authored Mar 25, 2024
2 parents 71bb43a + e674737 commit 3671100
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
);
});

// check treasury account balance on BH before
let treasury_account_before = BridgeHubKusama::execute_with(|| {
<<BridgeHubKusama as BridgeHubKusamaPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into())
});

AssetHubKusama::execute_with(|| {
type RuntimeEvent = <AssetHubKusama as Chain>::RuntimeEvent;
type RuntimeOrigin = <AssetHubKusama as Chain>::RuntimeOrigin;
Expand Down Expand Up @@ -566,13 +571,18 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
RuntimeEvent::EthereumOutboundQueue(snowbridge_pallet_outbound_queue::Event::MessageQueued {..}) => {},
]
);

// check treasury account balance on BH after (should receive some fees)
let treasury_account_after = <<BridgeHubKusama as BridgeHubKusamaPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into());
let local_fee = treasury_account_after - treasury_account_before;

let events = BridgeHubKusama::events();
// Check that the local fee was credited to the Snowbridge sovereign account
assert!(
events.iter().any(|event| matches!(
event,
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount })
if *who == TREASURY_ACCOUNT.into() && *amount == 169033333
if *who == TREASURY_ACCOUNT.into() && *amount == local_fee
)),
"Snowbridge sovereign takes local fee."
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
);
});

// check treasury account balance on BH before
let treasury_account_before = BridgeHubPolkadot::execute_with(|| {
<<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into())
});

AssetHubPolkadot::execute_with(|| {
type RuntimeEvent = <AssetHubPolkadot as Chain>::RuntimeEvent;
type RuntimeOrigin = <AssetHubPolkadot as Chain>::RuntimeOrigin;
Expand Down Expand Up @@ -570,13 +575,18 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
RuntimeEvent::EthereumOutboundQueue(snowbridge_pallet_outbound_queue::Event::MessageQueued {..}) => {},
]
);

// check treasury account balance on BH after (should receive some fees)
let treasury_account_after = <<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into());
let local_fee = treasury_account_after - treasury_account_before;

let events = BridgeHubPolkadot::events();
// Check that the local fee was credited to the Snowbridge sovereign account
assert!(
events.iter().any(|event| matches!(
event,
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount })
if *who == TREASURY_ACCOUNT.into() && *amount == 50710000
if *who == TREASURY_ACCOUNT.into() && *amount == local_fee
)),
"Snowbridge sovereign takes local fee."
);
Expand Down

0 comments on commit 3671100

Please sign in to comment.