Skip to content

Commit e192b76

Browse files
authored
Avoid using xcm::v4 and use latest instead for AssetHub benchmarks (#4567)
1 parent f469fbf commit e192b76

File tree

2 files changed

+16
-16
lines changed
  • cumulus/parachains/runtimes/assets

2 files changed

+16
-16
lines changed

cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
9393
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
9494
#[cfg(feature = "runtime-benchmarks")]
9595
use xcm::latest::prelude::{
96-
Asset, Fungible, Here, InteriorLocation, Junction, Junction::*, Location, NetworkId,
97-
NonFungible, Parent, ParentThen, Response, XCM_VERSION,
96+
Asset, Assets as XcmAssets, Fungible, Here, InteriorLocation, Junction, Junction::*, Location,
97+
NetworkId, NonFungible, Parent, ParentThen, Response, XCM_VERSION,
9898
};
9999
use xcm::{
100100
latest::prelude::{AssetId, BodyId},
@@ -1535,7 +1535,7 @@ impl_runtime_apis! {
15351535
}
15361536

15371537
fn set_up_complex_asset_transfer(
1538-
) -> Option<(xcm::v4::Assets, u32, Location, Box<dyn FnOnce()>)> {
1538+
) -> Option<(XcmAssets, u32, Location, Box<dyn FnOnce()>)> {
15391539
// Transfer to Relay some local AH asset (local-reserve-transfer) while paying
15401540
// fees using teleported native token.
15411541
// (We don't care that Relay doesn't accept incoming unknown AH local asset)
@@ -1566,7 +1566,7 @@ impl_runtime_apis! {
15661566
);
15671567
let transfer_asset: Asset = (asset_location, asset_amount).into();
15681568

1569-
let assets: xcm::v4::Assets = vec![fee_asset.clone(), transfer_asset].into();
1569+
let assets: XcmAssets = vec![fee_asset.clone(), transfer_asset].into();
15701570
let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 };
15711571

15721572
// verify transferred successfully
@@ -1634,7 +1634,7 @@ impl_runtime_apis! {
16341634
fn valid_destination() -> Result<Location, BenchmarkError> {
16351635
Ok(TokenLocation::get())
16361636
}
1637-
fn worst_case_holding(depositable_count: u32) -> xcm::v4::Assets {
1637+
fn worst_case_holding(depositable_count: u32) -> XcmAssets {
16381638
// A mix of fungible, non-fungible, and concrete assets.
16391639
let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count;
16401640
let holding_fungibles = holding_non_fungibles.saturating_sub(2); // -2 for two `iter::once` bellow
@@ -1695,7 +1695,7 @@ impl_runtime_apis! {
16951695
(0u64, Response::Version(Default::default()))
16961696
}
16971697

1698-
fn worst_case_asset_exchange() -> Result<(xcm::v4::Assets, xcm::v4::Assets), BenchmarkError> {
1698+
fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> {
16991699
Err(BenchmarkError::Skip)
17001700
}
17011701

@@ -1714,9 +1714,9 @@ impl_runtime_apis! {
17141714
Ok(TokenLocation::get())
17151715
}
17161716

1717-
fn claimable_asset() -> Result<(Location, Location, xcm::v4::Assets), BenchmarkError> {
1717+
fn claimable_asset() -> Result<(Location, Location, XcmAssets), BenchmarkError> {
17181718
let origin = TokenLocation::get();
1719-
let assets: xcm::v4::Assets = (TokenLocation::get(), 1_000 * UNITS).into();
1719+
let assets: XcmAssets = (TokenLocation::get(), 1_000 * UNITS).into();
17201720
let ticket = Location { parents: 0, interior: Here };
17211721
Ok((origin, ticket, assets))
17221722
}

cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ use xcm::latest::prelude::AssetId;
9595

9696
#[cfg(feature = "runtime-benchmarks")]
9797
use xcm::latest::prelude::{
98-
Asset, Fungible, Here, InteriorLocation, Junction, Junction::*, Location, NetworkId,
99-
NonFungible, Parent, ParentThen, Response, XCM_VERSION,
98+
Asset, Assets as XcmAssets, Fungible, Here, InteriorLocation, Junction, Junction::*, Location,
99+
NetworkId, NonFungible, Parent, ParentThen, Response, XCM_VERSION,
100100
};
101101

102102
use xcm_fee_payment_runtime_api::{
@@ -1629,7 +1629,7 @@ impl_runtime_apis! {
16291629
}
16301630

16311631
fn set_up_complex_asset_transfer(
1632-
) -> Option<(xcm::v4::Assets, u32, Location, Box<dyn FnOnce()>)> {
1632+
) -> Option<(XcmAssets, u32, Location, Box<dyn FnOnce()>)> {
16331633
// Transfer to Relay some local AH asset (local-reserve-transfer) while paying
16341634
// fees using teleported native token.
16351635
// (We don't care that Relay doesn't accept incoming unknown AH local asset)
@@ -1660,7 +1660,7 @@ impl_runtime_apis! {
16601660
);
16611661
let transfer_asset: Asset = (asset_location, asset_amount).into();
16621662

1663-
let assets: xcm::v4::Assets = vec![fee_asset.clone(), transfer_asset].into();
1663+
let assets: XcmAssets = vec![fee_asset.clone(), transfer_asset].into();
16641664
let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 };
16651665

16661666
// verify transferred successfully
@@ -1733,7 +1733,7 @@ impl_runtime_apis! {
17331733
fn valid_destination() -> Result<Location, BenchmarkError> {
17341734
Ok(WestendLocation::get())
17351735
}
1736-
fn worst_case_holding(depositable_count: u32) -> xcm::v4::Assets {
1736+
fn worst_case_holding(depositable_count: u32) -> XcmAssets {
17371737
// A mix of fungible, non-fungible, and concrete assets.
17381738
let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count;
17391739
let holding_fungibles = holding_non_fungibles - 2; // -2 for two `iter::once` bellow
@@ -1794,7 +1794,7 @@ impl_runtime_apis! {
17941794
(0u64, Response::Version(Default::default()))
17951795
}
17961796

1797-
fn worst_case_asset_exchange() -> Result<(xcm::v4::Assets, xcm::v4::Assets), BenchmarkError> {
1797+
fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> {
17981798
Err(BenchmarkError::Skip)
17991799
}
18001800

@@ -1813,9 +1813,9 @@ impl_runtime_apis! {
18131813
Ok(WestendLocation::get())
18141814
}
18151815

1816-
fn claimable_asset() -> Result<(Location, Location, xcm::v4::Assets), BenchmarkError> {
1816+
fn claimable_asset() -> Result<(Location, Location, XcmAssets), BenchmarkError> {
18171817
let origin = WestendLocation::get();
1818-
let assets: xcm::v4::Assets = (AssetId(WestendLocation::get()), 1_000 * UNITS).into();
1818+
let assets: XcmAssets = (AssetId(WestendLocation::get()), 1_000 * UNITS).into();
18191819
let ticket = Location { parents: 0, interior: Here };
18201820
Ok((origin, ticket, assets))
18211821
}

0 commit comments

Comments
 (0)