From 9b8117b0b76dffdba3641286d7b8dee7e205ab86 Mon Sep 17 00:00:00 2001 From: claravanstaden Date: Mon, 2 Dec 2024 21:54:33 +0200 Subject: [PATCH] cleanup test --- .../src/tests/snowbridge_v2.rs | 23 ++++++------------- .../src/bridge_to_ethereum_config.rs | 2 +- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2.rs index 18b48b3dbc7e..aef3afb2350c 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2.rs @@ -18,7 +18,7 @@ use bridge_hub_westend_runtime::{ EthereumInboundQueueV2, }; use codec::Encode; -use frame_support::{traits::fungibles::Mutate, weights::WeightToFee}; +use frame_support::{traits::fungibles::Mutate}; use hex_literal::hex; use snowbridge_router_primitives::inbound::{ v2::{Asset::NativeTokenERC20, Message}, @@ -26,7 +26,6 @@ use snowbridge_router_primitives::inbound::{ }; use sp_core::H160; use sp_runtime::MultiAddress; -use testnet_parachains_constants::westend::fee::WeightToFee as WeightCalculator; /// Calculates the XCM prologue fee for sending an XCM to AH. const INITIAL_FUND: u128 = 5_000_000_000_000; @@ -43,10 +42,6 @@ pub fn weth_location() -> Location { ) } -pub fn dot_location() -> Location { - Location::new(1, Here) -} - pub fn register_weth() { let assethub_location = BridgeHubWestend::sibling_location_of(AssetHubWestend::para_id()); let assethub_sovereign = BridgeHubWestend::sovereign_account_id_of(assethub_location); @@ -95,8 +90,6 @@ pub(crate) fn set_up_weth_pool_with_wnd_on_ah_westend(asset: v5::Location) { let signed_owner = ::RuntimeOrigin::signed(owner.clone()); let signed_bh_sovereign = ::RuntimeOrigin::signed(bh_sovereign.clone()); - type RuntimeOrigin = ::RuntimeOrigin; - assert_ok!(::ForeignAssets::mint( signed_bh_sovereign.clone(), asset.clone().into(), @@ -165,15 +158,13 @@ fn register_token_v2() { let bridge_owner = EthereumLocationsConverterFor::<[u8; 32]>::from_chain_id(&chain_id); let token: H160 = hex!("c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2").into(); - let weth_amount = 9_000_000_000_000u128; - - let assets = vec![NativeTokenERC20 { token_id: WETH.into(), value: weth_amount }]; let ethereum_network_v5: NetworkId = EthereumNetwork::get().into(); - let weth_fee_value: u128 = 1_000_000_000_000; - let weth_fee: xcm::prelude::Asset = (weth_location(), weth_fee_value).into(); - let weth_transact_fee: xcm::prelude::Asset = (weth_location(), weth_fee_value).into(); + // Used to pay the asset creation deposit. + let weth_asset_value = 9_000_000_000_000u128; + let assets = vec![NativeTokenERC20 { token_id: WETH.into(), value: weth_asset_value }]; + let asset_deposit_weth: xcm::prelude::Asset = (weth_location(), weth_asset_value).into(); let asset_id = Location::new( 2, @@ -187,11 +178,11 @@ fn register_token_v2() { type RuntimeEvent = ::RuntimeEvent; let register_token_instructions = vec![ // Exchange weth for dot to pay the asset creation deposit - ExchangeAsset { give: weth_fee.clone().into(), want: dot_fee.clone().into(), maximal: false }, + ExchangeAsset { give: asset_deposit_weth.clone().into(), want: dot_fee.clone().into(), maximal: false }, // Deposit the dot deposit into the bridge sovereign account (where the asset creation fee // will be deducted from) DepositAsset { assets: dot_fee.into(), beneficiary: bridge_owner.into() }, - // Pay for the transact execution + // Call to create the asset. Transact { origin_kind: OriginKind::Xcm, call: ( diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs index e998909fd2da..0bd1a736eb3d 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/bridge_to_ethereum_config.rs @@ -39,7 +39,7 @@ use benchmark_helpers::DoNothingRouter; use frame_support::{parameter_types, weights::ConstantMultiplier}; use pallet_xcm::EnsureXcm; use sp_runtime::{ - traits::{ConstU128, ConstU32, ConstU8, Keccak256}, + traits::{ConstU32, ConstU8, Keccak256}, FixedU128, }; use xcm::prelude::{GlobalConsensus, InteriorLocation, Location, Parachain};