diff --git a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs index 43b7bf0ba118..f6ca121cab54 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs @@ -1712,27 +1712,21 @@ impl_runtime_apis! { ExistentialDeposit::get() ).into()); pub const RandomParaId: ParaId = ParaId::new(43211234); + pub RandomParaLocation: Location = ParentThen(Parachain(RandomParaId::get().into()).into()).into(); } use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark; impl pallet_xcm::benchmarking::Config for Runtime { - type DeliveryHelper = ( - cumulus_primitives_utility::ToParentDeliveryHelper< - xcm_config::XcmConfig, - ExistentialDepositAsset, - xcm_config::PriceForParentDelivery, - >, - polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< + type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< xcm_config::XcmConfig, ExistentialDepositAsset, PriceForSiblingParachainDelivery, RandomParaId, ParachainSystem, - > - ); + >; fn reachable_dest() -> Option { - Some(Parent.into()) + Some(RandomParaLocation::get()) } fn teleportable_asset_and_dest() -> Option<(Asset, Location)> { @@ -1740,9 +1734,9 @@ impl_runtime_apis! { Some(( Asset { fun: Fungible(ExistentialDeposit::get()), - id: AssetId(Parent.into()) + id: AssetId(TokenLocation::get()) }, - Parent.into(), + RandomParaLocation::get(), )) } @@ -1750,10 +1744,10 @@ impl_runtime_apis! { Some(( Asset { fun: Fungible(ExistentialDeposit::get()), - id: AssetId(Parent.into()) + id: AssetId(TokenLocation::get()) }, // AH can reserve transfer native token to some random parachain. - ParentThen(Parachain(RandomParaId::get().into()).into()).into(), + RandomParaLocation::get(), )) } @@ -1762,10 +1756,10 @@ impl_runtime_apis! { // Transfer to Relay some local AH asset (local-reserve-transfer) while paying // fees using teleported native token. // (We don't care that Relay doesn't accept incoming unknown AH local asset) - let dest = Parent.into(); + let dest = RandomParaLocation::get(); let fee_amount = EXISTENTIAL_DEPOSIT; - let fee_asset: Asset = (Location::parent(), fee_amount).into(); + let fee_asset: Asset = (TokenLocation::get(), fee_amount).into(); let who = frame_benchmarking::whitelisted_caller(); // Give some multiple of the existential deposit @@ -1808,7 +1802,7 @@ impl_runtime_apis! { fn get_asset() -> Asset { Asset { - id: AssetId(Location::parent()), + id: AssetId(TokenLocation::get()), fun: Fungible(ExistentialDeposit::get()), } } @@ -1849,13 +1843,15 @@ impl_runtime_apis! { impl pallet_xcm_benchmarks::Config for Runtime { type XcmConfig = xcm_config::XcmConfig; type AccountIdConverter = xcm_config::LocationToAccountId; - type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper< - xcm_config::XcmConfig, - ExistentialDepositAsset, - xcm_config::PriceForParentDelivery, - >; + type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< + xcm_config::XcmConfig, + ExistentialDepositAsset, + PriceForSiblingParachainDelivery, + RandomParaId, + ParachainSystem, + >; fn valid_destination() -> Result { - Ok(TokenLocation::get()) + Ok(RandomParaLocation::get()) } fn worst_case_holding(depositable_count: u32) -> XcmAssets { // A mix of fungible, non-fungible, and concrete assets. @@ -1882,7 +1878,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(Location, Asset)> = Some(( - TokenLocation::get(), + RandomParaLocation::get(), Asset { fun: Fungible(UNITS), id: AssetId(TokenLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; 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 ecbe1fb0e62a..bea9fed055d0 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1856,7 +1856,6 @@ impl_runtime_apis! { ) -> Result, alloc::string::String> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, BenchmarkError}; use sp_storage::TrackedStorageKey; - use frame_system_benchmarking::Pallet as SystemBench; use frame_system_benchmarking::extensions::Pallet as SystemExtensionsBench; impl frame_system_benchmarking::Config for Runtime { @@ -1871,6 +1870,7 @@ impl_runtime_apis! { } use cumulus_pallet_session_benchmarking::Pallet as SessionBench; + use xcm_config::{MaxAssetsIntoHolding, WestendLocation}; impl cumulus_pallet_session_benchmarking::Config for Runtime {} parameter_types! { @@ -1879,27 +1879,21 @@ impl_runtime_apis! { ExistentialDeposit::get() ).into()); pub const RandomParaId: ParaId = ParaId::new(43211234); + pub RandomParaLocation: Location = ParentThen(Parachain(RandomParaId::get().into()).into()).into(); } use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark; impl pallet_xcm::benchmarking::Config for Runtime { - type DeliveryHelper = ( - cumulus_primitives_utility::ToParentDeliveryHelper< - xcm_config::XcmConfig, - ExistentialDepositAsset, - xcm_config::PriceForParentDelivery, - >, - polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< + type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< xcm_config::XcmConfig, ExistentialDepositAsset, PriceForSiblingParachainDelivery, RandomParaId, ParachainSystem, - > - ); + >; fn reachable_dest() -> Option { - Some(Parent.into()) + Some(RandomParaLocation::get()) } fn teleportable_asset_and_dest() -> Option<(Asset, Location)> { @@ -1907,9 +1901,9 @@ impl_runtime_apis! { Some(( Asset { fun: Fungible(ExistentialDeposit::get()), - id: AssetId(Parent.into()) + id: AssetId(WestendLocation::get()) }, - Parent.into(), + RandomParaLocation::get(), )) } @@ -1917,10 +1911,10 @@ impl_runtime_apis! { Some(( Asset { fun: Fungible(ExistentialDeposit::get()), - id: AssetId(Parent.into()) + id: AssetId(WestendLocation::get()) }, // AH can reserve transfer native token to some random parachain. - ParentThen(Parachain(RandomParaId::get().into()).into()).into(), + RandomParaLocation::get(), )) } @@ -1929,10 +1923,10 @@ impl_runtime_apis! { // Transfer to Relay some local AH asset (local-reserve-transfer) while paying // fees using teleported native token. // (We don't care that Relay doesn't accept incoming unknown AH local asset) - let dest = Parent.into(); + let dest = RandomParaLocation::get(); let fee_amount = EXISTENTIAL_DEPOSIT; - let fee_asset: Asset = (Location::parent(), fee_amount).into(); + let fee_asset: Asset = (WestendLocation::get(), fee_amount).into(); let who = frame_benchmarking::whitelisted_caller(); // Give some multiple of the existential deposit @@ -1975,7 +1969,7 @@ impl_runtime_apis! { fn get_asset() -> Asset { Asset { - id: AssetId(Location::parent()), + id: AssetId(WestendLocation::get()), fun: Fungible(ExistentialDeposit::get()), } } @@ -2015,19 +2009,20 @@ impl_runtime_apis! { } } - use xcm_config::{MaxAssetsIntoHolding, WestendLocation}; use pallet_xcm_benchmarks::asset_instance_from; impl pallet_xcm_benchmarks::Config for Runtime { type XcmConfig = xcm_config::XcmConfig; type AccountIdConverter = xcm_config::LocationToAccountId; - type DeliveryHelper = cumulus_primitives_utility::ToParentDeliveryHelper< - xcm_config::XcmConfig, - ExistentialDepositAsset, - xcm_config::PriceForParentDelivery, - >; + type DeliveryHelper = polkadot_runtime_common::xcm_sender::ToParachainDeliveryHelper< + xcm_config::XcmConfig, + ExistentialDepositAsset, + PriceForSiblingParachainDelivery, + RandomParaId, + ParachainSystem + >; fn valid_destination() -> Result { - Ok(WestendLocation::get()) + Ok(RandomParaLocation::get()) } fn worst_case_holding(depositable_count: u32) -> XcmAssets { // A mix of fungible, non-fungible, and concrete assets. @@ -2054,7 +2049,7 @@ impl_runtime_apis! { parameter_types! { pub const TrustedTeleporter: Option<(Location, Asset)> = Some(( - WestendLocation::get(), + RandomParaLocation::get(), Asset { fun: Fungible(UNITS), id: AssetId(WestendLocation::get()) }, )); pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None; @@ -2183,8 +2178,7 @@ impl_runtime_apis! { } } - impl pallet_revive::ReviveApi for Runtime - { + impl pallet_revive::ReviveApi for Runtime { fn balance(address: H160) -> U256 { Revive::evm_balance(&address) }