diff --git a/Cargo.lock b/Cargo.lock index e7b910f8e310d..be22bc3de9935 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13280,13 +13280,9 @@ dependencies = [ "frame-benchmarking", "frame-support", "frame-system", - "log", "pallet-assets", "pallet-balances", - "pallet-xcm", "parity-scale-codec", - "polkadot-primitives", - "polkadot-runtime-common", "scale-info", "sp-io 39.0.0", "sp-runtime 40.1.0", diff --git a/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/exchange_asset.rs b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/exchange_asset.rs new file mode 100644 index 0000000000000..16fccdb453482 --- /dev/null +++ b/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/exchange_asset.rs @@ -0,0 +1,133 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use crate::{ + create_pool_with_wnd_on, + imports::{ + asset_hub_westend_runtime::{ExistentialDeposit, Runtime}, + *, + }, +}; +use asset_hub_westend_runtime::{ + xcm_config::WestendLocation, Balances, ForeignAssets, PolkadotXcm, RuntimeOrigin, +}; +use emulated_integration_tests_common::{accounts::ALICE, xcm_emulator::TestExt}; +use frame_support::{ + assert_err_ignore_postinfo, assert_ok, + traits::fungible::{Inspect, Mutate}, +}; +use parachains_common::{AccountId, Balance}; +use std::convert::Into; +use xcm::latest::{Assets, Location, Xcm}; + +const UNITS: Balance = 1_000_000_000; + +#[test] +fn exchange_asset_success() { + test_exchange_asset(true, 500 * UNITS, 665 * UNITS, true); +} + +#[test] +fn exchange_asset_insufficient_liquidity() { + test_exchange_asset(true, 1_000 * UNITS, 2_000 * UNITS, false); +} + +#[test] +fn exchange_asset_insufficient_balance() { + test_exchange_asset(true, 5_000 * UNITS, 1_665 * UNITS, false); +} + +#[test] +fn exchange_asset_pool_not_created() { + test_exchange_asset(false, 500 * UNITS, 665 * UNITS, false); +} + +fn test_exchange_asset( + create_pool: bool, + give_amount: Balance, + want_amount: Balance, + should_succeed: bool, +) { + let alice: AccountId = Westend::account_id_of(ALICE); + let native_asset_location = WestendLocation::get(); + let native_asset_id = AssetId(native_asset_location.clone()); + let origin = RuntimeOrigin::signed(alice.clone()); + let asset_location = Location::new(1, [Parachain(2001)]); + let asset_id = AssetId(asset_location.clone()); + + // Setup initial state + AssetHubWestend::execute_with(|| { + assert_ok!(>::mint_into( + &alice, + ExistentialDeposit::get() + (1_000 * UNITS) + )); + + assert_ok!(ForeignAssets::force_create( + RuntimeOrigin::root(), + asset_location.clone().into(), + alice.clone().into(), + true, + 1 + )); + }); + + if create_pool { + create_pool_with_wnd_on!(AssetHubWestend, asset_location.clone(), true, alice.clone()); + } + + // Execute and verify swap + AssetHubWestend::execute_with(|| { + let foreign_balance_before = ForeignAssets::balance(asset_location.clone(), &alice); + let wnd_balance_before = Balances::total_balance(&alice); + + let give: Assets = (native_asset_id, give_amount).into(); + let want: Assets = (asset_id, want_amount).into(); + let xcm = Xcm(vec![ + WithdrawAsset(give.clone().into()), + ExchangeAsset { give: give.into(), want: want.into(), maximal: true }, + DepositAsset { assets: Wild(All), beneficiary: alice.clone().into() }, + ]); + + let result = PolkadotXcm::execute(origin, bx!(xcm::VersionedXcm::from(xcm)), Weight::MAX); + + let foreign_balance_after = ForeignAssets::balance(asset_location, &alice); + let wnd_balance_after = Balances::total_balance(&alice); + + if should_succeed { + assert_ok!(result); + assert!( + foreign_balance_after >= foreign_balance_before + want_amount, + "Expected foreign balance to increase by at least {want_amount} units, got {foreign_balance_after} from {foreign_balance_before}" + ); + assert_eq!( + wnd_balance_after, wnd_balance_before - give_amount, + "Expected WND balance to decrease by {give_amount} units, got {wnd_balance_after} from {wnd_balance_before}" + ); + } else { + assert_err_ignore_postinfo!( + result, + pallet_xcm::Error::::LocalExecutionIncomplete + ); + assert_eq!( + foreign_balance_after, foreign_balance_before, + "Foreign balance changed unexpectedly: got {foreign_balance_after}, expected {foreign_balance_before}" + ); + assert_eq!( + wnd_balance_after, wnd_balance_before, + "WND balance changed unexpectedly: got {wnd_balance_after}, expected {wnd_balance_before}" + ); + } + }); +} 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 0dfe7a85f4c2a..55c3b9ed27393 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 @@ -14,6 +14,7 @@ // limitations under the License. mod claim_assets; +mod exchange_asset; mod fellowship_treasury; mod hybrid_transfers; mod reserve_transfer; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 23328f25c3e0b..142bad4f64f15 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1938,7 +1938,54 @@ impl_runtime_apis! { } fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> { - Err(BenchmarkError::Skip) + let native_asset_location = WestendLocation::get(); + let native_asset_id = AssetId(native_asset_location.clone()); + let (account, _) = pallet_xcm_benchmarks::account_and_location::(1); + let origin = RuntimeOrigin::signed(account.clone()); + let asset_location = Location::new(1, [Parachain(2001)]); + let asset_id = AssetId(asset_location.clone()); + + assert_ok!(>::mint_into( + &account, + ExistentialDeposit::get() + (1_000 * UNITS) + )); + + assert_ok!(ForeignAssets::force_create( + RuntimeOrigin::root(), + asset_location.clone().into(), + account.clone().into(), + true, + 1, + )); + + assert_ok!(ForeignAssets::mint( + origin.clone(), + asset_location.clone().into(), + account.clone().into(), + 3_000 * UNITS, + )); + + assert_ok!(AssetConversion::create_pool( + origin.clone(), + native_asset_location.clone().into(), + asset_location.clone().into(), + )); + + assert_ok!(AssetConversion::add_liquidity( + origin, + native_asset_location.into(), + asset_location.into(), + 1_000 * UNITS, + 2_000 * UNITS, + 1, + 1, + account.into(), + )); + + let give_assets: XcmAssets = (native_asset_id, 500 * UNITS).into(); + let receive_assets: XcmAssets = (asset_id, 660 * UNITS).into(); + + Ok((give_assets, receive_assets)) } fn universal_alias() -> Result<(Location, Junction), BenchmarkError> { diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs index e5b4c1f367a48..a6b5d3d0fd08a 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/mod.rs @@ -124,8 +124,11 @@ impl XcmWeightInfo for AssetHubWestendXcmWeight { fn deposit_reserve_asset(assets: &AssetFilter, _dest: &Location, _xcm: &Xcm<()>) -> Weight { assets.weigh_assets(XcmFungibleWeight::::deposit_reserve_asset()) } - fn exchange_asset(_give: &AssetFilter, _receive: &Assets, _maximal: &bool) -> Weight { - Weight::MAX + fn exchange_asset(give: &AssetFilter, receive: &Assets, _maximal: &bool) -> Weight { + let base_weight = XcmGeneric::::exchange_asset(); + let give_weight = give.weigh_assets(base_weight); + let receive_weight = receive.weigh_assets(base_weight); + give_weight.max(receive_weight) } fn initiate_reserve_withdraw( assets: &AssetFilter, diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs index 0d4b1fbfdabf9..a1c230dea217d 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs @@ -17,9 +17,9 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::generic` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-03-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-03-25, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `539ea74f622e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `3c24194516f3`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 // Executed Command: @@ -68,8 +68,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `246` // Estimated: `6196` - // Minimum execution time: 99_866_000 picoseconds. - Weight::from_parts(104_089_000, 6196) + // Minimum execution time: 100_738_000 picoseconds. + Weight::from_parts(102_746_000, 6196) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -77,15 +77,15 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 625_000 picoseconds. - Weight::from_parts(699_000, 0) + // Minimum execution time: 653_000 picoseconds. + Weight::from_parts(721_000, 0) } pub fn pay_fees() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 6_146_000 picoseconds. - Weight::from_parts(6_457_000, 3593) + // Minimum execution time: 6_108_000 picoseconds. + Weight::from_parts(6_562_000, 3593) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -93,8 +93,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 684_000 picoseconds. - Weight::from_parts(749_000, 0) + // Minimum execution time: 658_000 picoseconds. + Weight::from_parts(706_000, 0) } // Storage: `PolkadotXcm::Queries` (r:1 w:0) // Proof: `PolkadotXcm::Queries` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -102,58 +102,58 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 5_437_000 picoseconds. - Weight::from_parts(5_762_000, 3465) + // Minimum execution time: 5_712_000 picoseconds. + Weight::from_parts(5_871_000, 3465) .saturating_add(T::DbWeight::get().reads(1)) } pub fn transact() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_301_000 picoseconds. - Weight::from_parts(7_556_000, 0) + // Minimum execution time: 6_836_000 picoseconds. + Weight::from_parts(7_253_000, 0) } pub fn refund_surplus() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_685_000 picoseconds. - Weight::from_parts(2_784_000, 0) + // Minimum execution time: 2_778_000 picoseconds. + Weight::from_parts(2_969_000, 0) } pub fn set_error_handler() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 634_000 picoseconds. - Weight::from_parts(713_000, 0) + // Minimum execution time: 651_000 picoseconds. + Weight::from_parts(717_000, 0) } pub fn set_appendix() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 600_000 picoseconds. - Weight::from_parts(693_000, 0) + // Minimum execution time: 654_000 picoseconds. + Weight::from_parts(715_000, 0) } pub fn clear_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 613_000 picoseconds. - Weight::from_parts(664_000, 0) + // Minimum execution time: 635_000 picoseconds. + Weight::from_parts(688_000, 0) } pub fn descend_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 673_000 picoseconds. - Weight::from_parts(727_000, 0) + // Minimum execution time: 708_000 picoseconds. + Weight::from_parts(742_000, 0) } pub fn clear_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 595_000 picoseconds. - Weight::from_parts(674_000, 0) + // Minimum execution time: 694_000 picoseconds. + Weight::from_parts(731_000, 0) } // Storage: `ParachainInfo::ParachainId` (r:1 w:0) // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -175,8 +175,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `246` // Estimated: `6196` - // Minimum execution time: 66_354_000 picoseconds. - Weight::from_parts(68_615_000, 6196) + // Minimum execution time: 67_336_000 picoseconds. + Weight::from_parts(69_034_000, 6196) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -186,8 +186,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `23` // Estimated: `3488` - // Minimum execution time: 8_810_000 picoseconds. - Weight::from_parts(9_020_000, 3488) + // Minimum execution time: 8_830_000 picoseconds. + Weight::from_parts(9_038_000, 3488) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } @@ -195,8 +195,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_258_000 picoseconds. - Weight::from_parts(3_447_000, 0) + // Minimum execution time: 3_234_000 picoseconds. + Weight::from_parts(3_353_000, 0) } // Storage: `PolkadotXcm::VersionNotifyTargets` (r:1 w:1) // Proof: `PolkadotXcm::VersionNotifyTargets` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -216,8 +216,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `42` // Estimated: `3507` - // Minimum execution time: 22_785_000 picoseconds. - Weight::from_parts(23_226_000, 3507) + // Minimum execution time: 22_885_000 picoseconds. + Weight::from_parts(23_427_000, 3507) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -227,44 +227,44 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_642_000 picoseconds. - Weight::from_parts(2_872_000, 0) + // Minimum execution time: 2_729_000 picoseconds. + Weight::from_parts(2_904_000, 0) .saturating_add(T::DbWeight::get().writes(1)) } pub fn burn_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 23_421_000 picoseconds. - Weight::from_parts(23_829_000, 0) + // Minimum execution time: 23_298_000 picoseconds. + Weight::from_parts(23_607_000, 0) } pub fn expect_asset() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_496_000 picoseconds. - Weight::from_parts(6_603_000, 0) + // Minimum execution time: 6_698_000 picoseconds. + Weight::from_parts(6_845_000, 0) } pub fn expect_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_339_000 picoseconds. - Weight::from_parts(3_473_000, 0) + // Minimum execution time: 3_110_000 picoseconds. + Weight::from_parts(3_347_000, 0) } pub fn expect_error() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_284_000 picoseconds. - Weight::from_parts(3_459_000, 0) + // Minimum execution time: 3_211_000 picoseconds. + Weight::from_parts(3_368_000, 0) } pub fn expect_transact_status() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 798_000 picoseconds. - Weight::from_parts(838_000, 0) + // Minimum execution time: 759_000 picoseconds. + Weight::from_parts(853_000, 0) } // Storage: `ParachainInfo::ParachainId` (r:1 w:0) // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -286,8 +286,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `246` // Estimated: `6196` - // Minimum execution time: 72_359_000 picoseconds. - Weight::from_parts(74_856_000, 6196) + // Minimum execution time: 73_562_000 picoseconds. + Weight::from_parts(76_153_000, 6196) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -295,8 +295,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_079_000 picoseconds. - Weight::from_parts(5_323_000, 0) + // Minimum execution time: 5_209_000 picoseconds. + Weight::from_parts(5_363_000, 0) } // Storage: `ParachainInfo::ParachainId` (r:1 w:0) // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -318,8 +318,8 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `246` // Estimated: `6196` - // Minimum execution time: 66_954_000 picoseconds. - Weight::from_parts(69_560_000, 6196) + // Minimum execution time: 67_567_000 picoseconds. + Weight::from_parts(69_822_000, 6196) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -327,22 +327,39 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 662_000 picoseconds. - Weight::from_parts(735_000, 0) + // Minimum execution time: 696_000 picoseconds. + Weight::from_parts(747_000, 0) } pub fn set_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 592_000 picoseconds. - Weight::from_parts(681_000, 0) + // Minimum execution time: 631_000 picoseconds. + Weight::from_parts(685_000, 0) } pub fn clear_topic() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 585_000 picoseconds. - Weight::from_parts(655_000, 0) + // Minimum execution time: 617_000 picoseconds. + Weight::from_parts(689_000, 0) + } + // Storage: `System::Account` (r:1 w:1) + // Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + // Storage: `ForeignAssets::Asset` (r:1 w:1) + // Proof: `ForeignAssets::Asset` (`max_values`: None, `max_size`: Some(808), added: 3283, mode: `MaxEncodedLen`) + // Storage: `ForeignAssets::Account` (r:1 w:1) + // Proof: `ForeignAssets::Account` (`max_values`: None, `max_size`: Some(732), added: 3207, mode: `MaxEncodedLen`) + // Storage: `ForeignAssetsFreezer::FrozenBalances` (r:1 w:0) + // Proof: `ForeignAssetsFreezer::FrozenBalances` (`max_values`: None, `max_size`: Some(682), added: 3157, mode: `MaxEncodedLen`) + pub fn exchange_asset() -> Weight { + // Proof Size summary in bytes: + // Measured: `498` + // Estimated: `4273` + // Minimum execution time: 81_324_000 picoseconds. + Weight::from_parts(83_920_000, 4273) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) } // Storage: `ParachainInfo::ParachainId` (r:1 w:0) // Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) @@ -350,23 +367,23 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1489` - // Minimum execution time: 5_229_000 picoseconds. - Weight::from_parts(5_466_000, 1489) + // Minimum execution time: 5_200_000 picoseconds. + Weight::from_parts(5_384_000, 1489) .saturating_add(T::DbWeight::get().reads(1)) } pub fn set_fees_mode() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 594_000 picoseconds. - Weight::from_parts(663_000, 0) + // Minimum execution time: 642_000 picoseconds. + Weight::from_parts(691_000, 0) } pub fn unpaid_execution() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 631_000 picoseconds. - Weight::from_parts(695_000, 0) + // Minimum execution time: 666_000 picoseconds. + Weight::from_parts(718_000, 0) } pub fn alias_origin() -> Weight { // Proof Size summary in bytes: @@ -379,7 +396,7 @@ impl WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 713_000 picoseconds. - Weight::from_parts(776_000, 0) + // Minimum execution time: 676_000 picoseconds. + Weight::from_parts(738_000, 0) } } diff --git a/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml b/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml index e09ebb8bc598d..2da02b60ef846 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml +++ b/polkadot/xcm/pallet-xcm-benchmarks/Cargo.toml @@ -23,18 +23,12 @@ xcm-executor.workspace = true frame-benchmarking.workspace = true xcm.workspace = true xcm-builder.workspace = true -log = { workspace = true, default-features = true } [dev-dependencies] pallet-balances = { default-features = true, path = "../../../substrate/frame/balances" } pallet-assets = { default-features = true, path = "../../../substrate/frame/assets" } sp-tracing = { default-features = true, path = "../../../substrate/primitives/tracing" } xcm = { default-features = true, path = "..", package = "staging-xcm" } -# temp -pallet-xcm = { default-features = true, path = "../pallet-xcm" } -polkadot-runtime-common = { default-features = true, path = "../../runtime/common" } -# westend-runtime = { path = "../../runtime/westend", features = ["runtime-benchmarks"] } -polkadot-primitives = { default-features = true, path = "../../primitives" } [features] default = ["std"] @@ -43,7 +37,6 @@ std = [ "frame-benchmarking/std", "frame-support/std", "frame-system/std", - "log/std", "scale-info/std", "sp-io/std", "sp-runtime/std", diff --git a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs index 3f37f85b7e26b..b8553e587ff0c 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs @@ -594,7 +594,7 @@ benchmarks! { }: { executor.bench_process(xcm)?; } verify { - assert_eq!(executor.holding(), &want.into()); + assert!(executor.holding().contains(&want.into())); } universal_origin { diff --git a/prdoc/pr_8081.prdoc b/prdoc/pr_8081.prdoc new file mode 100644 index 0000000000000..8e193411d806a --- /dev/null +++ b/prdoc/pr_8081.prdoc @@ -0,0 +1,10 @@ +title: Add expensive scenario for asset exchange +doc: +- audience: Runtime Dev + description: |- + This PR introduces an implementation for `worst_case_asset_exchange()` in the `AssetHubWestend` benchmarking setup. +crates: +- name: asset-hub-westend-runtime + bump: patch +- name: pallet-xcm-benchmarks + bump: patch