From 1a5d2cff6350443cde3eeb6348cea54801750afb Mon Sep 17 00:00:00 2001 From: ndk Date: Tue, 29 Apr 2025 18:38:06 +0200 Subject: [PATCH 01/35] stopped using TakeFirstAssetTrader in AH Rococo & Westend, parametrised macro, fixed Westend test --- .../assets/asset-hub-westend/src/tests/mod.rs | 24 ++++++++++++++--- .../asset-hub-westend/src/tests/transact.rs | 4 +-- .../assets/asset-hub-rococo/src/xcm_config.rs | 26 ------------------- .../asset-hub-westend/src/xcm_config.rs | 26 ------------------- 4 files changed, 22 insertions(+), 58 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs index 40f24add03065..b5371768c5b88 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs @@ -42,8 +42,8 @@ macro_rules! foreign_balance_on { } #[macro_export] -macro_rules! create_pool_with_wnd_on { - ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr ) => { +macro_rules! create_pool_with_wnd_on_custom_amounts { + ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr, $wnd_amount:expr, $asset_amount:expr ) => { emulated_integration_tests_common::impls::paste::paste! { <$chain>::execute_with(|| { type RuntimeEvent = <$chain as Chain>::RuntimeEvent; @@ -87,8 +87,8 @@ macro_rules! create_pool_with_wnd_on { signed_owner, Box::new(wnd_location), Box::new($asset_id), - 1_000_000_000_000, - 2_000_000_000_000, // $asset_id is worth half of wnd + $wnd_amount, + $asset_amount, 0, 0, owner.into() @@ -104,3 +104,19 @@ macro_rules! create_pool_with_wnd_on { } }; } + +#[macro_export] +macro_rules! create_pool_with_wnd_on { + ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr ) => { + $crate::create_pool_with_wnd_on_custom_amounts!( + $chain, + $asset_id, + $is_foreign, + $asset_owner, + 1_000_000_000_000, + 2_000_000_000_000 + ); + }; +} + + diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs index abaa557b0f5b4..7eb37c316b9db 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{create_pool_with_wnd_on, foreign_balance_on, imports::*}; +use crate::{create_pool_with_wnd_on, create_pool_with_wnd_on_custom_amounts, foreign_balance_on, imports::*}; use frame_support::traits::tokens::fungibles::Mutate; use xcm_builder::{DescribeAllTerminal, DescribeFamily, HashedDescription}; use xcm_executor::traits::ConvertLocation; @@ -113,7 +113,7 @@ fn transact_from_para_to_para_through_asset_hub() { // We create a pool between WND and USDT in AssetHub. let usdt = Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(USDT_ID.into())]); - create_pool_with_wnd_on!(AssetHubWestend, usdt, false, AssetHubWestendSender::get()); + create_pool_with_wnd_on_custom_amounts!(AssetHubWestend, usdt, false, AssetHubWestendSender::get(), 1_000_000_000_000, 20_000_000_000); // We also need a pool between WND and USDT on PenpalA. create_pool_with_wnd_on!(PenpalA, PenpalUsdtFromAssetHub::get(), true, PenpalAssetOwner::get()); // We also need a pool between WND and USDT on PenpalB. diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index de87fd2b19a30..5730c4ca166a3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -405,32 +405,6 @@ impl xcm_executor::Config for XcmConfig { ResolveAssetTo, AccountId, >, - // This trader allows to pay with `is_sufficient=true` "Trust Backed" assets from dedicated - // `pallet_assets` instance - `Assets`. - cumulus_primitives_utility::TakeFirstAssetTrader< - AccountId, - AssetFeeAsExistentialDepositMultiplierFeeCharger, - TrustBackedAssetsConvertedConcreteId, - Assets, - cumulus_primitives_utility::XcmFeesTo32ByteAccount< - FungiblesTransactor, - AccountId, - XcmAssetFeesReceiver, - >, - >, - // This trader allows to pay with `is_sufficient=true` "Foreign" assets from dedicated - // `pallet_assets` instance - `ForeignAssets`. - cumulus_primitives_utility::TakeFirstAssetTrader< - AccountId, - ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, - ForeignAssetsConvertedConcreteId, - ForeignAssets, - cumulus_primitives_utility::XcmFeesTo32ByteAccount< - ForeignFungiblesTransactor, - AccountId, - XcmAssetFeesReceiver, - >, - >, ); type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index a619e986c5852..dbca39f105b12 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -426,32 +426,6 @@ impl xcm_executor::Config for XcmConfig { ResolveAssetTo, AccountId, >, - // This trader allows to pay with `is_sufficient=true` "Trust Backed" assets from dedicated - // `pallet_assets` instance - `Assets`. - cumulus_primitives_utility::TakeFirstAssetTrader< - AccountId, - AssetFeeAsExistentialDepositMultiplierFeeCharger, - TrustBackedAssetsConvertedConcreteId, - Assets, - cumulus_primitives_utility::XcmFeesTo32ByteAccount< - FungiblesTransactor, - AccountId, - XcmAssetFeesReceiver, - >, - >, - // This trader allows to pay with `is_sufficient=true` "Foreign" assets from dedicated - // `pallet_assets` instance - `ForeignAssets`. - cumulus_primitives_utility::TakeFirstAssetTrader< - AccountId, - ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, - ForeignAssetsConvertedConcreteId, - ForeignAssets, - cumulus_primitives_utility::XcmFeesTo32ByteAccount< - ForeignFungiblesTransactor, - AccountId, - XcmAssetFeesReceiver, - >, - >, ); type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; From 5b1300802f8db2ba45851cc3ef95f720ce6f0b5b Mon Sep 17 00:00:00 2001 From: ndk Date: Tue, 29 Apr 2025 18:48:08 +0200 Subject: [PATCH 02/35] fmt --- .../tests/assets/asset-hub-westend/src/tests/mod.rs | 2 -- .../assets/asset-hub-westend/src/tests/transact.rs | 13 +++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs index b5371768c5b88..5c9eb2f8eaa64 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs @@ -118,5 +118,3 @@ macro_rules! create_pool_with_wnd_on { ); }; } - - diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs index 7eb37c316b9db..3e6dd4fea5fe8 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs @@ -13,7 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{create_pool_with_wnd_on, create_pool_with_wnd_on_custom_amounts, foreign_balance_on, imports::*}; +use crate::{ + create_pool_with_wnd_on, create_pool_with_wnd_on_custom_amounts, foreign_balance_on, imports::*, +}; use frame_support::traits::tokens::fungibles::Mutate; use xcm_builder::{DescribeAllTerminal, DescribeFamily, HashedDescription}; use xcm_executor::traits::ConvertLocation; @@ -113,7 +115,14 @@ fn transact_from_para_to_para_through_asset_hub() { // We create a pool between WND and USDT in AssetHub. let usdt = Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(USDT_ID.into())]); - create_pool_with_wnd_on_custom_amounts!(AssetHubWestend, usdt, false, AssetHubWestendSender::get(), 1_000_000_000_000, 20_000_000_000); + create_pool_with_wnd_on_custom_amounts!( + AssetHubWestend, + usdt, + false, + AssetHubWestendSender::get(), + 1_000_000_000_000, + 20_000_000_000 + ); // We also need a pool between WND and USDT on PenpalA. create_pool_with_wnd_on!(PenpalA, PenpalUsdtFromAssetHub::get(), true, PenpalAssetOwner::get()); // We also need a pool between WND and USDT on PenpalB. From 110062fdcbd20cc0d6ae1f979e665a5cc846be78 Mon Sep 17 00:00:00 2001 From: ndk Date: Tue, 29 Apr 2025 18:53:03 +0200 Subject: [PATCH 03/35] prdoct --- prdoc/pr_8376.prdoc | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 prdoc/pr_8376.prdoc diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc new file mode 100644 index 0000000000000..0e0cb5e94c1f3 --- /dev/null +++ b/prdoc/pr_8376.prdoc @@ -0,0 +1,12 @@ +title: 'Stopped using TakeFirstAssetTrader in AH Rococo & Westend' +doc: +- audience: Runtime Dev + description: |- + Removed `TakeFirstAssetTrader` from configs. Improved macro, fixed test. +crates: +- name: asset-hub-rococo-runtime + bump: minor +- name: asset-hub-westend-runtime + bump: minor +- name: asset-hub-westend-integration-tests + bump: minor \ No newline at end of file From a6c56ebb9d8528e6bc7f7371b0a30937a8bdad8c Mon Sep 17 00:00:00 2001 From: ndk Date: Wed, 30 Apr 2025 10:16:56 +0200 Subject: [PATCH 04/35] newline in prdoc --- prdoc/pr_8376.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc index 0e0cb5e94c1f3..fe63fd2a9e11a 100644 --- a/prdoc/pr_8376.prdoc +++ b/prdoc/pr_8376.prdoc @@ -9,4 +9,4 @@ crates: - name: asset-hub-westend-runtime bump: minor - name: asset-hub-westend-integration-tests - bump: minor \ No newline at end of file + bump: minor From 48782934ea1d93c05d35fc5ca7bbd8405ee41b47 Mon Sep 17 00:00:00 2001 From: Andrii Date: Thu, 1 May 2025 11:40:05 +0200 Subject: [PATCH 05/35] Introduced a way to add configurable amount of both asset to the liquidity pool (#8392) Used macro overloading instead of two macros --- .../assets/asset-hub-westend/src/tests/mod.rs | 29 +++++++++---------- .../asset-hub-westend/src/tests/transact.rs | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs index 5c9eb2f8eaa64..f46dc66d24129 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/mod.rs @@ -42,7 +42,20 @@ macro_rules! foreign_balance_on { } #[macro_export] -macro_rules! create_pool_with_wnd_on_custom_amounts { +macro_rules! create_pool_with_wnd_on { + // default amounts + ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr ) => { + $crate::create_pool_with_wnd_on!( + $chain, + $asset_id, + $is_foreign, + $asset_owner, + 1_000_000_000_000, + 2_000_000_000_000 + ); + }; + + // custom amounts ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr, $wnd_amount:expr, $asset_amount:expr ) => { emulated_integration_tests_common::impls::paste::paste! { <$chain>::execute_with(|| { @@ -104,17 +117,3 @@ macro_rules! create_pool_with_wnd_on_custom_amounts { } }; } - -#[macro_export] -macro_rules! create_pool_with_wnd_on { - ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr ) => { - $crate::create_pool_with_wnd_on_custom_amounts!( - $chain, - $asset_id, - $is_foreign, - $asset_owner, - 1_000_000_000_000, - 2_000_000_000_000 - ); - }; -} diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs index 3e6dd4fea5fe8..b2f0cd9700815 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs @@ -115,7 +115,7 @@ fn transact_from_para_to_para_through_asset_hub() { // We create a pool between WND and USDT in AssetHub. let usdt = Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(USDT_ID.into())]); - create_pool_with_wnd_on_custom_amounts!( + create_pool_with_wnd_on!( AssetHubWestend, usdt, false, From 9a37952bae0804324d54d847753f5c37f2dbe46f Mon Sep 17 00:00:00 2001 From: ndk Date: Thu, 1 May 2025 12:17:14 +0200 Subject: [PATCH 06/35] removed unused import --- .../tests/assets/asset-hub-westend/src/tests/transact.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs index b2f0cd9700815..ad886dbe5e24d 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/transact.rs @@ -13,9 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::{ - create_pool_with_wnd_on, create_pool_with_wnd_on_custom_amounts, foreign_balance_on, imports::*, -}; +use crate::{create_pool_with_wnd_on, foreign_balance_on, imports::*}; use frame_support::traits::tokens::fungibles::Mutate; use xcm_builder::{DescribeAllTerminal, DescribeFamily, HashedDescription}; use xcm_executor::traits::ConvertLocation; From 98538a3ec76918b629f3975f5fb08f62f18f1131 Mon Sep 17 00:00:00 2001 From: ndk Date: Thu, 1 May 2025 14:00:37 +0200 Subject: [PATCH 07/35] Changed to Westend fix only --- .../assets/asset-hub-rococo/src/xcm_config.rs | 26 +++++++++++++++++++ prdoc/pr_8376.prdoc | 6 ++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index 5730c4ca166a3..de87fd2b19a30 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -405,6 +405,32 @@ impl xcm_executor::Config for XcmConfig { ResolveAssetTo, AccountId, >, + // This trader allows to pay with `is_sufficient=true` "Trust Backed" assets from dedicated + // `pallet_assets` instance - `Assets`. + cumulus_primitives_utility::TakeFirstAssetTrader< + AccountId, + AssetFeeAsExistentialDepositMultiplierFeeCharger, + TrustBackedAssetsConvertedConcreteId, + Assets, + cumulus_primitives_utility::XcmFeesTo32ByteAccount< + FungiblesTransactor, + AccountId, + XcmAssetFeesReceiver, + >, + >, + // This trader allows to pay with `is_sufficient=true` "Foreign" assets from dedicated + // `pallet_assets` instance - `ForeignAssets`. + cumulus_primitives_utility::TakeFirstAssetTrader< + AccountId, + ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, + ForeignAssetsConvertedConcreteId, + ForeignAssets, + cumulus_primitives_utility::XcmFeesTo32ByteAccount< + ForeignFungiblesTransactor, + AccountId, + XcmAssetFeesReceiver, + >, + >, ); type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc index fe63fd2a9e11a..ae820dfe4b051 100644 --- a/prdoc/pr_8376.prdoc +++ b/prdoc/pr_8376.prdoc @@ -1,11 +1,9 @@ -title: 'Stopped using TakeFirstAssetTrader in AH Rococo & Westend' +title: 'Stopped using TakeFirstAssetTrader in AH Westend' doc: - audience: Runtime Dev description: |- - Removed `TakeFirstAssetTrader` from configs. Improved macro, fixed test. + Removed `TakeFirstAssetTrader` from Westend configs. Improved macro, fixed test. crates: -- name: asset-hub-rococo-runtime - bump: minor - name: asset-hub-westend-runtime bump: minor - name: asset-hub-westend-integration-tests From a21c540ae0495fbf41ac5c4350eaa49e3ff1ab91 Mon Sep 17 00:00:00 2001 From: ndk Date: Thu, 1 May 2025 15:00:47 +0200 Subject: [PATCH 08/35] removed the tests that were verifying first_asset_trader functionality. Fixed a test that needed liquidity pool --- .../assets/asset-hub-westend/tests/tests.rs | 326 +----------------- 1 file changed, 12 insertions(+), 314 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index 564228d307476..1bd0e86d68804 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -420,247 +420,6 @@ fn test_buy_and_refund_weight_with_swap_foreign_asset_xcm_trader() { }) } -#[test] -fn test_asset_xcm_take_first_trader() { - ExtBuilder::::default() - .with_tracing() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - let minimum_asset_balance = 3333333_u128; - let local_asset_id = 1; - assert_ok!(Assets::force_create( - RuntimeHelper::root_origin(), - local_asset_id.into(), - AccountId::from(ALICE).into(), - true, - minimum_asset_balance - )); - - // We first mint enough asset for the account to exist for assets - assert_ok!(Assets::mint( - RuntimeHelper::origin_of(AccountId::from(ALICE)), - local_asset_id.into(), - AccountId::from(ALICE).into(), - minimum_asset_balance - )); - - // get asset id as location - let asset_location = - AssetIdForTrustBackedAssetsConvert::convert_back(&local_asset_id).unwrap(); - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - // We are going to buy 4e9 weight - let bought = Weight::from_parts(4_000_000_000u64, 0); - - // Lets calculate amount needed - let asset_amount_needed = - AssetFeeAsExistentialDepositMultiplierFeeCharger::charge_weight_in_fungibles( - local_asset_id, - bought, - ) - .expect("failed to compute"); - - // Lets pay with: asset_amount_needed + asset_amount_extra - let asset_amount_extra = 100_u128; - let asset: Asset = - (asset_location.clone(), asset_amount_needed + asset_amount_extra).into(); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Lets buy_weight and make sure buy_weight does not return an error - let unused_assets = trader.buy_weight(bought, asset.into(), &ctx).expect("Expected Ok"); - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets.ensure_contains(&(asset_location, asset_amount_extra).into())); - - // Drop trader - drop(trader); - - // Make sure author(Alice) has received the amount - assert_eq!( - Assets::balance(local_asset_id, AccountId::from(ALICE)), - minimum_asset_balance + asset_amount_needed - ); - - // We also need to ensure the total supply increased - assert_eq!( - Assets::total_supply(local_asset_id), - minimum_asset_balance + asset_amount_needed - ); - }); -} - -#[test] -fn test_foreign_asset_xcm_take_first_trader() { - ExtBuilder::::default() - .with_tracing() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - let minimum_asset_balance = 3333333_u128; - let foreign_location = xcm::v5::Location { - parents: 1, - interior: ( - xcm::v5::Junction::Parachain(1234), - xcm::v5::Junction::GeneralIndex(12345), - ) - .into(), - }; - assert_ok!(ForeignAssets::force_create( - RuntimeHelper::root_origin(), - foreign_location.clone().into(), - AccountId::from(ALICE).into(), - true, - minimum_asset_balance - )); - - // We first mint enough asset for the account to exist for assets - assert_ok!(ForeignAssets::mint( - RuntimeHelper::origin_of(AccountId::from(ALICE)), - foreign_location.clone().into(), - AccountId::from(ALICE).into(), - minimum_asset_balance - )); - - let asset_location_v5: Location = foreign_location.clone().try_into().unwrap(); - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - // We are going to buy 4e9 weight - let bought = Weight::from_parts(4_000_000_000u64, 0); - - // Lets calculate amount needed - let asset_amount_needed = ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger::charge_weight_in_fungibles(foreign_location.clone(), bought) - .expect("failed to compute"); - - // Lets pay with: asset_amount_needed + asset_amount_extra - let asset_amount_extra = 100_u128; - let asset: Asset = - (asset_location_v5.clone(), asset_amount_needed + asset_amount_extra).into(); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Lets buy_weight and make sure buy_weight does not return an error - let unused_assets = trader.buy_weight(bought, asset.into(), &ctx).expect("Expected Ok"); - // Check whether a correct amount of unused assets is returned - assert_ok!( - unused_assets.ensure_contains(&(asset_location_v5, asset_amount_extra).into()) - ); - - // Drop trader - drop(trader); - - // Make sure author(Alice) has received the amount - assert_eq!( - ForeignAssets::balance(foreign_location.clone(), AccountId::from(ALICE)), - minimum_asset_balance + asset_amount_needed - ); - - // We also need to ensure the total supply increased - assert_eq!( - ForeignAssets::total_supply(foreign_location), - minimum_asset_balance + asset_amount_needed - ); - }); -} - -#[test] -fn test_asset_xcm_take_first_trader_with_refund() { - ExtBuilder::::default() - .with_tracing() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - // We set existential deposit to be identical to the one for Balances first - assert_ok!(Assets::force_create( - RuntimeHelper::root_origin(), - 1.into(), - AccountId::from(ALICE).into(), - true, - ExistentialDeposit::get() - )); - - // We first mint enough asset for the account to exist for assets - assert_ok!(Assets::mint( - RuntimeHelper::origin_of(AccountId::from(ALICE)), - 1.into(), - AccountId::from(ALICE).into(), - ExistentialDeposit::get() - )); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - // We are going to buy 4e9 weight - let bought = Weight::from_parts(4_000_000_000u64, 0); - let asset_location = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap(); - - // lets calculate amount needed - let amount_bought = WeightToFee::weight_to_fee(&bought); - - let asset: Asset = (asset_location.clone(), amount_bought).into(); - - // Make sure buy_weight does not return an error - assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx)); - - // Make sure again buy_weight does return an error - // This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader` - // tuple chain, which cannot be called twice - assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive); - - // We actually use half of the weight - let weight_used = bought / 2; - - // Make sure refund works. - let amount_refunded = WeightToFee::weight_to_fee(&(bought - weight_used)); - - assert_eq!( - trader.refund_weight(bought - weight_used, &ctx), - Some((asset_location, amount_refunded).into()) - ); - - // Drop trader - drop(trader); - - // We only should have paid for half of the bought weight - let fees_paid = WeightToFee::weight_to_fee(&weight_used); - - assert_eq!( - Assets::balance(1, AccountId::from(ALICE)), - ExistentialDeposit::get() + fees_paid - ); - - // We also need to ensure the total supply increased - assert_eq!(Assets::total_supply(1), ExistentialDeposit::get() + fees_paid); - }); -} - #[test] fn test_asset_xcm_take_first_trader_refund_not_possible_since_amount_less_than_ed() { ExtBuilder::::default() @@ -714,71 +473,6 @@ fn test_asset_xcm_take_first_trader_refund_not_possible_since_amount_less_than_e }); } -#[test] -fn test_that_buying_ed_refund_does_not_refund_for_take_first_trader() { - ExtBuilder::::default() - .with_tracing() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - // We set existential deposit to be identical to the one for Balances first - assert_ok!(Assets::force_create( - RuntimeHelper::root_origin(), - 1.into(), - AccountId::from(ALICE).into(), - true, - ExistentialDeposit::get() - )); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - let bought = Weight::from_parts(500_000_000u64, 0); - - let asset_location = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap(); - - let amount_bought = WeightToFee::weight_to_fee(&bought); - - assert!( - amount_bought < ExistentialDeposit::get(), - "we are testing what happens when the amount does not exceed ED" - ); - - // We know we will have to buy at least ED, so lets make sure first it will - // fail with a payment of less than ED - let asset: Asset = (asset_location.clone(), amount_bought).into(); - assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive); - - // Now lets buy ED at least - let asset: Asset = (asset_location.clone(), ExistentialDeposit::get()).into(); - - // Buy weight should work - assert_ok!(trader.buy_weight(bought, asset.into(), &ctx)); - - // Should return None. We have a specific check making sure we don't go below ED for - // drop payment - assert_eq!(trader.refund_weight(bought, &ctx), None); - - // Drop trader - drop(trader); - - // Make sure author(Alice) has received the amount - assert_eq!(Assets::balance(1, AccountId::from(ALICE)), ExistentialDeposit::get()); - - // We also need to ensure the total supply increased - assert_eq!(Assets::total_supply(1), ExistentialDeposit::get()); - }); -} - #[test] fn test_asset_xcm_take_first_trader_not_possible_for_non_sufficient_assets() { ExtBuilder::::default() @@ -1320,9 +1014,12 @@ fn receive_reserve_asset_deposited_roc_from_asset_hub_rococo_fees_paid_by_suffic AccountId::from([73; 32]), block_author_account.clone(), // receiving ROCs - foreign_asset_create_params, + foreign_asset_create_params.clone(), 1000000000000, - bridging_to_asset_hub_rococo, + || { + setup_pool_for_paying_fees_with_foreign_assets(foreign_asset_create_params); + bridging_to_asset_hub_rococo() + }, ( [PalletInstance(bp_bridge_hub_westend::WITH_BRIDGE_WESTEND_TO_ROCOCO_MESSAGES_PALLET_INDEX)].into(), GlobalConsensus(ByGenesis(ROCOCO_GENESIS_HASH)), @@ -1339,15 +1036,16 @@ fn receive_reserve_asset_deposited_roc_from_asset_hub_rococo_fees_paid_by_suffic ); }, || { - // `TakeFirstAssetTrader` puts fees to the block author - assert!( + // check staking pot has at least ED + assert!(Balances::free_balance(&staking_pot) >= ExistentialDeposit::get()); + // check now foreign asset for staking pot + assert_eq!( ForeignAssets::balance( foreign_asset_id_location.clone().into(), - &block_author_account - ) > 0 + &staking_pot + ), + 0 ); - // `SwapFirstAssetTrader` did not work - assert_eq!(Balances::free_balance(&staking_pot), 0); } ) } From 50f090a89d55672011d00d54b76cf307a7bab150 Mon Sep 17 00:00:00 2001 From: ndk Date: Thu, 1 May 2025 15:14:30 +0200 Subject: [PATCH 09/35] removed unused imports --- .../runtimes/assets/asset-hub-westend/tests/tests.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs index 1bd0e86d68804..951b33124404e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs @@ -20,10 +20,8 @@ use asset_hub_westend_runtime::{ xcm_config, xcm_config::{ - bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount, - ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, GovernanceLocation, - LocationToAccountId, StakingPot, TrustBackedAssetsPalletLocation, WestendLocation, - XcmConfig, + bridging, CheckingAccount, GovernanceLocation, LocationToAccountId, StakingPot, + TrustBackedAssetsPalletLocation, WestendLocation, XcmConfig, }, AllPalletsWithoutSystem, Assets, Balances, Block, ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem, @@ -36,7 +34,6 @@ use asset_test_utils::{ ExtBuilder, GovernanceOrigin, SlotDurations, }; use codec::{Decode, Encode}; -use cumulus_primitives_utility::ChargeWeightInFungibles; use frame_support::{ assert_err, assert_noop, assert_ok, parameter_types, traits::{ From 3ead71665549ea645839f3f6ad24a14e36d769ae Mon Sep 17 00:00:00 2001 From: ndk Date: Thu, 1 May 2025 16:30:26 +0200 Subject: [PATCH 10/35] fixed other emulated failing tests --- .../bridges/bridge-hub-rococo/src/tests/asset_transfers.rs | 1 + .../bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/asset_transfers.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/asset_transfers.rs index f058803f16f7e..20ba9e4801379 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/asset_transfers.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/tests/asset_transfers.rs @@ -363,6 +363,7 @@ fn send_rocs_from_penpal_rococo_through_asset_hub_rococo_to_asset_hub_westend() let local_asset_hub = PenpalA::sibling_location_of(AssetHubRococo::para_id()); let (roc_at_rococo_parachains, roc_at_asset_hub_westend) = set_up_rocs_for_penpal_rococo_through_ahr_to_ahw(&sender, amount); + set_up_pool_with_wnd_on_ah_westend(roc_at_asset_hub_westend.clone(), true); let sov_ahw_on_ahr = AssetHubRococo::sovereign_account_of_parachain_on_other_global_consensus( ByGenesis(WESTEND_GENESIS_HASH), diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs index 1009a23b22744..cb77da336aadd 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs @@ -161,6 +161,7 @@ fn send_token_v2() { NativeTokenERC20 { token_id: token.into(), value: token_transfer_value }, ]; + set_up_eth_and_dot_pool(); let topic_id = BridgeHubWestend::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; let instructions = vec![ @@ -963,6 +964,7 @@ fn invalid_claimer_does_not_fail_the_message() { let origin = H160::random(); + set_up_eth_and_dot_pool(); BridgeHubWestend::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; let instructions = vec![ From 5580912e25d88f4143d43223043781ad88b30941 Mon Sep 17 00:00:00 2001 From: ndk Date: Thu, 1 May 2025 16:58:07 +0200 Subject: [PATCH 11/35] fixed other snowbridge tests --- .../bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs index cb77da336aadd..0aae34c0a5c7c 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_v2_inbound.rs @@ -281,6 +281,7 @@ fn send_weth_v2() { NativeTokenERC20 { token_id: WETH.into(), value: token_transfer_value }, ]; + set_up_eth_and_dot_pool(); BridgeHubWestend::execute_with(|| { type RuntimeEvent = ::RuntimeEvent; let instructions = vec![ @@ -770,6 +771,7 @@ fn send_foreign_erc20_token_back_to_polkadot() { .appended_with(asset_id.clone().interior) .unwrap(); + set_up_eth_and_dot_pool(); // Register token BridgeHubWestend::execute_with(|| { type RuntimeOrigin = ::RuntimeOrigin; From 908f77150bff50242453cb1e7458b22836c76b94 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 11:51:01 +0200 Subject: [PATCH 12/35] improved snowbridge macro and fixed the tests --- .../emulated/common/src/macros.rs | 16 ++++++++++++++-- .../src/tests/snowbridge_common.rs | 4 ++-- .../bridge-hub-westend/src/tests/transact.rs | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/common/src/macros.rs b/cumulus/parachains/integration-tests/emulated/common/src/macros.rs index 84f76333ab66b..4f4d5ba04380b 100644 --- a/cumulus/parachains/integration-tests/emulated/common/src/macros.rs +++ b/cumulus/parachains/integration-tests/emulated/common/src/macros.rs @@ -827,6 +827,17 @@ macro_rules! test_cross_chain_alias { #[macro_export] macro_rules! create_pool_with_native_on { ( $chain:ident, $asset:expr, $is_foreign:expr, $asset_owner:expr ) => { + $crate::create_pool_with_native_on!( + $chain, + $asset, + $is_foreign, + $asset_owner, + 1_000_000_000_000, + 2_000_000_000_000 + ); + }; + + ( $chain:ident, $asset:expr, $is_foreign:expr, $asset_owner:expr, $native_amount:expr, $asset_amount:expr ) => { emulated_integration_tests_common::impls::paste::paste! { <$chain>::execute_with(|| { type RuntimeEvent = <$chain as Chain>::RuntimeEvent; @@ -871,8 +882,8 @@ macro_rules! create_pool_with_native_on { signed_owner, Box::new(native_asset), Box::new($asset), - 1_000_000_000_000, - 2_000_000_000_000, // $asset is worth half of native_asset + $native_amount, + $asset_amount, 0, 0, owner.into() @@ -888,3 +899,4 @@ macro_rules! create_pool_with_native_on { } }; } + diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs index d9c65ae26a146..58502136c88dc 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs @@ -322,8 +322,8 @@ pub fn create_pools_on_ah() { let ethereum_sovereign = snowbridge_sovereign(); AssetHubWestend::fund_accounts(vec![(ethereum_sovereign.clone(), INITIAL_FUND)]); PenpalB::fund_accounts(vec![(ethereum_sovereign.clone(), INITIAL_FUND)]); - create_pool_with_native_on!(AssetHubWestend, weth_location(), true, ethereum_sovereign.clone()); - create_pool_with_native_on!(AssetHubWestend, ethereum(), true, ethereum_sovereign.clone()); + create_pool_with_native_on!(AssetHubWestend, weth_location(), true, ethereum_sovereign.clone(), 1_000_000_000_000, 20_000_000_000); + create_pool_with_native_on!(AssetHubWestend, ethereum(), true, ethereum_sovereign.clone(), 1_000_000_000_000, 20_000_000_000); } pub(crate) fn set_up_eth_and_dot_pool() { diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs index 96937a95a99b5..432a929054d60 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs @@ -138,9 +138,9 @@ fn transact_from_ethereum_to_penpalb_through_asset_hub() { // We create a pool between WND and WETH in AssetHub to support paying for fees with WETH. let snowbridge_sovereign = snowbridge_sovereign(); - create_pool_with_native_on!(AssetHubWestend, bridged_weth.clone(), true, snowbridge_sovereign); + create_pool_with_native_on!(AssetHubWestend, bridged_weth.clone(), true, snowbridge_sovereign, 1_000_000_000_000, 20_000_000_000); // We also need a pool between WND and WETH on PenpalB to support paying for fees with WETH. - create_pool_with_native_on!(PenpalB, bridged_weth.clone(), true, PenpalAssetOwner::get()); + create_pool_with_native_on!(PenpalB, bridged_weth.clone(), true, PenpalAssetOwner::get(), 1_000_000_000_000, 20_000_000_000); // Init values for Parachain Destination let receiver = PenpalBReceiver::get(); From c75d8f86f073c7f803e8d136f65ee2bb5e54b2e4 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 12:43:18 +0200 Subject: [PATCH 13/35] prdoc --- prdoc/pr_8376.prdoc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc index ae820dfe4b051..58caeea9a62ca 100644 --- a/prdoc/pr_8376.prdoc +++ b/prdoc/pr_8376.prdoc @@ -8,3 +8,9 @@ crates: bump: minor - name: asset-hub-westend-integration-tests bump: minor +- name emulated-integration-tests-common + bump: minor +- name: bridge-hub-westend-integration-tests + bump: minor +- name: bridge-hub-rococo-integration-tests + bump: minor From d3b842ac98f3cab6ab13b1547b34726fb8e4d85d Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 12:45:39 +0200 Subject: [PATCH 14/35] prdoc fix --- prdoc/pr_8376.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc index 58caeea9a62ca..8a1d32787be28 100644 --- a/prdoc/pr_8376.prdoc +++ b/prdoc/pr_8376.prdoc @@ -8,7 +8,7 @@ crates: bump: minor - name: asset-hub-westend-integration-tests bump: minor -- name emulated-integration-tests-common +- name: emulated-integration-tests-common bump: minor - name: bridge-hub-westend-integration-tests bump: minor From 85e4c99947aaa47b7d85416dc6833263d5b176dc Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 12:51:56 +0200 Subject: [PATCH 15/35] fmt --- .../parachains/integration-tests/emulated/common/src/macros.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/cumulus/parachains/integration-tests/emulated/common/src/macros.rs b/cumulus/parachains/integration-tests/emulated/common/src/macros.rs index 4f4d5ba04380b..a1bb8534a24eb 100644 --- a/cumulus/parachains/integration-tests/emulated/common/src/macros.rs +++ b/cumulus/parachains/integration-tests/emulated/common/src/macros.rs @@ -899,4 +899,3 @@ macro_rules! create_pool_with_native_on { } }; } - From f56b178ea0f58abe65b5fa04ca1302d6bf874863 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 13:02:15 +0200 Subject: [PATCH 16/35] snowbridge fmt --- .../src/tests/snowbridge_common.rs | 18 ++++++++++++++++-- .../bridge-hub-westend/src/tests/transact.rs | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs index 58502136c88dc..a397f7beeb3f2 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/snowbridge_common.rs @@ -322,8 +322,22 @@ pub fn create_pools_on_ah() { let ethereum_sovereign = snowbridge_sovereign(); AssetHubWestend::fund_accounts(vec![(ethereum_sovereign.clone(), INITIAL_FUND)]); PenpalB::fund_accounts(vec![(ethereum_sovereign.clone(), INITIAL_FUND)]); - create_pool_with_native_on!(AssetHubWestend, weth_location(), true, ethereum_sovereign.clone(), 1_000_000_000_000, 20_000_000_000); - create_pool_with_native_on!(AssetHubWestend, ethereum(), true, ethereum_sovereign.clone(), 1_000_000_000_000, 20_000_000_000); + create_pool_with_native_on!( + AssetHubWestend, + weth_location(), + true, + ethereum_sovereign.clone(), + 1_000_000_000_000, + 20_000_000_000 + ); + create_pool_with_native_on!( + AssetHubWestend, + ethereum(), + true, + ethereum_sovereign.clone(), + 1_000_000_000_000, + 20_000_000_000 + ); } pub(crate) fn set_up_eth_and_dot_pool() { diff --git a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs index 432a929054d60..26c45a5e723e1 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-westend/src/tests/transact.rs @@ -138,9 +138,23 @@ fn transact_from_ethereum_to_penpalb_through_asset_hub() { // We create a pool between WND and WETH in AssetHub to support paying for fees with WETH. let snowbridge_sovereign = snowbridge_sovereign(); - create_pool_with_native_on!(AssetHubWestend, bridged_weth.clone(), true, snowbridge_sovereign, 1_000_000_000_000, 20_000_000_000); + create_pool_with_native_on!( + AssetHubWestend, + bridged_weth.clone(), + true, + snowbridge_sovereign, + 1_000_000_000_000, + 20_000_000_000 + ); // We also need a pool between WND and WETH on PenpalB to support paying for fees with WETH. - create_pool_with_native_on!(PenpalB, bridged_weth.clone(), true, PenpalAssetOwner::get(), 1_000_000_000_000, 20_000_000_000); + create_pool_with_native_on!( + PenpalB, + bridged_weth.clone(), + true, + PenpalAssetOwner::get(), + 1_000_000_000_000, + 20_000_000_000 + ); // Init values for Parachain Destination let receiver = PenpalBReceiver::get(); From 14d3d48c002c1330a06d1b40da1b90cecccb1e0f Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 13:14:31 +0200 Subject: [PATCH 17/35] removed unused helper types --- .../asset-hub-westend/src/xcm_config.rs | 22 ------------------- 1 file changed, 22 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index dbca39f105b12..70c153b89f151 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -247,7 +247,6 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; - pub XcmAssetFeesReceiver: Option = Authorship::author(); } pub struct ParentOrParentsPlurality; @@ -310,27 +309,6 @@ pub type Barrier = TrailingSetTopicAsId< >, >; -// TODO: This calls into the Assets pallet's default `BalanceToAssetBalance` implementation, which -// uses the ratio of minimum balances and requires asset sufficiency. This means that purchasing -// weight within XCM programs will still use the old way, and paying fees via asset conversion will -// only be possible when transacting locally. We should add an impl of this trait that does asset -// conversion. -pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier< - Runtime, - WeightToFee, - pallet_assets::BalanceToAssetBalance, - TrustBackedAssetsInstance, ->; - -/// Multiplier used for dedicated `TakeFirstAssetTrader` with `ForeignAssets` instance. -pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger = - AssetFeeAsExistentialDepositMultiplier< - Runtime, - WeightToFee, - pallet_assets::BalanceToAssetBalance, - ForeignAssetsInstance, - >; - /// Locations that will not be charged fees in the executor, /// either execution or delivery. /// We only waive fees for system functions, which these locations represent. From 023861dffca43aeba8fa8989fe1a54e713555749 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 13:31:03 +0200 Subject: [PATCH 18/35] removed unused import --- .../assets/asset-hub-westend/src/xcm_config.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs index 70c153b89f151..5187e0e69a4fb 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_config.rs @@ -14,11 +14,10 @@ // limitations under the License. use super::{ - AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, BaseDeliveryFee, - CollatorSelection, DepositPerByte, DepositPerItem, FeeAssetId, ForeignAssets, - ForeignAssetsInstance, ParachainInfo, ParachainSystem, PolkadotXcm, PoolAssets, Runtime, - RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, ToRococoXcmRouter, - TransactionByteFee, TrustBackedAssetsInstance, Uniques, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Assets, Balance, Balances, BaseDeliveryFee, CollatorSelection, + DepositPerByte, DepositPerItem, FeeAssetId, ForeignAssets, ParachainInfo, ParachainSystem, + PolkadotXcm, PoolAssets, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, + ToRococoXcmRouter, TransactionByteFee, Uniques, WeightToFee, XcmpQueue, }; use assets_common::{ matching::{FromSiblingParachain, IsForeignConcreteAsset, ParentLocation}, @@ -36,15 +35,14 @@ use frame_system::EnsureRoot; use pallet_xcm::{AuthorizedAliasers, XcmPassthrough}; use parachains_common::{ xcm_config::{ - AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, - ConcreteAssetFromSystem, RelayOrOtherSystemParachains, + AllSiblingSystemParachains, ConcreteAssetFromSystem, RelayOrOtherSystemParachains, }, TREASURY_PALLET_ID, }; use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_common::xcm_sender::ExponentialPrice; use snowbridge_outbound_queue_primitives::v2::exporter::PausableExporter; -use sp_runtime::traits::{AccountIdConversion, ConvertInto, TryConvertInto}; +use sp_runtime::traits::{AccountIdConversion, TryConvertInto}; use westend_runtime_constants::system_parachain::COLLECTIVES_ID; use xcm::latest::{prelude::*, ROCOCO_GENESIS_HASH, WESTEND_GENESIS_HASH}; use xcm_builder::{ From ec6fabc0d376191833e0697a0b6acd4ff771fde0 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 13:53:03 +0200 Subject: [PATCH 19/35] removed rococo config --- .../assets/asset-hub-rococo/src/xcm_config.rs | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index de87fd2b19a30..5730c4ca166a3 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -405,32 +405,6 @@ impl xcm_executor::Config for XcmConfig { ResolveAssetTo, AccountId, >, - // This trader allows to pay with `is_sufficient=true` "Trust Backed" assets from dedicated - // `pallet_assets` instance - `Assets`. - cumulus_primitives_utility::TakeFirstAssetTrader< - AccountId, - AssetFeeAsExistentialDepositMultiplierFeeCharger, - TrustBackedAssetsConvertedConcreteId, - Assets, - cumulus_primitives_utility::XcmFeesTo32ByteAccount< - FungiblesTransactor, - AccountId, - XcmAssetFeesReceiver, - >, - >, - // This trader allows to pay with `is_sufficient=true` "Foreign" assets from dedicated - // `pallet_assets` instance - `ForeignAssets`. - cumulus_primitives_utility::TakeFirstAssetTrader< - AccountId, - ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, - ForeignAssetsConvertedConcreteId, - ForeignAssets, - cumulus_primitives_utility::XcmFeesTo32ByteAccount< - ForeignFungiblesTransactor, - AccountId, - XcmAssetFeesReceiver, - >, - >, ); type ResponseHandler = PolkadotXcm; type AssetTrap = PolkadotXcm; From d37dc449273f18e048a346888cc10049ab7293fd Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 13:56:23 +0200 Subject: [PATCH 20/35] removed take_first_trader_tests --- .../assets/asset-hub-rococo/tests/tests.rs | 143 ------------------ 1 file changed, 143 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs index 934cf71e009b6..1b652fcbc2c6b 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs @@ -402,84 +402,6 @@ fn test_buy_and_refund_weight_with_swap_foreign_asset_xcm_trader() { }) } -#[test] -fn test_asset_xcm_take_first_trader() { - ExtBuilder::::default() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - let minimum_asset_balance = 3333333_u128; - let local_asset_id = 1; - assert_ok!(Assets::force_create( - RuntimeHelper::root_origin(), - local_asset_id.into(), - AccountId::from(ALICE).into(), - true, - minimum_asset_balance - )); - - // We first mint enough asset for the account to exist for assets - assert_ok!(Assets::mint( - RuntimeHelper::origin_of(AccountId::from(ALICE)), - local_asset_id.into(), - AccountId::from(ALICE).into(), - minimum_asset_balance - )); - - // get asset id as location - let asset_location = - AssetIdForTrustBackedAssetsConvert::convert_back(&local_asset_id).unwrap(); - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - // We are going to buy 4e9 weight - let bought = Weight::from_parts(4_000_000_000u64, 0); - - // Lets calculate amount needed - let asset_amount_needed = - AssetFeeAsExistentialDepositMultiplierFeeCharger::charge_weight_in_fungibles( - local_asset_id, - bought, - ) - .expect("failed to compute"); - - // Lets pay with: asset_amount_needed + asset_amount_extra - let asset_amount_extra = 100_u128; - let asset: Asset = - (asset_location.clone(), asset_amount_needed + asset_amount_extra).into(); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Lets buy_weight and make sure buy_weight does not return an error - let unused_assets = trader.buy_weight(bought, asset.into(), &ctx).expect("Expected Ok"); - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets.ensure_contains(&(asset_location, asset_amount_extra).into())); - - // Drop trader - drop(trader); - - // Make sure author(Alice) has received the amount - assert_eq!( - Assets::balance(local_asset_id, AccountId::from(ALICE)), - minimum_asset_balance + asset_amount_needed - ); - - // We also need to ensure the total supply increased - assert_eq!( - Assets::total_supply(local_asset_id), - minimum_asset_balance + asset_amount_needed - ); - }); -} - #[test] fn test_foreign_asset_xcm_take_first_trader() { ExtBuilder::::default() @@ -689,71 +611,6 @@ fn test_asset_xcm_take_first_trader_refund_not_possible_since_amount_less_than_e }); } -#[test] -fn test_that_buying_ed_refund_does_not_refund_for_take_first_trader() { - ExtBuilder::::default() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - // We set existential deposit to be identical to the one for Balances first - assert_ok!(Assets::force_create( - RuntimeHelper::root_origin(), - 1.into(), - AccountId::from(ALICE).into(), - true, - ExistentialDeposit::get() - )); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - // We are gonna buy ED - let bought = Weight::from_parts(ExistentialDeposit::get().try_into().unwrap(), 0); - - let asset_location = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap(); - - let amount_bought = WeightToFee::weight_to_fee(&bought); - - assert!( - amount_bought < ExistentialDeposit::get(), - "we are testing what happens when the amount does not exceed ED" - ); - - // We know we will have to buy at least ED, so lets make sure first it will - // fail with a payment of less than ED - let asset: Asset = (asset_location.clone(), amount_bought).into(); - assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive); - - // Now lets buy ED at least - let asset: Asset = (asset_location, ExistentialDeposit::get()).into(); - - // Buy weight should work - assert_ok!(trader.buy_weight(bought, asset.into(), &ctx)); - - // Should return None. We have a specific check making sure we dont go below ED for - // drop payment - assert_eq!(trader.refund_weight(bought, &ctx), None); - - // Drop trader - drop(trader); - - // Make sure author(Alice) has received the amount - assert_eq!(Assets::balance(1, AccountId::from(ALICE)), ExistentialDeposit::get()); - - // We also need to ensure the total supply increased - assert_eq!(Assets::total_supply(1), ExistentialDeposit::get()); - }); -} - #[test] fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() { ExtBuilder::::default() From 14651af4e5995680ef9192f1e9793a7de7fa4b7a Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 14:14:56 +0200 Subject: [PATCH 21/35] fixed or remove some asset-hub-rococo-runtime tests --- .../assets/asset-hub-rococo/tests/tests.rs | 177 ++---------------- 1 file changed, 12 insertions(+), 165 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs index 1b652fcbc2c6b..512efb297629d 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs @@ -402,163 +402,6 @@ fn test_buy_and_refund_weight_with_swap_foreign_asset_xcm_trader() { }) } -#[test] -fn test_foreign_asset_xcm_take_first_trader() { - ExtBuilder::::default() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - let minimum_asset_balance = 3333333_u128; - let foreign_location = Location { - parents: 1, - interior: (Junction::Parachain(1234), Junction::GeneralIndex(12345)).into(), - }; - assert_ok!(ForeignAssets::force_create( - RuntimeHelper::root_origin(), - foreign_location.clone().into(), - AccountId::from(ALICE).into(), - true, - minimum_asset_balance - )); - - // We first mint enough asset for the account to exist for assets - assert_ok!(ForeignAssets::mint( - RuntimeHelper::origin_of(AccountId::from(ALICE)), - foreign_location.clone().into(), - AccountId::from(ALICE).into(), - minimum_asset_balance - )); - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - // We are going to buy 4e9 weight - let bought = Weight::from_parts(4_000_000_000u64, 0); - - // Lets calculate amount needed - let asset_amount_needed - = ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger::charge_weight_in_fungibles( - foreign_location.clone(), - bought - ) - .expect("failed to compute"); - - // Lets pay with: asset_amount_needed + asset_amount_extra - let asset_amount_extra = 100_u128; - let asset: Asset = - (foreign_location.clone(), asset_amount_needed + asset_amount_extra).into(); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Lets buy_weight and make sure buy_weight does not return an error - let unused_assets = trader.buy_weight(bought, asset.into(), &ctx).expect("Expected Ok"); - // Check whether a correct amount of unused assets is returned - assert_ok!(unused_assets - .ensure_contains(&(foreign_location.clone(), asset_amount_extra).into())); - - // Drop trader - drop(trader); - - // Make sure author(Alice) has received the amount - assert_eq!( - ForeignAssets::balance(foreign_location.clone(), AccountId::from(ALICE)), - minimum_asset_balance + asset_amount_needed - ); - - // We also need to ensure the total supply increased - assert_eq!( - ForeignAssets::total_supply(foreign_location), - minimum_asset_balance + asset_amount_needed - ); - }); -} - -#[test] -fn test_asset_xcm_take_first_trader_with_refund() { - ExtBuilder::::default() - .with_collators(vec![AccountId::from(ALICE)]) - .with_session_keys(vec![( - AccountId::from(ALICE), - AccountId::from(ALICE), - SessionKeys { aura: AuraId::from(sp_core::sr25519::Public::from_raw(ALICE)) }, - )]) - .build() - .execute_with(|| { - // We need root origin to create a sufficient asset - // We set existential deposit to be identical to the one for Balances first - assert_ok!(Assets::force_create( - RuntimeHelper::root_origin(), - 1.into(), - AccountId::from(ALICE).into(), - true, - ExistentialDeposit::get() - )); - - // We first mint enough asset for the account to exist for assets - assert_ok!(Assets::mint( - RuntimeHelper::origin_of(AccountId::from(ALICE)), - 1.into(), - AccountId::from(ALICE).into(), - ExistentialDeposit::get() - )); - - let mut trader = ::Trader::new(); - let ctx = XcmContext { origin: None, message_id: XcmHash::default(), topic: None }; - - // Set Alice as block author, who will receive fees - RuntimeHelper::run_to_block(2, AccountId::from(ALICE)); - - // We are going to buy 4e9 weight - let bought = Weight::from_parts(4_000_000_000u64, 0); - let asset_location = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap(); - - // lets calculate amount needed - let amount_bought = WeightToFee::weight_to_fee(&bought); - - let asset: Asset = (asset_location.clone(), amount_bought).into(); - - // Make sure buy_weight does not return an error - assert_ok!(trader.buy_weight(bought, asset.clone().into(), &ctx)); - - // Make sure again buy_weight does return an error - // This assert relies on the fact, that we use `TakeFirstAssetTrader` in `WeightTrader` - // tuple chain, which cannot be called twice - assert_noop!(trader.buy_weight(bought, asset.into(), &ctx), XcmError::TooExpensive); - - // We actually use half of the weight - let weight_used = bought / 2; - - // Make sure refund works. - let amount_refunded = WeightToFee::weight_to_fee(&(bought - weight_used)); - - assert_eq!( - trader.refund_weight(bought - weight_used, &ctx), - Some((asset_location, amount_refunded).into()) - ); - - // Drop trader - drop(trader); - - // We only should have paid for half of the bought weight - let fees_paid = WeightToFee::weight_to_fee(&weight_used); - - assert_eq!( - Assets::balance(1, AccountId::from(ALICE)), - ExistentialDeposit::get() + fees_paid - ); - - // We also need to ensure the total supply increased - assert_eq!(Assets::total_supply(1), ExistentialDeposit::get() + fees_paid); - }); -} - #[test] fn test_asset_xcm_take_first_trader_refund_not_possible_since_amount_less_than_ed() { ExtBuilder::::default() @@ -1076,9 +919,12 @@ mod asset_hub_rococo_tests { AccountId::from([73; 32]), block_author_account.clone(), // receiving WNDs - foreign_asset_create_params, + foreign_asset_create_params.clone(), 1000000000000, - bridging_to_asset_hub_westend, + || { + setup_pool_for_paying_fees_with_foreign_assets(foreign_asset_create_params); + bridging_to_asset_hub_westend() + }, ( [PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX)].into(), GlobalConsensus(ByGenesis(WESTEND_GENESIS_HASH)), @@ -1095,15 +941,16 @@ mod asset_hub_rococo_tests { ); }, || { - // `TakeFirstAssetTrader` puts fees to the block author - assert!( + // check staking pot has at least ED + assert!(Balances::free_balance(&staking_pot) >= ExistentialDeposit::get()); + // check now foreign asset for staking pot + assert_eq!( ForeignAssets::balance( foreign_asset_id_location.clone().into(), - &block_author_account - ) > 0 + &staking_pot + ), + 0 ); - // `SwapFirstAssetTrader` did not work - assert_eq!(Balances::free_balance(&staking_pot), 0); } ) } From cb07b26cb126f145100f0e5ab326c7767ea1e552 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 15:05:29 +0200 Subject: [PATCH 22/35] commented out failing AH westend & rococo tests. I'll investigate the failure later --- .../assets/asset-hub-rococo/src/tests/send.rs | 146 ++++++++-------- .../asset-hub-westend/src/tests/send.rs | 158 ++++++++++-------- 2 files changed, 158 insertions(+), 146 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs index ea8f6c1defba4..827a6cdd5903f 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs @@ -109,76 +109,76 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { /// We tests two things here: /// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset /// - Parachain should be able to create a new Asset at Asset Hub -#[test] -fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { - let para_sovereign_account = AssetHubRococo::sovereign_account_id_of( - AssetHubRococo::sibling_location_of(PenpalA::para_id()), - ); - - // Force create and mint sufficient assets for Parachain's sovereign account - AssetHubRococo::force_create_and_mint_asset( - ASSET_ID, - ASSET_MIN_BALANCE, - true, - para_sovereign_account.clone(), - Some(Weight::from_parts(144_933_000, 3675)), - ASSET_MIN_BALANCE * 1000000000, - ); - - // Just a different `asset_id`` that does not exist yet - let new_asset_id = ASSET_ID + 1; - - // Encoded `create_asset` call to be executed in AssetHub - let call = AssetHubRococo::create_asset_call( - new_asset_id, - ASSET_MIN_BALANCE, - para_sovereign_account.clone(), - ); - - let origin_kind = OriginKind::SovereignAccount; - let fee_amount = ASSET_MIN_BALANCE * 1000000; - let asset = - ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); - - let root_origin = ::RuntimeOrigin::root(); - let system_para_destination = PenpalA::sibling_location_of(AssetHubRococo::para_id()).into(); - let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); - - // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit - AssetHubRococo::fund_accounts(vec![( - para_sovereign_account.clone().into(), - ASSET_HUB_ROCOCO_ED * 10000000000, - )]); - - PenpalA::execute_with(|| { - assert_ok!(::PolkadotXcm::send( - root_origin, - bx!(system_para_destination), - bx!(xcm), - )); - - PenpalA::assert_xcm_pallet_sent(); - }); - - AssetHubRococo::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - AssetHubRococo::assert_xcmp_queue_success(None); - assert_expected_events!( - AssetHubRococo, - vec![ - // Burned the fee - RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { - asset_id: *asset_id == ASSET_ID, - owner: *owner == para_sovereign_account, - balance: *balance == fee_amount, - }, - // Asset created - RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { - asset_id: *asset_id == new_asset_id, - creator: *creator == para_sovereign_account.clone(), - owner: *owner == para_sovereign_account, - }, - ] - ); - }); -} +// #[test] +// fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { +// let para_sovereign_account = AssetHubRococo::sovereign_account_id_of( +// AssetHubRococo::sibling_location_of(PenpalA::para_id()), +// ); +// +// // Force create and mint sufficient assets for Parachain's sovereign account +// AssetHubRococo::force_create_and_mint_asset( +// ASSET_ID, +// ASSET_MIN_BALANCE, +// true, +// para_sovereign_account.clone(), +// Some(Weight::from_parts(144_933_000, 3675)), +// ASSET_MIN_BALANCE * 1000000000, +// ); +// +// // Just a different `asset_id`` that does not exist yet +// let new_asset_id = ASSET_ID + 1; +// +// // Encoded `create_asset` call to be executed in AssetHub +// let call = AssetHubRococo::create_asset_call( +// new_asset_id, +// ASSET_MIN_BALANCE, +// para_sovereign_account.clone(), +// ); +// +// let origin_kind = OriginKind::SovereignAccount; +// let fee_amount = ASSET_MIN_BALANCE * 1000000; +// let asset = +// ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); +// +// let root_origin = ::RuntimeOrigin::root(); +// let system_para_destination = PenpalA::sibling_location_of(AssetHubRococo::para_id()).into(); +// let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); +// +// // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit +// AssetHubRococo::fund_accounts(vec![( +// para_sovereign_account.clone().into(), +// ASSET_HUB_ROCOCO_ED * 10000000000, +// )]); +// +// PenpalA::execute_with(|| { +// assert_ok!(::PolkadotXcm::send( +// root_origin, +// bx!(system_para_destination), +// bx!(xcm), +// )); +// +// PenpalA::assert_xcm_pallet_sent(); +// }); +// +// AssetHubRococo::execute_with(|| { +// type RuntimeEvent = ::RuntimeEvent; +// AssetHubRococo::assert_xcmp_queue_success(None); +// assert_expected_events!( +// AssetHubRococo, +// vec![ +// // Burned the fee +// RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { +// asset_id: *asset_id == ASSET_ID, +// owner: *owner == para_sovereign_account, +// balance: *balance == fee_amount, +// }, +// // Asset created +// RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { +// asset_id: *asset_id == new_asset_id, +// creator: *creator == para_sovereign_account.clone(), +// owner: *owner == para_sovereign_account, +// }, +// ] +// ); +// }); +// } diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs index d4f239df48774..fbb9592c073a1 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs @@ -14,6 +14,7 @@ // limitations under the License. use crate::imports::*; +use crate::create_pool_with_wnd_on; /// Relay Chain should be able to execute `Transact` instructions in System Parachain /// when `OriginKind::Superuser`. @@ -109,76 +110,87 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { /// We tests two things here: /// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset /// - Parachain should be able to create a new Asset at Asset Hub -#[test] -fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { - let para_sovereign_account = AssetHubWestend::sovereign_account_id_of( - AssetHubWestend::sibling_location_of(PenpalA::para_id()), - ); - - // Force create and mint sufficient assets for Parachain's sovereign account - AssetHubWestend::force_create_and_mint_asset( - ASSET_ID, - ASSET_MIN_BALANCE, - true, - para_sovereign_account.clone(), - Some(Weight::from_parts(144_759_000, 3675)), - ASSET_MIN_BALANCE * 1000000000, - ); - - // Just a different `asset_id`` that does not exist yet - let new_asset_id = ASSET_ID + 1; - - // Encoded `create_asset` call to be executed in AssetHub - let call = AssetHubWestend::create_asset_call( - new_asset_id, - ASSET_MIN_BALANCE, - para_sovereign_account.clone(), - ); - - let origin_kind = OriginKind::SovereignAccount; - let fee_amount = ASSET_MIN_BALANCE * 1000000; - let asset = - ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); - - let root_origin = ::RuntimeOrigin::root(); - let system_para_destination = PenpalA::sibling_location_of(AssetHubWestend::para_id()).into(); - let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); - - // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit - AssetHubWestend::fund_accounts(vec![( - para_sovereign_account.clone().into(), - ASSET_HUB_WESTEND_ED * 10000000000, - )]); - - PenpalA::execute_with(|| { - assert_ok!(::PolkadotXcm::send( - root_origin, - bx!(system_para_destination), - bx!(xcm), - )); - - PenpalA::assert_xcm_pallet_sent(); - }); - - AssetHubWestend::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - AssetHubWestend::assert_xcmp_queue_success(None); - assert_expected_events!( - AssetHubWestend, - vec![ - // Burned the fee - RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { - asset_id: *asset_id == ASSET_ID, - owner: *owner == para_sovereign_account, - balance: *balance == fee_amount, - }, - // Asset created - RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { - asset_id: *asset_id == new_asset_id, - creator: *creator == para_sovereign_account.clone(), - owner: *owner == para_sovereign_account, - }, - ] - ); - }); -} +// #[test] +// fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { +// let para_sovereign_account = AssetHubWestend::sovereign_account_id_of( +// AssetHubWestend::sibling_location_of(PenpalA::para_id()), +// ); +// +// // Force create and mint sufficient assets for Parachain's sovereign account +// AssetHubWestend::force_create_and_mint_asset( +// ASSET_ID, +// ASSET_MIN_BALANCE, +// true, +// para_sovereign_account.clone(), +// Some(Weight::from_parts(144_759_000, 3675)), +// ASSET_MIN_BALANCE * 1000000000, +// ); +// +// // Just a different `asset_id`` that does not exist yet +// let new_asset_id = ASSET_ID + 1; +// +// // Encoded `create_asset` call to be executed in AssetHub +// let call = AssetHubWestend::create_asset_call( +// new_asset_id, +// ASSET_MIN_BALANCE, +// para_sovereign_account.clone(), +// ); +// +// let origin_kind = OriginKind::SovereignAccount; +// let fee_amount = ASSET_MIN_BALANCE * 1000000; +// let asset = +// ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); +// +// let asset_location = Location::new( +// 0, +// [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], +// ); +// create_pool_with_wnd_on!( +// AssetHubWestend, +// asset_location, +// false, +// para_sovereign_account.clone() +// ); +// +// let root_origin = ::RuntimeOrigin::root(); +// let system_para_destination = PenpalA::sibling_location_of(AssetHubWestend::para_id()).into(); +// let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); +// +// // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit +// AssetHubWestend::fund_accounts(vec![( +// para_sovereign_account.clone().into(), +// ASSET_HUB_WESTEND_ED * 10000000000, +// )]); +// +// PenpalA::execute_with(|| { +// assert_ok!(::PolkadotXcm::send( +// root_origin, +// bx!(system_para_destination), +// bx!(xcm), +// )); +// +// PenpalA::assert_xcm_pallet_sent(); +// }); +// +// AssetHubWestend::execute_with(|| { +// type RuntimeEvent = ::RuntimeEvent; +// AssetHubWestend::assert_xcmp_queue_success(None); +// assert_expected_events!( +// AssetHubWestend, +// vec![ +// // Burned the fee +// RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { +// asset_id: *asset_id == ASSET_ID, +// owner: *owner == para_sovereign_account, +// balance: *balance == fee_amount, +// }, +// // Asset created +// RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { +// asset_id: *asset_id == new_asset_id, +// creator: *creator == para_sovereign_account.clone(), +// owner: *owner == para_sovereign_account, +// }, +// ] +// ); +// }); +// } From 1f1cb9a02b96b7d07be1e5f4f6397a3f54f9e94c Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 15:06:54 +0200 Subject: [PATCH 23/35] improved commenting out --- .../tests/assets/asset-hub-rococo/src/tests/send.rs | 6 +++--- .../tests/assets/asset-hub-westend/src/tests/send.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs index 827a6cdd5903f..2d01432d03c60 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs @@ -106,9 +106,9 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { }); } -/// We tests two things here: -/// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset -/// - Parachain should be able to create a new Asset at Asset Hub +// /// We tests two things here: +// /// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset +// /// - Parachain should be able to create a new Asset at Asset Hub // #[test] // fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { // let para_sovereign_account = AssetHubRococo::sovereign_account_id_of( diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs index fbb9592c073a1..f79867ca85b21 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs @@ -107,9 +107,9 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { }); } -/// We tests two things here: -/// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset -/// - Parachain should be able to create a new Asset at Asset Hub +// /// We tests two things here: +// /// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset +// /// - Parachain should be able to create a new Asset at Asset Hub // #[test] // fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { // let para_sovereign_account = AssetHubWestend::sovereign_account_id_of( From bc6b98a4310c165e658973de9a23408ae481c4ff Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 15:12:38 +0200 Subject: [PATCH 24/35] removed unused rococo imports --- .../assets/asset-hub-rococo/src/xcm_config.rs | 18 ------------------ .../assets/asset-hub-rococo/tests/tests.rs | 5 ++--- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index 5730c4ca166a3..f0f4f585a5c0c 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -252,7 +252,6 @@ pub type XcmOriginToTransactDispatchOrigin = ( parameter_types! { pub const MaxInstructions: u32 = 100; pub const MaxAssetsIntoHolding: u32 = 64; - pub XcmAssetFeesReceiver: Option = Authorship::author(); } pub struct ParentOrParentsPlurality; @@ -294,23 +293,6 @@ pub type Barrier = TrailingSetTopicAsId< >, >; -/// Multiplier used for dedicated `TakeFirstAssetTrader` with `Assets` instance. -pub type AssetFeeAsExistentialDepositMultiplierFeeCharger = AssetFeeAsExistentialDepositMultiplier< - Runtime, - WeightToFee, - pallet_assets::BalanceToAssetBalance, - TrustBackedAssetsInstance, ->; - -/// Multiplier used for dedicated `TakeFirstAssetTrader` with `ForeignAssets` instance. -pub type ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger = - AssetFeeAsExistentialDepositMultiplier< - Runtime, - WeightToFee, - pallet_assets::BalanceToAssetBalance, - ForeignAssetsInstance, - >; - /// Locations that will not be charged fees in the executor, /// either execution or delivery. /// We only waive fees for system functions, which these locations represent. diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs index 512efb297629d..d5eff619d06a9 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs @@ -20,9 +20,8 @@ use asset_hub_rococo_runtime::{ xcm_config, xcm_config::{ - bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount, - ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, GovernanceLocation, - LocationToAccountId, StakingPot, TokenLocation, TrustBackedAssetsPalletLocation, XcmConfig, + bridging, CheckingAccount, GovernanceLocation, LocationToAccountId, StakingPot, + TokenLocation, TrustBackedAssetsPalletLocation, XcmConfig, }, AllPalletsWithoutSystem, AssetConversion, AssetDeposit, Assets, Balances, Block, CollatorSelection, ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, From 7a78c22f82c2d276c4371665bc166e9bcb685abf Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 15:33:07 +0200 Subject: [PATCH 25/35] fmt --- .../emulated/tests/assets/asset-hub-westend/src/tests/send.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs index f79867ca85b21..1cbd503ebca6d 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs @@ -13,8 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::imports::*; -use crate::create_pool_with_wnd_on; +use crate::{create_pool_with_wnd_on, imports::*}; /// Relay Chain should be able to execute `Transact` instructions in System Parachain /// when `OriginKind::Superuser`. From e30f79cd30a22b0969360d8bb0c22277f3d2fb62 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 15:55:02 +0200 Subject: [PATCH 26/35] removed unused imports from ahw-emulated-chain --- .../runtimes/assets/asset-hub-rococo/src/xcm_config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index f0f4f585a5c0c..496250ba3d2ab 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -14,11 +14,11 @@ // limitations under the License. use super::{ - AccountId, AllPalletsWithSystem, Assets, Authorship, Balance, Balances, BaseDeliveryFee, - CollatorSelection, FeeAssetId, ForeignAssets, ForeignAssetsInstance, ParachainInfo, + AccountId, AllPalletsWithSystem, Assets, Balance, Balances, BaseDeliveryFee, + CollatorSelection, FeeAssetId, ForeignAssets, ParachainInfo, ParachainSystem, PolkadotXcm, PoolAssets, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, ToWestendXcmRouter, TransactionByteFee, - TrustBackedAssetsInstance, Uniques, WeightToFee, XcmpQueue, + Uniques, WeightToFee, XcmpQueue, }; use assets_common::{ matching::{FromNetwork, FromSiblingParachain, IsForeignConcreteAsset, ParentLocation}, From d2c84a8cc70189a7773ce45d3a26cbdc36967b10 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 15:56:02 +0200 Subject: [PATCH 27/35] removed unused imports from ahw-emulated-chain[2] --- .../runtimes/assets/asset-hub-rococo/src/xcm_config.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index 496250ba3d2ab..a22e9ad996219 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -36,14 +36,14 @@ use frame_system::EnsureRoot; use pallet_xcm::{AuthorizedAliasers, XcmPassthrough}; use parachains_common::{ xcm_config::{ - AllSiblingSystemParachains, AssetFeeAsExistentialDepositMultiplier, + AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains, }, TREASURY_PALLET_ID, }; use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_common::xcm_sender::ExponentialPrice; -use sp_runtime::traits::{AccountIdConversion, ConvertInto, TryConvertInto}; +use sp_runtime::traits::{AccountIdConversion, TryConvertInto}; use testnet_parachains_constants::rococo::snowbridge::{ EthereumNetwork, INBOUND_QUEUE_PALLET_INDEX, }; From c17834789380286ccbe554eab5ba47d0d39d36c8 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 16:02:51 +0200 Subject: [PATCH 28/35] fmt --- .../assets/asset-hub-rococo/src/xcm_config.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs index a22e9ad996219..839e58ca9d5fa 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/xcm_config.rs @@ -14,11 +14,10 @@ // limitations under the License. use super::{ - AccountId, AllPalletsWithSystem, Assets, Balance, Balances, BaseDeliveryFee, - CollatorSelection, FeeAssetId, ForeignAssets, ParachainInfo, - ParachainSystem, PolkadotXcm, PoolAssets, Runtime, RuntimeCall, RuntimeEvent, - RuntimeHoldReason, RuntimeOrigin, ToWestendXcmRouter, TransactionByteFee, - Uniques, WeightToFee, XcmpQueue, + AccountId, AllPalletsWithSystem, Assets, Balance, Balances, BaseDeliveryFee, CollatorSelection, + FeeAssetId, ForeignAssets, ParachainInfo, ParachainSystem, PolkadotXcm, PoolAssets, Runtime, + RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, ToWestendXcmRouter, + TransactionByteFee, Uniques, WeightToFee, XcmpQueue, }; use assets_common::{ matching::{FromNetwork, FromSiblingParachain, IsForeignConcreteAsset, ParentLocation}, @@ -36,8 +35,8 @@ use frame_system::EnsureRoot; use pallet_xcm::{AuthorizedAliasers, XcmPassthrough}; use parachains_common::{ xcm_config::{ - AllSiblingSystemParachains, - ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, RelayOrOtherSystemParachains, + AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains, + RelayOrOtherSystemParachains, }, TREASURY_PALLET_ID, }; From 05cf055dcee5a9b0dc83488d207e00e91c97c7bc Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 17:27:41 +0200 Subject: [PATCH 29/35] fixed AHW send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset --- .../asset-hub-westend/src/tests/send.rs | 176 +++++++++--------- 1 file changed, 89 insertions(+), 87 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs index 1cbd503ebca6d..8d0ffe4a7504b 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs @@ -106,90 +106,92 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { }); } -// /// We tests two things here: -// /// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset -// /// - Parachain should be able to create a new Asset at Asset Hub -// #[test] -// fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { -// let para_sovereign_account = AssetHubWestend::sovereign_account_id_of( -// AssetHubWestend::sibling_location_of(PenpalA::para_id()), -// ); -// -// // Force create and mint sufficient assets for Parachain's sovereign account -// AssetHubWestend::force_create_and_mint_asset( -// ASSET_ID, -// ASSET_MIN_BALANCE, -// true, -// para_sovereign_account.clone(), -// Some(Weight::from_parts(144_759_000, 3675)), -// ASSET_MIN_BALANCE * 1000000000, -// ); -// -// // Just a different `asset_id`` that does not exist yet -// let new_asset_id = ASSET_ID + 1; -// -// // Encoded `create_asset` call to be executed in AssetHub -// let call = AssetHubWestend::create_asset_call( -// new_asset_id, -// ASSET_MIN_BALANCE, -// para_sovereign_account.clone(), -// ); -// -// let origin_kind = OriginKind::SovereignAccount; -// let fee_amount = ASSET_MIN_BALANCE * 1000000; -// let asset = -// ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); -// -// let asset_location = Location::new( -// 0, -// [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], -// ); -// create_pool_with_wnd_on!( -// AssetHubWestend, -// asset_location, -// false, -// para_sovereign_account.clone() -// ); -// -// let root_origin = ::RuntimeOrigin::root(); -// let system_para_destination = PenpalA::sibling_location_of(AssetHubWestend::para_id()).into(); -// let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); -// -// // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit -// AssetHubWestend::fund_accounts(vec![( -// para_sovereign_account.clone().into(), -// ASSET_HUB_WESTEND_ED * 10000000000, -// )]); -// -// PenpalA::execute_with(|| { -// assert_ok!(::PolkadotXcm::send( -// root_origin, -// bx!(system_para_destination), -// bx!(xcm), -// )); -// -// PenpalA::assert_xcm_pallet_sent(); -// }); -// -// AssetHubWestend::execute_with(|| { -// type RuntimeEvent = ::RuntimeEvent; -// AssetHubWestend::assert_xcmp_queue_success(None); -// assert_expected_events!( -// AssetHubWestend, -// vec![ -// // Burned the fee -// RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { -// asset_id: *asset_id == ASSET_ID, -// owner: *owner == para_sovereign_account, -// balance: *balance == fee_amount, -// }, -// // Asset created -// RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { -// asset_id: *asset_id == new_asset_id, -// creator: *creator == para_sovereign_account.clone(), -// owner: *owner == para_sovereign_account, -// }, -// ] -// ); -// }); -// } +/// We tests two things here: +/// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset +/// - Parachain should be able to create a new Asset at Asset Hub +#[test] +fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { + let para_sovereign_account = AssetHubWestend::sovereign_account_id_of( + AssetHubWestend::sibling_location_of(PenpalA::para_id()), + ); + + // Force create and mint sufficient assets for Parachain's sovereign account + AssetHubWestend::force_create_and_mint_asset( + ASSET_ID, + ASSET_MIN_BALANCE, + true, + para_sovereign_account.clone(), + Some(Weight::from_parts(144_759_000, 3675)), + ASSET_MIN_BALANCE * 1000000000, + ); + + // Just a different `asset_id`` that does not exist yet + let new_asset_id = ASSET_ID + 1; + + // Encoded `create_asset` call to be executed in AssetHub + let call = AssetHubWestend::create_asset_call( + new_asset_id, + ASSET_MIN_BALANCE, + para_sovereign_account.clone(), + ); + + let origin_kind = OriginKind::SovereignAccount; + let fee_amount = ASSET_MIN_BALANCE * 1000000; + let asset = + ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); + let asset_location = Location::new( + 0, + [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], + ); + + let root_origin = ::RuntimeOrigin::root(); + let system_para_destination = PenpalA::sibling_location_of(AssetHubWestend::para_id()).into(); + let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); + + // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit + AssetHubWestend::fund_accounts(vec![( + para_sovereign_account.clone().into(), + ASSET_HUB_WESTEND_ED * 10000000000, + )]); + + create_pool_with_wnd_on!( + AssetHubWestend, + asset_location, + false, + para_sovereign_account.clone(), + 9_000_000_000_000_000, + 9_000_000_000_000 + ); + + PenpalA::execute_with(|| { + assert_ok!(::PolkadotXcm::send( + root_origin, + bx!(system_para_destination), + bx!(xcm), + )); + + PenpalA::assert_xcm_pallet_sent(); + }); + + AssetHubWestend::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + AssetHubWestend::assert_xcmp_queue_success(None); + assert_expected_events!( + AssetHubWestend, + vec![ + // Burned the fee + RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { + asset_id: *asset_id == ASSET_ID, + owner: *owner == para_sovereign_account, + balance: *balance == fee_amount, + }, + // Asset created + RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { + asset_id: *asset_id == new_asset_id, + creator: *creator == para_sovereign_account.clone(), + owner: *owner == para_sovereign_account, + }, + ] + ); + }); +} From 23d23222c9765cfa4bfa078b5e7491426010f21c Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 17:32:49 +0200 Subject: [PATCH 30/35] removed unused import --- .../parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs index d5eff619d06a9..ffdecbc2dd47c 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/tests/tests.rs @@ -35,7 +35,6 @@ use asset_test_utils::{ }; use codec::{Decode, Encode}; use core::ops::Mul; -use cumulus_primitives_utility::ChargeWeightInFungibles; use frame_support::{ assert_noop, assert_ok, parameter_types, traits::{ From f0edff04976bfd5c999b07f5fcd3056a6037a21b Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 17:38:55 +0200 Subject: [PATCH 31/35] fmt --- .../tests/assets/asset-hub-westend/src/tests/send.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs index 8d0ffe4a7504b..0dd3177dff4c5 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/send.rs @@ -139,10 +139,8 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { let fee_amount = ASSET_MIN_BALANCE * 1000000; let asset = ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); - let asset_location = Location::new( - 0, - [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], - ); + let asset_location = + Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())]); let root_origin = ::RuntimeOrigin::root(); let system_para_destination = PenpalA::sibling_location_of(AssetHubWestend::para_id()).into(); From 66ea765b1e9abc9b8e7ba19df7af2351390343c8 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 17:46:20 +0200 Subject: [PATCH 32/35] fixed AHR send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset test --- .../assets/asset-hub-rococo/src/tests/mod.rs | 77 ++++++++ .../assets/asset-hub-rococo/src/tests/send.rs | 165 ++++++++++-------- 2 files changed, 165 insertions(+), 77 deletions(-) diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs index 75714acb07cd9..0c425a7650716 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/mod.rs @@ -23,3 +23,80 @@ mod swap; mod teleport; mod treasury; mod xcm_fee_estimation; + +#[macro_export] +macro_rules! create_pool_with_roc_on { + // default amounts + ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr ) => { + $crate::create_pool_with_roc_on!( + $chain, + $asset_id, + $is_foreign, + $asset_owner, + 1_000_000_000_000, + 2_000_000_000_000 + ); + }; + + // custom amounts + ( $chain:ident, $asset_id:expr, $is_foreign:expr, $asset_owner:expr, $roc_amount:expr, $asset_amount:expr ) => { + emulated_integration_tests_common::impls::paste::paste! { + <$chain>::execute_with(|| { + type RuntimeEvent = <$chain as Chain>::RuntimeEvent; + let owner = $asset_owner; + let signed_owner = <$chain as Chain>::RuntimeOrigin::signed(owner.clone()); + let roc_location: Location = Parent.into(); + if $is_foreign { + assert_ok!(<$chain as [<$chain Pallet>]>::ForeignAssets::mint( + signed_owner.clone(), + $asset_id.clone().into(), + owner.clone().into(), + 10_000_000_000_000, // For it to have more than enough. + )); + } else { + let asset_id = match $asset_id.interior.last() { + Some(GeneralIndex(id)) => *id as u32, + _ => unreachable!(), + }; + assert_ok!(<$chain as [<$chain Pallet>]>::Assets::mint( + signed_owner.clone(), + asset_id.into(), + owner.clone().into(), + 10_000_000_000_000, // For it to have more than enough. + )); + } + + assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::create_pool( + signed_owner.clone(), + Box::new(roc_location.clone()), + Box::new($asset_id.clone()), + )); + + assert_expected_events!( + $chain, + vec![ + RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::PoolCreated { .. }) => {}, + ] + ); + + assert_ok!(<$chain as [<$chain Pallet>]>::AssetConversion::add_liquidity( + signed_owner, + Box::new(roc_location), + Box::new($asset_id), + $roc_amount, + $asset_amount, + 0, + 0, + owner.into() + )); + + assert_expected_events!( + $chain, + vec![ + RuntimeEvent::AssetConversion(pallet_asset_conversion::Event::LiquidityAdded { .. }) => {}, + ] + ); + }); + } + }; +} diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs index 2d01432d03c60..663615b187ca4 100644 --- a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-rococo/src/tests/send.rs @@ -13,7 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use crate::imports::*; +use crate::{create_pool_with_roc_on, imports::*}; /// Relay Chain should be able to execute `Transact` instructions in System Parachain /// when `OriginKind::Superuser`. @@ -106,79 +106,90 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() { }); } -// /// We tests two things here: -// /// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset -// /// - Parachain should be able to create a new Asset at Asset Hub -// #[test] -// fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { -// let para_sovereign_account = AssetHubRococo::sovereign_account_id_of( -// AssetHubRococo::sibling_location_of(PenpalA::para_id()), -// ); -// -// // Force create and mint sufficient assets for Parachain's sovereign account -// AssetHubRococo::force_create_and_mint_asset( -// ASSET_ID, -// ASSET_MIN_BALANCE, -// true, -// para_sovereign_account.clone(), -// Some(Weight::from_parts(144_933_000, 3675)), -// ASSET_MIN_BALANCE * 1000000000, -// ); -// -// // Just a different `asset_id`` that does not exist yet -// let new_asset_id = ASSET_ID + 1; -// -// // Encoded `create_asset` call to be executed in AssetHub -// let call = AssetHubRococo::create_asset_call( -// new_asset_id, -// ASSET_MIN_BALANCE, -// para_sovereign_account.clone(), -// ); -// -// let origin_kind = OriginKind::SovereignAccount; -// let fee_amount = ASSET_MIN_BALANCE * 1000000; -// let asset = -// ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); -// -// let root_origin = ::RuntimeOrigin::root(); -// let system_para_destination = PenpalA::sibling_location_of(AssetHubRococo::para_id()).into(); -// let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); -// -// // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit -// AssetHubRococo::fund_accounts(vec![( -// para_sovereign_account.clone().into(), -// ASSET_HUB_ROCOCO_ED * 10000000000, -// )]); -// -// PenpalA::execute_with(|| { -// assert_ok!(::PolkadotXcm::send( -// root_origin, -// bx!(system_para_destination), -// bx!(xcm), -// )); -// -// PenpalA::assert_xcm_pallet_sent(); -// }); -// -// AssetHubRococo::execute_with(|| { -// type RuntimeEvent = ::RuntimeEvent; -// AssetHubRococo::assert_xcmp_queue_success(None); -// assert_expected_events!( -// AssetHubRococo, -// vec![ -// // Burned the fee -// RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { -// asset_id: *asset_id == ASSET_ID, -// owner: *owner == para_sovereign_account, -// balance: *balance == fee_amount, -// }, -// // Asset created -// RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { -// asset_id: *asset_id == new_asset_id, -// creator: *creator == para_sovereign_account.clone(), -// owner: *owner == para_sovereign_account, -// }, -// ] -// ); -// }); -// } +/// We tests two things here: +/// - Parachain should be able to send XCM paying its fee at Asset Hub using sufficient asset +/// - Parachain should be able to create a new Asset at Asset Hub +#[test] +fn send_xcm_from_para_to_asset_hub_paying_fee_with_sufficient_asset() { + let para_sovereign_account = AssetHubRococo::sovereign_account_id_of( + AssetHubRococo::sibling_location_of(PenpalA::para_id()), + ); + + // Force create and mint sufficient assets for Parachain's sovereign account + AssetHubRococo::force_create_and_mint_asset( + ASSET_ID, + ASSET_MIN_BALANCE, + true, + para_sovereign_account.clone(), + Some(Weight::from_parts(144_933_000, 3675)), + ASSET_MIN_BALANCE * 1000000000, + ); + + // Just a different `asset_id`` that does not exist yet + let new_asset_id = ASSET_ID + 1; + + // Encoded `create_asset` call to be executed in AssetHub + let call = AssetHubRococo::create_asset_call( + new_asset_id, + ASSET_MIN_BALANCE, + para_sovereign_account.clone(), + ); + + let origin_kind = OriginKind::SovereignAccount; + let fee_amount = ASSET_MIN_BALANCE * 1000000; + let asset = + ([PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())], fee_amount).into(); + let asset_location = + Location::new(0, [PalletInstance(ASSETS_PALLET_ID), GeneralIndex(ASSET_ID.into())]); + + let root_origin = ::RuntimeOrigin::root(); + let system_para_destination = PenpalA::sibling_location_of(AssetHubRococo::para_id()).into(); + let xcm = xcm_transact_paid_execution(call, origin_kind, asset, para_sovereign_account.clone()); + + // SA-of-Penpal-on-AHR needs to have balance to pay for asset creation deposit + AssetHubRococo::fund_accounts(vec![( + para_sovereign_account.clone().into(), + ASSET_HUB_ROCOCO_ED * 10000000000, + )]); + + create_pool_with_roc_on!( + AssetHubRococo, + asset_location, + false, + para_sovereign_account.clone(), + 9_000_000_000_000_000, + 9_000_000_000_000 + ); + + PenpalA::execute_with(|| { + assert_ok!(::PolkadotXcm::send( + root_origin, + bx!(system_para_destination), + bx!(xcm), + )); + + PenpalA::assert_xcm_pallet_sent(); + }); + + AssetHubRococo::execute_with(|| { + type RuntimeEvent = ::RuntimeEvent; + AssetHubRococo::assert_xcmp_queue_success(None); + assert_expected_events!( + AssetHubRococo, + vec![ + // Burned the fee + RuntimeEvent::Assets(pallet_assets::Event::Burned { asset_id, owner, balance }) => { + asset_id: *asset_id == ASSET_ID, + owner: *owner == para_sovereign_account, + balance: *balance == fee_amount, + }, + // Asset created + RuntimeEvent::Assets(pallet_assets::Event::Created { asset_id, creator, owner }) => { + asset_id: *asset_id == new_asset_id, + creator: *creator == para_sovereign_account.clone(), + owner: *owner == para_sovereign_account, + }, + ] + ); + }); +} From 6e4178a3ef83a124283360444ce85c4fdc5611c7 Mon Sep 17 00:00:00 2001 From: ndk Date: Fri, 2 May 2025 17:54:19 +0200 Subject: [PATCH 33/35] fixed prdoc --- prdoc/pr_8376.prdoc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc index 8a1d32787be28..0dff124e0cd98 100644 --- a/prdoc/pr_8376.prdoc +++ b/prdoc/pr_8376.prdoc @@ -1,13 +1,17 @@ -title: 'Stopped using TakeFirstAssetTrader in AH Westend' +title: 'Stopped using TakeFirstAssetTrader in AH Westend and Rococ' doc: - audience: Runtime Dev description: |- - Removed `TakeFirstAssetTrader` from Westend configs. Improved macro, fixed test. + Removed `TakeFirstAssetTrader` from configs. Improved macros, fixed tests. crates: - name: asset-hub-westend-runtime bump: minor +- name: asset-hub-rococo-runtime + bump: minor - name: asset-hub-westend-integration-tests bump: minor +- name: asset-hub-rococo-integration-tests + bump: minor - name: emulated-integration-tests-common bump: minor - name: bridge-hub-westend-integration-tests From 6d130876fc4f5efecb71c95b291328654edb4c71 Mon Sep 17 00:00:00 2001 From: Andrii Date: Fri, 2 May 2025 18:29:22 +0200 Subject: [PATCH 34/35] Update prdoc/pr_8376.prdoc Co-authored-by: Adrian Catangiu --- prdoc/pr_8376.prdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc index 0dff124e0cd98..3816e901b3298 100644 --- a/prdoc/pr_8376.prdoc +++ b/prdoc/pr_8376.prdoc @@ -1,4 +1,4 @@ -title: 'Stopped using TakeFirstAssetTrader in AH Westend and Rococ' +title: 'Remove TakeFirstAssetTrader from AH Westend and Rococo' doc: - audience: Runtime Dev description: |- From 39b93c859ba1862eaa9525d7b8d66cd1503e1c6a Mon Sep 17 00:00:00 2001 From: Adrian Catangiu Date: Fri, 2 May 2025 19:30:23 +0300 Subject: [PATCH 35/35] Update prdoc/pr_8376.prdoc --- prdoc/pr_8376.prdoc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/prdoc/pr_8376.prdoc b/prdoc/pr_8376.prdoc index 3816e901b3298..0427e4129005e 100644 --- a/prdoc/pr_8376.prdoc +++ b/prdoc/pr_8376.prdoc @@ -1,8 +1,12 @@ title: 'Remove TakeFirstAssetTrader from AH Westend and Rococo' doc: -- audience: Runtime Dev +- audience: [Runtime Dev, Runtime User] description: |- - Removed `TakeFirstAssetTrader` from configs. Improved macros, fixed tests. + Removed `TakeFirstAssetTrader` from Asset Hub Westend and Rococo. Improved macros, fixed tests. + This implies asset sufficiency no longer guarantees that weight can also be bought with it. + `SwapFirstAssetTrader` is used instead which will attempt to swap some of the given asset for the + required amount of native asset to buy weight. This may or may not succeed depending on whether + there is a local pool present with enough liquidity to serve the swap. crates: - name: asset-hub-westend-runtime bump: minor