From 2a66c92f128dea7bf23a0deeb1523a9d3c1f854e Mon Sep 17 00:00:00 2001 From: EleisonC Date: Sat, 1 Feb 2025 06:26:32 +0300 Subject: [PATCH] update delivery destination BH-westend --- .../bridge-hubs/bridge-hub-westend/src/lib.rs | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs index 36b565bdca1c..e7a7bc1e982e 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src/lib.rs @@ -995,14 +995,16 @@ impl_runtime_apis! { 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, - >; + 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)> { @@ -1010,9 +1012,9 @@ impl_runtime_apis! { Some(( Asset { fun: Fungible(ExistentialDeposit::get()), - id: AssetId(Parent.into()) + id: AssetId(WestendLocation::get()) }, - Parent.into(), + RandomParaLocation::get(), )) } @@ -1025,8 +1027,8 @@ impl_runtime_apis! { ) -> Option<(Assets, u32, Location, alloc::boxed::Box)> { // BH only supports teleports to system parachain. // Relay/native token can be teleported between BH and Relay. - let native_location = Parent.into(); - let dest = Parent.into(); + let native_location = WestendLocation::get(); + let dest = RandomParaLocation::get(); pallet_xcm::benchmarking::helpers::native_teleport_as_asset_transfer::( native_location, dest @@ -1035,7 +1037,7 @@ impl_runtime_apis! { fn get_asset() -> Asset { Asset { - id: AssetId(Location::parent()), + id: AssetId(WestendLocation::get()), fun: Fungible(ExistentialDeposit::get()), } } @@ -1049,18 +1051,22 @@ impl_runtime_apis! { WestendLocation::get(), ExistentialDeposit::get() ).into()); + pub const RandomParaId: ParaId = ParaId::new(43211234); + pub RandomParaLocation: Location = ParentThen(Parachain(RandomParaId::get().into()).into()).into(); } 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) -> Assets { // just assets according to relay chain. @@ -1076,7 +1082,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;