Skip to content

Commit

Permalink
update delivery destination BH-westend
Browse files Browse the repository at this point in the history
  • Loading branch information
EleisonC committed Feb 1, 2025
1 parent ef2a128 commit 2a66c92
Showing 1 changed file with 24 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -995,24 +995,26 @@ 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<Location> {
Some(Parent.into())
Some(RandomParaLocation::get())
}

fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
// Relay/native token can be teleported between BH and Relay.
Some((
Asset {
fun: Fungible(ExistentialDeposit::get()),
id: AssetId(Parent.into())
id: AssetId(WestendLocation::get())
},
Parent.into(),
RandomParaLocation::get(),
))
}

Expand All @@ -1025,8 +1027,8 @@ impl_runtime_apis! {
) -> Option<(Assets, u32, Location, alloc::boxed::Box<dyn FnOnce()>)> {
// 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::<Runtime>(
native_location,
dest
Expand All @@ -1035,7 +1037,7 @@ impl_runtime_apis! {

fn get_asset() -> Asset {
Asset {
id: AssetId(Location::parent()),
id: AssetId(WestendLocation::get()),
fun: Fungible(ExistentialDeposit::get()),
}
}
Expand All @@ -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<Location, BenchmarkError> {
Ok(WestendLocation::get())
Ok(RandomParaLocation::get())
}
fn worst_case_holding(_depositable_count: u32) -> Assets {
// just assets according to relay chain.
Expand All @@ -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;
Expand Down

0 comments on commit 2a66c92

Please sign in to comment.