Skip to content
Snippets Groups Projects
Unverified Commit e192b764 authored by Branislav Kontur's avatar Branislav Kontur Committed by GitHub
Browse files

Avoid using `xcm::v4` and use latest instead for AssetHub benchmarks (#4567)

parent f469fbfb
No related merge requests found
Pipeline #477647 waiting for manual action with stages
in 1 hour, 9 minutes, and 13 seconds
...@@ -93,8 +93,8 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody}; ...@@ -93,8 +93,8 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
use xcm::latest::prelude::{ use xcm::latest::prelude::{
Asset, Fungible, Here, InteriorLocation, Junction, Junction::*, Location, NetworkId, Asset, Assets as XcmAssets, Fungible, Here, InteriorLocation, Junction, Junction::*, Location,
NonFungible, Parent, ParentThen, Response, XCM_VERSION, NetworkId, NonFungible, Parent, ParentThen, Response, XCM_VERSION,
}; };
use xcm::{ use xcm::{
latest::prelude::{AssetId, BodyId}, latest::prelude::{AssetId, BodyId},
...@@ -1535,7 +1535,7 @@ impl_runtime_apis! { ...@@ -1535,7 +1535,7 @@ impl_runtime_apis! {
} }
fn set_up_complex_asset_transfer( fn set_up_complex_asset_transfer(
) -> Option<(xcm::v4::Assets, u32, Location, Box<dyn FnOnce()>)> { ) -> Option<(XcmAssets, u32, Location, Box<dyn FnOnce()>)> {
// Transfer to Relay some local AH asset (local-reserve-transfer) while paying // Transfer to Relay some local AH asset (local-reserve-transfer) while paying
// fees using teleported native token. // fees using teleported native token.
// (We don't care that Relay doesn't accept incoming unknown AH local asset) // (We don't care that Relay doesn't accept incoming unknown AH local asset)
...@@ -1566,7 +1566,7 @@ impl_runtime_apis! { ...@@ -1566,7 +1566,7 @@ impl_runtime_apis! {
); );
let transfer_asset: Asset = (asset_location, asset_amount).into(); let transfer_asset: Asset = (asset_location, asset_amount).into();
let assets: xcm::v4::Assets = vec![fee_asset.clone(), transfer_asset].into(); let assets: XcmAssets = vec![fee_asset.clone(), transfer_asset].into();
let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 }; let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 };
// verify transferred successfully // verify transferred successfully
...@@ -1634,7 +1634,7 @@ impl_runtime_apis! { ...@@ -1634,7 +1634,7 @@ impl_runtime_apis! {
fn valid_destination() -> Result<Location, BenchmarkError> { fn valid_destination() -> Result<Location, BenchmarkError> {
Ok(TokenLocation::get()) Ok(TokenLocation::get())
} }
fn worst_case_holding(depositable_count: u32) -> xcm::v4::Assets { fn worst_case_holding(depositable_count: u32) -> XcmAssets {
// A mix of fungible, non-fungible, and concrete assets. // A mix of fungible, non-fungible, and concrete assets.
let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count; let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count;
let holding_fungibles = holding_non_fungibles.saturating_sub(2); // -2 for two `iter::once` bellow let holding_fungibles = holding_non_fungibles.saturating_sub(2); // -2 for two `iter::once` bellow
...@@ -1695,7 +1695,7 @@ impl_runtime_apis! { ...@@ -1695,7 +1695,7 @@ impl_runtime_apis! {
(0u64, Response::Version(Default::default())) (0u64, Response::Version(Default::default()))
} }
fn worst_case_asset_exchange() -> Result<(xcm::v4::Assets, xcm::v4::Assets), BenchmarkError> { fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> {
Err(BenchmarkError::Skip) Err(BenchmarkError::Skip)
} }
...@@ -1714,9 +1714,9 @@ impl_runtime_apis! { ...@@ -1714,9 +1714,9 @@ impl_runtime_apis! {
Ok(TokenLocation::get()) Ok(TokenLocation::get())
} }
fn claimable_asset() -> Result<(Location, Location, xcm::v4::Assets), BenchmarkError> { fn claimable_asset() -> Result<(Location, Location, XcmAssets), BenchmarkError> {
let origin = TokenLocation::get(); let origin = TokenLocation::get();
let assets: xcm::v4::Assets = (TokenLocation::get(), 1_000 * UNITS).into(); let assets: XcmAssets = (TokenLocation::get(), 1_000 * UNITS).into();
let ticket = Location { parents: 0, interior: Here }; let ticket = Location { parents: 0, interior: Here };
Ok((origin, ticket, assets)) Ok((origin, ticket, assets))
} }
......
...@@ -95,8 +95,8 @@ use xcm::latest::prelude::AssetId; ...@@ -95,8 +95,8 @@ use xcm::latest::prelude::AssetId;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
use xcm::latest::prelude::{ use xcm::latest::prelude::{
Asset, Fungible, Here, InteriorLocation, Junction, Junction::*, Location, NetworkId, Asset, Assets as XcmAssets, Fungible, Here, InteriorLocation, Junction, Junction::*, Location,
NonFungible, Parent, ParentThen, Response, XCM_VERSION, NetworkId, NonFungible, Parent, ParentThen, Response, XCM_VERSION,
}; };
use xcm_fee_payment_runtime_api::{ use xcm_fee_payment_runtime_api::{
...@@ -1629,7 +1629,7 @@ impl_runtime_apis! { ...@@ -1629,7 +1629,7 @@ impl_runtime_apis! {
} }
fn set_up_complex_asset_transfer( fn set_up_complex_asset_transfer(
) -> Option<(xcm::v4::Assets, u32, Location, Box<dyn FnOnce()>)> { ) -> Option<(XcmAssets, u32, Location, Box<dyn FnOnce()>)> {
// Transfer to Relay some local AH asset (local-reserve-transfer) while paying // Transfer to Relay some local AH asset (local-reserve-transfer) while paying
// fees using teleported native token. // fees using teleported native token.
// (We don't care that Relay doesn't accept incoming unknown AH local asset) // (We don't care that Relay doesn't accept incoming unknown AH local asset)
...@@ -1660,7 +1660,7 @@ impl_runtime_apis! { ...@@ -1660,7 +1660,7 @@ impl_runtime_apis! {
); );
let transfer_asset: Asset = (asset_location, asset_amount).into(); let transfer_asset: Asset = (asset_location, asset_amount).into();
let assets: xcm::v4::Assets = vec![fee_asset.clone(), transfer_asset].into(); let assets: XcmAssets = vec![fee_asset.clone(), transfer_asset].into();
let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 }; let fee_index = if assets.get(0).unwrap().eq(&fee_asset) { 0 } else { 1 };
// verify transferred successfully // verify transferred successfully
...@@ -1733,7 +1733,7 @@ impl_runtime_apis! { ...@@ -1733,7 +1733,7 @@ impl_runtime_apis! {
fn valid_destination() -> Result<Location, BenchmarkError> { fn valid_destination() -> Result<Location, BenchmarkError> {
Ok(WestendLocation::get()) Ok(WestendLocation::get())
} }
fn worst_case_holding(depositable_count: u32) -> xcm::v4::Assets { fn worst_case_holding(depositable_count: u32) -> XcmAssets {
// A mix of fungible, non-fungible, and concrete assets. // A mix of fungible, non-fungible, and concrete assets.
let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count; let holding_non_fungibles = MaxAssetsIntoHolding::get() / 2 - depositable_count;
let holding_fungibles = holding_non_fungibles - 2; // -2 for two `iter::once` bellow let holding_fungibles = holding_non_fungibles - 2; // -2 for two `iter::once` bellow
...@@ -1794,7 +1794,7 @@ impl_runtime_apis! { ...@@ -1794,7 +1794,7 @@ impl_runtime_apis! {
(0u64, Response::Version(Default::default())) (0u64, Response::Version(Default::default()))
} }
fn worst_case_asset_exchange() -> Result<(xcm::v4::Assets, xcm::v4::Assets), BenchmarkError> { fn worst_case_asset_exchange() -> Result<(XcmAssets, XcmAssets), BenchmarkError> {
Err(BenchmarkError::Skip) Err(BenchmarkError::Skip)
} }
...@@ -1813,9 +1813,9 @@ impl_runtime_apis! { ...@@ -1813,9 +1813,9 @@ impl_runtime_apis! {
Ok(WestendLocation::get()) Ok(WestendLocation::get())
} }
fn claimable_asset() -> Result<(Location, Location, xcm::v4::Assets), BenchmarkError> { fn claimable_asset() -> Result<(Location, Location, XcmAssets), BenchmarkError> {
let origin = WestendLocation::get(); let origin = WestendLocation::get();
let assets: xcm::v4::Assets = (AssetId(WestendLocation::get()), 1_000 * UNITS).into(); let assets: XcmAssets = (AssetId(WestendLocation::get()), 1_000 * UNITS).into();
let ticket = Location { parents: 0, interior: Here }; let ticket = Location { parents: 0, interior: Here };
Ok((origin, ticket, assets)) Ok((origin, ticket, assets))
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment