Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Small nits for xcm-v3 #6408

Merged
merged 16 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
5 changes: 5 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2057,6 +2057,11 @@ sp_api::impl_runtime_apis! {
// Kusama doesn't support asset locking
Err(BenchmarkError::Skip)
}

fn export_message_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError> {
// Kusama doesn't support `ExportMessage`
Err(BenchmarkError::Skip)
}
}

let whitelist: Vec<TrackedStorageKey> = vec![
Expand Down
5 changes: 5 additions & 0 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,11 @@ sp_api::impl_runtime_apis! {
// Rococo doesn't support asset locking
Err(BenchmarkError::Skip)
}

fn export_message_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError> {
// Rococo doesn't support `ExportMessage`
Err(BenchmarkError::Skip)
}
}

let whitelist: Vec<TrackedStorageKey> = vec![
Expand Down
9 changes: 7 additions & 2 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1700,8 +1700,8 @@ sp_api::impl_runtime_apis! {
impl runtime_parachains::disputes::slashing::benchmarking::Config for Runtime {}

use xcm::latest::{
AssetId::*, Fungibility::*, Junction, Junctions::*, MultiAsset, MultiAssets,
MultiLocation, Response,
AssetId::*, Fungibility::*, InteriorMultiLocation, Junction, Junctions::*, MultiAsset, MultiAssets,
MultiLocation, NetworkId, Response,
};
use xcm_config::{Westmint, TokenLocation};

Expand Down Expand Up @@ -1777,6 +1777,11 @@ sp_api::impl_runtime_apis! {
// Westend doesn't support asset locking
Err(BenchmarkError::Skip)
}

fn export_message_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError> {
// Westend doesn't support `ExportMessage`
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down
6 changes: 4 additions & 2 deletions xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,13 @@ benchmarks! {
}

export_message {
let (network, destination) = T::export_message_destination().map_err(|_| BenchmarkError::Skip)?;
bkontur marked this conversation as resolved.
Show resolved Hide resolved

let mut executor = new_executor::<T>(Default::default());

let instruction = Instruction::ExportMessage {
network: Polkadot,
destination: Here,
network,
destination,
xcm: Xcm(vec![Instruction::Trap(10)]),
};
let xcm = Xcm(vec![instruction]);
Expand Down
18 changes: 13 additions & 5 deletions xcm/pallet-xcm-benchmarks/src/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ pub mod pallet {
dispatch::{Dispatchable, GetDispatchInfo},
pallet_prelude::Encode,
};
use xcm::latest::{Junction, MultiAsset, MultiAssets, MultiLocation, Response};
use xcm::latest::{
InteriorMultiLocation, Junction, MultiAsset, MultiAssets, MultiLocation, NetworkId,
Response,
};

#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config {
Expand All @@ -30,31 +33,36 @@ pub mod pallet {
/// The first element in the returned tuple represents the assets that are being exchanged
/// from, whereas the second element represents the assets that are being exchanged to.
///
/// If set to `None`, benchmarks which rely on an `exchange_asset` will be skipped.
/// If set to `Err`, benchmarks which rely on an `exchange_asset` will be skipped.
fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError>;

/// A `Junction` that is one of the `UniversalAliases` configured by the XCM executor.
///
/// If set to `None`, benchmarks which rely on a universal alias will be skipped.
/// If set to `Err`, benchmarks which rely on a universal alias will be skipped.
fn universal_alias() -> Result<Junction, BenchmarkError>;

/// The `MultiLocation` and `RuntimeCall` used for successful transaction XCMs.
///
/// If set to `None`, benchmarks which rely on a `transact_origin_and_runtime_call` will be
/// If set to `Err`, benchmarks which rely on a `transact_origin_and_runtime_call` will be
/// skipped.
fn transact_origin_and_runtime_call(
) -> Result<(MultiLocation, <Self as crate::generic::Config<I>>::RuntimeCall), BenchmarkError>;

/// A valid `MultiLocation` we can successfully subscribe to.
///
/// If set to `None`, benchmarks which rely on a `subscribe_origin` will be skipped.
/// If set to `Err`, benchmarks which rely on a `subscribe_origin` will be skipped.
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError>;

/// Return an origin, ticket, and assets that can be trapped and claimed.
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError>;

/// Return an unlocker, owner and assets that can be locked and unlocked.
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError>;

/// The pair of `NewtorkId/InteriorMultiLocation` used as remote destination for `ExportMessage`.
///
/// If set to `Err`, benchmarks which rely on a `export_message_destination` will be skipped.
fn export_message_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError>;
}

#[pallet::pallet]
Expand Down