Skip to content

Commit

Permalink
update asset destination for BH-rococo runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
EleisonC committed Feb 1, 2025
1 parent 47c442b commit 4be4648
Showing 1 changed file with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1105,24 +1105,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(TokenLocation::get())
},
Parent.into(),
RandomParaLocation::get(),
))
}

Expand All @@ -1135,8 +1137,8 @@ impl_runtime_apis! {
) -> Option<(Assets, u32, Location, 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 = TokenLocation::get();
let dest = RandomParaLocation::get();
pallet_xcm::benchmarking::helpers::native_teleport_as_asset_transfer::<Runtime>(
native_location,
dest
Expand All @@ -1159,18 +1161,22 @@ impl_runtime_apis! {
TokenLocation::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(TokenLocation::get())
Ok(RandomParaLocation::get())
}
fn worst_case_holding(_depositable_count: u32) -> Assets {
// just concrete assets according to relay chain.
Expand All @@ -1186,7 +1192,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;
Expand Down

0 comments on commit 4be4648

Please sign in to comment.