Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch runtimes benchmarking for delivering to sibling parachains instead of Parent #7321

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
94b6732
switch destination Parent to AH
EleisonC Jan 23, 2025
81eeb4f
fix fee assetID
EleisonC Jan 23, 2025
b09562a
Merge branch 'master' into testnet-sibling-parachains-benchmarking-setup
EleisonC Jan 23, 2025
a4e2471
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
24fc618
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
c0124ca
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
3be121b
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
501f0f4
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
5016e26
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
f1cc6ff
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
f73588f
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
a7b9156
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
1d54c60
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
e50332c
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
4df3a83
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
3ea101a
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
7c2d109
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
07ba775
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
41993ac
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
EleisonC Jan 27, 2025
5df1895
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/xcm_c…
EleisonC Jan 27, 2025
04ba860
refactor to ToParachainDeliveryHelper
EleisonC Jan 27, 2025
7617aa6
refactor asset-hub-rococo
EleisonC Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ impl cumulus_pallet_aura_ext::Config for Runtime {}

parameter_types! {
/// The asset ID for the asset that we use to pay for message delivery fees.
pub FeeAssetId: AssetId = AssetId(xcm_config::WestendLocation::get());
pub FeeAssetId: AssetId = AssetId(xcm_config::AssetHubWestend::get());
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
/// The base fee for the message delivery fees.
pub const BaseDeliveryFee: u128 = CENTS.saturating_mul(3);
}
Expand Down Expand Up @@ -1499,7 +1499,7 @@ impl_runtime_apis! {
fn metadata_versions() -> alloc::vec::Vec<u32> {
Runtime::metadata_versions()
}
}
};

impl sp_block_builder::BlockBuilder<Block> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
Expand Down Expand Up @@ -1856,7 +1856,6 @@ impl_runtime_apis! {
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, 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 {
Expand All @@ -1871,14 +1870,15 @@ impl_runtime_apis! {
}

use cumulus_pallet_session_benchmarking::Pallet as SessionBench;
use xcm_config::{MaxAssetsIntoHolding, WestendLocation, AssetHubWestend, AssetHubId};
impl cumulus_pallet_session_benchmarking::Config for Runtime {}

parameter_types! {
pub ExistentialDepositAsset: Option<Asset> = Some((
WestendLocation::get(),
AssetHubWestend::get(),
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
ExistentialDeposit::get()
).into());
pub const RandomParaId: ParaId = ParaId::new(43211234);
pub const SiblingAssetHubId: ParaId = ParaId::new(AssetHubId::get());
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
}

use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsicsBenchmark;
Expand All @@ -1893,34 +1893,34 @@ impl_runtime_apis! {
xcm_config::XcmConfig,
ExistentialDepositAsset,
PriceForSiblingParachainDelivery,
RandomParaId,
SiblingAssetHubId,
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
ParachainSystem,
>
);

fn reachable_dest() -> Option<Location> {
Some(Parent.into())
Some(AssetHubWestend::get())
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
}

fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
// Relay/native token can be teleported between AH and Relay.
Some((
Asset {
fun: Fungible(ExistentialDeposit::get()),
id: AssetId(Parent.into())
id: AssetId(AssetHubWestend::get())
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
},
Parent.into(),
AssetHubWestend::get(),
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
))
}

fn reserve_transferable_asset_and_dest() -> Option<(Asset, Location)> {
Some((
Asset {
fun: Fungible(ExistentialDeposit::get()),
id: AssetId(Parent.into())
id: AssetId(AssetHubWestend::get())
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
},
// AH can reserve transfer native token to some random parachain.
ParentThen(Parachain(RandomParaId::get().into()).into()).into(),
AssetHubWestend::get(),
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
))
}

Expand All @@ -1929,10 +1929,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 = AssetHubWestend::get();
EleisonC marked this conversation as resolved.
Show resolved Hide resolved

let fee_amount = EXISTENTIAL_DEPOSIT;
let fee_asset: Asset = (Location::parent(), fee_amount).into();
let fee_asset: Asset = (AssetHubWestend::get(), fee_amount).into();
EleisonC marked this conversation as resolved.
Show resolved Hide resolved

let who = frame_benchmarking::whitelisted_caller();
// Give some multiple of the existential deposit
Expand Down Expand Up @@ -1975,7 +1975,7 @@ impl_runtime_apis! {

fn get_asset() -> Asset {
Asset {
id: AssetId(Location::parent()),
id: AssetId(AssetHubWestend::get()),
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
fun: Fungible(ExistentialDeposit::get()),
}
}
Expand Down Expand Up @@ -2015,19 +2015,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,
SiblingAssetHubId,
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
ParachainSystem
>;
fn valid_destination() -> Result<Location, BenchmarkError> {
Ok(WestendLocation::get())
Ok(AssetHubWestend::get())
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
}
fn worst_case_holding(depositable_count: u32) -> XcmAssets {
// A mix of fungible, non-fungible, and concrete assets.
Expand All @@ -2042,7 +2043,7 @@ impl_runtime_apis! {
}
})
.chain(core::iter::once(Asset { id: AssetId(Here.into()), fun: Fungible(u128::MAX) }))
.chain(core::iter::once(Asset { id: AssetId(WestendLocation::get()), fun: Fungible(1_000_000 * UNITS) }))
.chain(core::iter::once(Asset { id: AssetId(AssetHubWestend::get()), fun: Fungible(1_000_000 * UNITS) }))
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
.chain((0..holding_non_fungibles).map(|i| Asset {
id: AssetId(GeneralIndex(i as u128).into()),
fun: NonFungible(asset_instance_from(i)),
Expand All @@ -2054,8 +2055,8 @@ impl_runtime_apis! {

parameter_types! {
pub const TrustedTeleporter: Option<(Location, Asset)> = Some((
WestendLocation::get(),
Asset { fun: Fungible(UNITS), id: AssetId(WestendLocation::get()) },
AssetHubWestend::get(),
Asset { fun: Fungible(UNITS), id: AssetId(AssetHubWestend::get()) },
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
));
pub const CheckedAccount: Option<(AccountId, xcm_builder::MintLocation)> = None;
// AssetHubWestend trusts AssetHubRococo as reserve for ROCs
Expand Down Expand Up @@ -2183,8 +2184,7 @@ impl_runtime_apis! {
}
}

impl pallet_revive::ReviveApi<Block, AccountId, Balance, Nonce, BlockNumber> for Runtime
{
impl pallet_revive::ReviveApi<Block, AccountId, Balance, Nonce, BlockNumber> for Runtime {
fn balance(address: H160) -> U256 {
Revive::evm_balance(&address)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ use xcm_executor::XcmExecutor;

parameter_types! {
pub const RootLocation: Location = Location::here();
pub const AssetHubId: u32 = 1000;
pub const AssetHubWestend: Location = Parachain(AssetHubId::get()).into();
EleisonC marked this conversation as resolved.
Show resolved Hide resolved
pub const WestendLocation: Location = Location::parent();
pub const GovernanceLocation: Location = Location::parent();
pub const RelayNetwork: Option<NetworkId> = Some(NetworkId::ByGenesis(WESTEND_GENESIS_HASH));
Expand Down
Loading