Skip to content

Commit

Permalink
[pallet_xcm] Apply patch for benchmarks paritytech/polkadot-sdk#3465
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Feb 28, 2024
1 parent 8450968 commit 16521a7
Show file tree
Hide file tree
Showing 23 changed files with 295 additions and 211 deletions.
195 changes: 97 additions & 98 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration-tests/emulated/helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pallet-message-queue = { version = "32.0.0" }

# Polkadot
xcm = { package = "staging-xcm", version = "8.0.0" }
pallet-xcm = { version = "8.0.0" }
pallet-xcm = { version = "8.0.1" }

# Cumulus
xcm-emulator = { version = "0.6.0" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ pallet-message-queue = { version = "32.0.0" }
# Polkadot
xcm = { package = "staging-xcm", version = "8.0.0" }
xcm-executor = { package = "staging-xcm-executor", default-features = false, version = "8.0.1" }
pallet-xcm = { version = "8.0.0" }
pallet-xcm = { version = "8.0.1" }

# Cumulus
parachains-common = { version = "8.0.0" }
emulated-integration-tests-common = { version = "4.0.0" }
asset-test-utils = { version = "8.0.1" }
cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"], version = "0.8.0" }
cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"], version = "0.8.1" }

# Local
asset-hub-kusama-runtime = { path = "../../../../../system-parachains/asset-hubs/asset-hub-kusama" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ pallet-treasury = { version = "28.0.0" }
pallet-message-queue = { version = "32.0.0" }

# Polkadot
polkadot-runtime-common = { version = "8.0.0" }
polkadot-runtime-common = { version = "8.0.1" }
xcm = { package = "staging-xcm", version = "8.0.0" }
pallet-xcm = { version = "8.0.0" }
pallet-xcm = { version = "8.0.1" }
xcm-executor = { package = "staging-xcm-executor", version = "8.0.1" }

# Cumulus
asset-test-utils = { version = "8.0.1" }
emulated-integration-tests-common = { version = "4.0.0" }
parachains-common = { version = "8.0.0" }
cumulus-pallet-xcmp-queue = { version = "0.8.0" }
cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"], version = "0.8.0" }
cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"], version = "0.8.1" }

# Local
asset-hub-polkadot-runtime = { path = "../../../../../system-parachains/asset-hubs/asset-hub-polkadot" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pallet-message-queue = { version = "32.0.0" }

# Polkadot
xcm = { package = "staging-xcm", version = "8.0.0" }
pallet-xcm = { version = "8.0.0" }
pallet-xcm = { version = "8.0.1" }
xcm-executor = { package = "staging-xcm-executor", version = "8.0.1" }

# Cumulus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pallet-message-queue = { version = "32.0.0" }

# Polkadot
xcm = { package = "staging-xcm", version = "8.0.0" }
pallet-xcm = { version = "8.0.0" }
pallet-xcm = { version = "8.0.1" }
xcm-executor = { package = "staging-xcm-executor", version = "8.0.1" }

# Cumulus
Expand Down
8 changes: 4 additions & 4 deletions relay/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ pallet-treasury = { default-features = false , version = "28.0.0" }
pallet-utility = { default-features = false , version = "29.0.0" }
pallet-vesting = { default-features = false , version = "29.0.0" }
pallet-whitelist = { default-features = false , version = "28.0.0" }
pallet-xcm = { default-features = false , version = "8.0.0" }
pallet-xcm-benchmarks = { default-features = false, optional = true , version = "8.0.1" }
pallet-xcm = { default-features = false , version = "8.0.1" }
pallet-xcm-benchmarks = { default-features = false, optional = true , version = "8.0.2" }
frame-election-provider-support = { default-features = false , version = "29.0.0" }

frame-benchmarking = { default-features = false, optional = true , version = "29.0.0" }
Expand All @@ -94,13 +94,13 @@ frame-system-benchmarking = { default-features = false, optional = true , versio
pallet-election-provider-support-benchmarking = { default-features = false, optional = true , version = "28.0.0" }
hex-literal = "0.4.1"

runtime-common = { package = "polkadot-runtime-common", default-features = false, version = "8.0.0" }
runtime-common = { package = "polkadot-runtime-common", default-features = false, version = "8.0.1" }
runtime-parachains = { package = "polkadot-runtime-parachains", default-features = false , version = "8.0.0" }
primitives = { package = "polkadot-primitives", default-features = false , version = "8.0.0" }

xcm = { package = "staging-xcm", default-features = false , version = "8.0.0" }
xcm-executor = { package = "staging-xcm-executor", default-features = false , version = "8.0.1" }
xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.0" }
xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.1" }

sp-debug-derive = { default-features = false, version = "14.0.0" }

Expand Down
4 changes: 2 additions & 2 deletions relay/kusama/constants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ smallvec = "1.13.1"

frame-support = { default-features = false , version = "29.0.0" }
primitives = { package = "polkadot-primitives", default-features = false , version = "8.0.0" }
runtime-common = { package = "polkadot-runtime-common", default-features = false , version = "8.0.0" }
runtime-common = { package = "polkadot-runtime-common", default-features = false , version = "8.0.1" }
sp-runtime = { default-features = false , version = "32.0.0" }
sp-weights = { default-features = false , version = "28.0.0" }
sp-core = { default-features = false , version = "29.0.0" }

xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.0" }
xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.1" }

[features]
default = [ "std" ]
Expand Down
42 changes: 30 additions & 12 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2411,16 +2411,42 @@ sp_api::impl_runtime_apis! {
impl pallet_nomination_pools_benchmarking::Config for Runtime {}
impl runtime_parachains::disputes::slashing::benchmarking::Config for Runtime {}

parameter_types! {
pub ExistentialDepositAsset: Option<Asset> = Some((
TokenLocation::get(),
ExistentialDeposit::get()
).into());
pub AssetHubParaId: ParaId = kusama_runtime_constants::system_parachain::ASSET_HUB_ID.into();
pub const RandomParaId: ParaId = ParaId::new(43211234);
}

use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark;
impl pallet_xcm::benchmarking::Config for Runtime {
type DeliveryHelper = (
runtime_common::xcm_sender::ToParachainDeliveryHelper<
XcmConfig,
ExistentialDepositAsset,
xcm_config::PriceForChildParachainDelivery,
AssetHubParaId,
(),
>,
runtime_common::xcm_sender::ToParachainDeliveryHelper<
XcmConfig,
ExistentialDepositAsset,
xcm_config::PriceForChildParachainDelivery,
RandomParaId,
(),
>
);

fn reachable_dest() -> Option<Location> {
Some(crate::xcm_config::AssetHubLocation::get())
}

fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
// Relay/native token can be teleported to/from AH.
Some((
Asset { fun: Fungible(EXISTENTIAL_DEPOSIT), id: AssetId(Here.into()) },
Asset { fun: Fungible(ExistentialDeposit::get()), id: AssetId(Here.into()) },
crate::xcm_config::AssetHubLocation::get(),
))
}
Expand All @@ -2429,10 +2455,10 @@ sp_api::impl_runtime_apis! {
// Relay can reserve transfer native token to some random parachain.
Some((
Asset {
fun: Fungible(EXISTENTIAL_DEPOSIT),
fun: Fungible(ExistentialDeposit::get()),
id: AssetId(Here.into())
},
crate::Junction::Parachain(43211234).into(),
Parachain(RandomParaId::get().into()).into(),
))
}

Expand All @@ -2451,22 +2477,14 @@ sp_api::impl_runtime_apis! {
}
}

parameter_types! {
pub ExistentialDepositAsset: Option<Asset> = Some((
TokenLocation::get(),
ExistentialDeposit::get()
).into());
pub ToParachain: ParaId = kusama_runtime_constants::system_parachain::ASSET_HUB_ID.into();
}

impl pallet_xcm_benchmarks::Config for Runtime {
type XcmConfig = XcmConfig;
type AccountIdConverter = SovereignAccountOf;
type DeliveryHelper = runtime_common::xcm_sender::ToParachainDeliveryHelper<
XcmConfig,
ExistentialDepositAsset,
xcm_config::PriceForChildParachainDelivery,
ToParachain,
AssetHubParaId,
(),
>;
fn valid_destination() -> Result<Location, BenchmarkError> {
Expand Down
8 changes: 4 additions & 4 deletions relay/polkadot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ pallet-whitelist = { default-features = false , version = "28.0.0" }
pallet-vesting = { default-features = false , version = "29.0.0" }
pallet-utility = { default-features = false , version = "29.0.0" }
frame-election-provider-support = { default-features = false , version = "29.0.0" }
pallet-xcm = { default-features = false, version = "8.0.0" }
pallet-xcm-benchmarks = { default-features = false, optional = true , version = "8.0.1" }
pallet-xcm = { default-features = false, version = "8.0.1" }
pallet-xcm-benchmarks = { default-features = false, optional = true , version = "8.0.2" }

frame-benchmarking = { default-features = false, optional = true , version = "29.0.0" }
frame-try-runtime = { default-features = false, optional = true , version = "0.35.0" }
Expand All @@ -90,13 +90,13 @@ pallet-offences-benchmarking = { default-features = false, optional = true , ver
pallet-session-benchmarking = { default-features = false, optional = true , version = "29.0.0" }
pallet-nomination-pools-benchmarking = { default-features = false, optional = true , version = "27.0.0" }

runtime-common = { package = "polkadot-runtime-common", default-features = false, version = "8.0.0" }
runtime-common = { package = "polkadot-runtime-common", default-features = false, version = "8.0.1" }
runtime-parachains = { package = "polkadot-runtime-parachains", default-features = false , version = "8.0.0" }
primitives = { package = "polkadot-primitives", default-features = false , version = "8.0.0" }

xcm = { package = "staging-xcm", default-features = false , version = "8.0.0" }
xcm-executor = { package = "staging-xcm-executor", default-features = false , version = "8.0.1" }
xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.0" }
xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.1" }

sp-debug-derive = { default-features = false, version = "14.0.0" }

Expand Down
4 changes: 2 additions & 2 deletions relay/polkadot/constants/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ smallvec = "1.13.1"

frame-support = { default-features = false , version = "29.0.0" }
primitives = { package = "polkadot-primitives", default-features = false , version = "8.0.0" }
runtime-common = { package = "polkadot-runtime-common", default-features = false , version = "8.0.0" }
runtime-common = { package = "polkadot-runtime-common", default-features = false , version = "8.0.1" }
sp-runtime = { default-features = false , version = "32.0.0" }
sp-weights = { default-features = false , version = "28.0.0" }
sp-core = { default-features = false , version = "29.0.0" }

xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.0" }
xcm-builder = { package = "staging-xcm-builder", default-features = false , version = "8.0.1" }

[features]
default = [ "std" ]
Expand Down
42 changes: 30 additions & 12 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2298,16 +2298,42 @@ sp_api::impl_runtime_apis! {
impl pallet_nomination_pools_benchmarking::Config for Runtime {}
impl runtime_parachains::disputes::slashing::benchmarking::Config for Runtime {}

parameter_types! {
pub ExistentialDepositAsset: Option<Asset> = Some((
TokenLocation::get(),
ExistentialDeposit::get()
).into());
pub AssetHubParaId: ParaId = polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into();
pub const RandomParaId: ParaId = ParaId::new(43211234);
}

use pallet_xcm::benchmarking::Pallet as PalletXcmExtrinsiscsBenchmark;
impl pallet_xcm::benchmarking::Config for Runtime {
type DeliveryHelper = (
runtime_common::xcm_sender::ToParachainDeliveryHelper<
XcmConfig,
ExistentialDepositAsset,
xcm_config::PriceForChildParachainDelivery,
AssetHubParaId,
(),
>,
runtime_common::xcm_sender::ToParachainDeliveryHelper<
XcmConfig,
ExistentialDepositAsset,
xcm_config::PriceForChildParachainDelivery,
RandomParaId,
(),
>
);

fn reachable_dest() -> Option<Location> {
Some(crate::xcm_config::AssetHubLocation::get())
}

fn teleportable_asset_and_dest() -> Option<(Asset, Location)> {
// Relay/native token can be teleported to/from AH.
Some((
Asset { fun: Fungible(EXISTENTIAL_DEPOSIT), id: AssetId(Here.into()) },
Asset { fun: Fungible(ExistentialDeposit::get()), id: AssetId(Here.into()) },
crate::xcm_config::AssetHubLocation::get(),
))
}
Expand All @@ -2316,10 +2342,10 @@ sp_api::impl_runtime_apis! {
// Relay can reserve transfer native token to some random parachain.
Some((
Asset {
fun: Fungible(EXISTENTIAL_DEPOSIT),
fun: Fungible(ExistentialDeposit::get()),
id: AssetId(Here.into())
},
crate::Junction::Parachain(43211234).into(),
Parachain(RandomParaId::get().into()).into(),
))
}

Expand All @@ -2338,22 +2364,14 @@ sp_api::impl_runtime_apis! {
}
}

parameter_types! {
pub ExistentialDepositAsset: Option<Asset> = Some((
TokenLocation::get(),
ExistentialDeposit::get()
).into());
pub ToParachain: ParaId = polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into();
}

impl pallet_xcm_benchmarks::Config for Runtime {
type XcmConfig = XcmConfig;
type AccountIdConverter = SovereignAccountOf;
type DeliveryHelper = runtime_common::xcm_sender::ToParachainDeliveryHelper<
XcmConfig,
ExistentialDepositAsset,
xcm_config::PriceForChildParachainDelivery,
ToParachain,
AssetHubParaId,
(),
>;
fn valid_destination() -> Result<Location, BenchmarkError> {
Expand Down
12 changes: 6 additions & 6 deletions system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,24 @@ sp-weights = { default-features = false, version = "28.0.0" }
primitive-types = { version = "0.12.2", default-features = false, features = ["codec", "scale-info", "num-traits"] }

# Polkadot
pallet-xcm = { default-features = false, version = "8.0.0" }
pallet-xcm-benchmarks = { default-features = false, optional = true , version = "8.0.1" }
pallet-xcm = { default-features = false, version = "8.0.1" }
pallet-xcm-benchmarks = { default-features = false, optional = true , version = "8.0.2" }
polkadot-core-primitives = { default-features = false, version = "8.0.0" }
polkadot-parachain-primitives = { default-features = false, version = "7.0.0" }
polkadot-runtime-common = { default-features = false, version = "8.0.0" }
polkadot-runtime-common = { default-features = false, version = "8.0.1" }
xcm = { package = "staging-xcm", default-features = false, version = "8.0.0" }
xcm-builder = { package = "staging-xcm-builder", default-features = false, version = "8.0.0" }
xcm-builder = { package = "staging-xcm-builder", default-features = false, version = "8.0.1" }
xcm-executor = { package = "staging-xcm-executor", default-features = false, version = "8.0.1" }

# Cumulus
cumulus-pallet-aura-ext = { default-features = false , version = "0.8.0" }
cumulus-pallet-dmp-queue = { default-features = false , version = "0.8.0" }
cumulus-pallet-parachain-system = { default-features = false, features = ["parameterized-consensus-hook",] , version = "0.8.0" }
cumulus-pallet-parachain-system = { default-features = false, features = ["parameterized-consensus-hook",] , version = "0.8.1" }
cumulus-pallet-session-benchmarking = { default-features = false, version = "10.0.0" }
cumulus-pallet-xcm = { default-features = false , version = "0.8.0" }
cumulus-pallet-xcmp-queue = { default-features = false , features = ["bridging"] , version = "0.8.0" }
cumulus-primitives-core = { default-features = false , version = "0.8.0" }
cumulus-primitives-utility = { default-features = false , version = "0.8.0" }
cumulus-primitives-utility = { default-features = false , version = "0.8.1" }
pallet-collator-selection = { default-features = false , version = "10.0.0" }
parachain-info = { package = "staging-parachain-info", default-features = false , version = "0.8.0" }
parachains-common = { default-features = false , version = "8.0.0" }
Expand Down
Loading

0 comments on commit 16521a7

Please sign in to comment.