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

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
acatangiu committed Mar 21, 2023
1 parent fecbf12 commit c0c5d55
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
3 changes: 2 additions & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2080,7 +2080,8 @@ sp_api::impl_runtime_apis! {
Err(BenchmarkError::Skip)
}

fn bridged_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError> {
fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
// Kusama doesn't support exporting messages
Err(BenchmarkError::Skip)
}
Expand Down
3 changes: 2 additions & 1 deletion runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,8 @@ sp_api::impl_runtime_apis! {
Err(BenchmarkError::Skip)
}

fn bridged_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError> {
fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
// Rococo doesn't support exporting messages
Err(BenchmarkError::Skip)
}
Expand Down
3 changes: 2 additions & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1819,7 +1819,8 @@ sp_api::impl_runtime_apis! {
Err(BenchmarkError::Skip)
}

fn bridged_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError> {
fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
// Westend doesn't support exporting messages
Err(BenchmarkError::Skip)
}
Expand Down
12 changes: 5 additions & 7 deletions xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,12 @@ benchmarks! {
}

export_message {
let mut executor = new_executor::<T>(Here.into_location());
let (network, destination) = T::bridged_destination()?;
let expected_message = Xcm(vec![TransferAsset {
assets: (Here, 100u128).into(),
beneficiary: Parachain(2).into(),
}]);
let (origin, network, destination) = T::export_message_origin_and_destination()?;
let mut executor = new_executor::<T>(origin);
// Actual exported message has no bearing on this instruction's weight, use empty message.
let inner_xcm = Xcm(vec![]);
let xcm = Xcm(vec![ExportMessage {
network, destination, xcm: expected_message.clone(),
network, destination, xcm: inner_xcm,
}]);
}: {
executor.bench_process(xcm)?;
Expand Down
3 changes: 2 additions & 1 deletion xcm/pallet-xcm-benchmarks/src/generic/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ impl generic::Config for Test {
Ok((Default::default(), Default::default(), assets))
}

fn bridged_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError> {
fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
// No MessageExporter in tests
Err(BenchmarkError::Skip)
}
Expand Down
5 changes: 3 additions & 2 deletions xcm/pallet-xcm-benchmarks/src/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ pub mod pallet {
/// Return an unlocker, owner and assets that can be locked and unlocked.
fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError>;

/// A valid `(NetworkId, InteriorMultiLocation)` we can successfully export message to.
/// A `(MultiLocation, NetworkId, InteriorMultiLocation)` we can successfully export message to.
///
/// If set to `Err`, benchmarks which rely on `export_message` will be skipped.
fn bridged_destination() -> Result<(NetworkId, InteriorMultiLocation), BenchmarkError>;
fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError>;
}

#[pallet::pallet]
Expand Down

0 comments on commit c0c5d55

Please sign in to comment.