Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
16ad36c
initial stuff
shawntabrizi Sep 27, 2021
cbd0dc8
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Oct 4, 2021
82caeec
quick fixes
shawntabrizi Oct 4, 2021
e3a0f4a
move to individual tests
shawntabrizi Oct 4, 2021
f5b3269
dont need these
shawntabrizi Oct 4, 2021
29bfa5d
Update benchmarking.rs
shawntabrizi Oct 4, 2021
ec573a0
add to westend
shawntabrizi Oct 4, 2021
e3a7c02
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Nov 11, 2021
77b1fbd
make benchmarks execute
shawntabrizi Nov 12, 2021
470ce15
fix compile
shawntabrizi Nov 14, 2021
82149ac
add post_execute
shawntabrizi Nov 15, 2021
b817e7c
ClaimAsset benchmark working
shawntabrizi Nov 15, 2021
3d9f774
subscribe and unsubscribe benchmarks
shawntabrizi Nov 15, 2021
e85c556
benchmark for initiate reserve withdraw
shawntabrizi Nov 15, 2021
e64c9ae
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Nov 15, 2021
3aa3b3c
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Nov 15, 2021
30c13a2
fix spell check
shawntabrizi Nov 15, 2021
270c283
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Nov 15, 2021
041b3f4
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Nov 15, 2021
cd190e2
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Nov 15, 2021
2ee0d81
update worst case for query_holding
shawntabrizi Nov 16, 2021
02248db
Merge branch 'master' of https://github.com/paritytech/polkadot into …
Nov 16, 2021
a9a3b29
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Nov 16, 2021
f51acc3
move verification logic below
shawntabrizi Nov 16, 2021
1e80cfe
introduce worst case holding to initiate reserve withdraw
shawntabrizi Nov 16, 2021
9178fbe
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Nov 16, 2021
d8da46b
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Nov 24, 2021
978b015
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Nov 30, 2021
23602ca
feedback
shawntabrizi Nov 30, 2021
21fde67
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Nov 30, 2021
2779039
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Nov 30, 2021
98964be
Revert "cargo run --quiet --release --features=runtime-benchmarks -- …
shawntabrizi Nov 30, 2021
4939b63
fix benchmark template
shawntabrizi Nov 30, 2021
be2036d
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Nov 30, 2021
4efd026
use response::version
shawntabrizi Dec 1, 2021
6c0ceed
Merge branch 'master' of https://github.com/paritytech/polkadot into …
Dec 1, 2021
77b183f
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Dec 1, 2021
d783d40
refactor worst case holding
shawntabrizi Dec 1, 2021
2a9582b
Merge branch 'shawntabrizi-xcm-generic-benchmarks' of https://github.…
shawntabrizi Dec 1, 2021
6512a26
cargo run --quiet --release --features=runtime-benchmarks -- benchmar…
Dec 1, 2021
df66c1f
fmt
shawntabrizi Dec 1, 2021
fc51779
Merge branch 'shawntabrizi-xcm-generic-benchmarks' of https://github.…
shawntabrizi Dec 1, 2021
cd0f4b8
one more todo needs to be labeled
shawntabrizi Dec 1, 2021
b7e3ced
change option to result with benchmark error
shawntabrizi Dec 1, 2021
3c4dcb4
fmt and fix import
shawntabrizi Dec 1, 2021
a9ea6c1
Merge branch 'master' into shawntabrizi-xcm-generic-benchmarks
shawntabrizi Dec 1, 2021
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
Prev Previous commit
Next Next commit
change option to result with benchmark error
  • Loading branch information
shawntabrizi committed Dec 1, 2021
commit b7e3cede17e4e75e62a8e9b89708f8d5da394be1
14 changes: 7 additions & 7 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1563,7 +1563,7 @@ sp_api::impl_runtime_apis! {
impl pallet_xcm_benchmarks::Config for Runtime {
type XcmConfig = XcmConfig;
type AccountIdConverter = LocationConverter;
fn valid_destination() -> Result<MultiLocation, sp_runtime::DispatchError> {
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
Ok(Westmint::get())
}
fn worst_case_holding() -> MultiAssets {
Expand Down Expand Up @@ -1603,19 +1603,19 @@ sp_api::impl_runtime_apis! {
(0u64, Response::Version(Default::default()))
}

fn transact_origin() -> Option<MultiLocation> {
Some(Westmint::get())
fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
Ok(Westmint::get())
}

fn subscribe_origin() -> Option<MultiLocation> {
Some(Westmint::get())
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
Ok(Westmint::get())
}

fn claimable_asset() -> Option<(MultiLocation, MultiLocation, MultiAssets)> {
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
let origin = Westmint::get();
let assets: MultiAssets = (Concrete(WndLocation::get()), 1_000 * UNITS).into();
let ticket = MultiLocation { parents: 0, interior: Here };
Some((origin, ticket, assets))
Ok((origin, ticket, assets))
}
}

Expand Down
3 changes: 2 additions & 1 deletion xcm/pallet-xcm-benchmarks/src/fungible/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use sp_runtime::{
};
use xcm::latest::prelude::*;
use xcm_builder::AllowUnpaidExecutionFrom;
use frame_benchmarking::BenchmarkError;

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
Expand Down Expand Up @@ -145,7 +146,7 @@ impl xcm_executor::Config for XcmConfig {
impl crate::Config for Test {
type XcmConfig = XcmConfig;
type AccountIdConverter = AccountIdConverter;
fn valid_destination() -> Result<MultiLocation, sp_runtime::DispatchError> {
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
let valid_destination: MultiLocation =
X1(AccountId32 { network: NetworkId::Any, id: [0u8; 32] }).into();

Expand Down
9 changes: 4 additions & 5 deletions xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ benchmarks! {
// and included in the final weight calculation. So this is just the overhead of submitting
// a noop call.
transact {
let origin = T::transact_origin().ok_or(BenchmarkError::Skip)?;
let origin = T::transact_origin()?;
let mut executor = new_executor::<T>(origin);
let noop_call: <T as Config>::Call = frame_system::Call::remark_with_event {
remark: Default::default()
Expand Down Expand Up @@ -222,8 +222,7 @@ benchmarks! {
claim_asset {
use xcm_executor::traits::DropAssets;

let (origin, ticket, assets) = T::claimable_asset()
.ok_or(BenchmarkError::Skip)?;
let (origin, ticket, assets) = T::claimable_asset()?;

// We place some items into the asset trap to claim.
<T::XcmConfig as xcm_executor::Config>::AssetTrap::drop_assets(
Expand Down Expand Up @@ -261,7 +260,7 @@ benchmarks! {

subscribe_version {
use xcm_executor::traits::VersionChangeNotifier;
let origin = T::subscribe_origin().ok_or(BenchmarkError::Skip)?;
let origin = T::subscribe_origin()?;
let query_id = Default::default();
let max_response_weight = Default::default();
let mut executor = new_executor::<T>(origin.clone());
Expand All @@ -276,7 +275,7 @@ benchmarks! {
unsubscribe_version {
use xcm_executor::traits::VersionChangeNotifier;
// First we need to subscribe to notifications.
let origin = T::transact_origin().ok_or(BenchmarkError::Skip)?;
let origin = T::transact_origin()?;
let query_id = Default::default();
let max_response_weight = Default::default();
<T::XcmConfig as xcm_executor::Config>::SubscriptionService::start(
Expand Down
14 changes: 7 additions & 7 deletions xcm/pallet-xcm-benchmarks/src/generic/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl xcm_executor::Config for XcmConfig {
impl crate::Config for Test {
type XcmConfig = XcmConfig;
type AccountIdConverter = AccountIdConverter;
fn valid_destination() -> Result<MultiLocation, sp_runtime::DispatchError> {
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
let valid_destination: MultiLocation =
Junction::AccountId32 { network: NetworkId::Any, id: [0u8; 32] }.into();

Expand All @@ -135,18 +135,18 @@ impl generic::Config for Test {
(0, Response::Assets(assets))
}

fn transact_origin() -> Option<MultiLocation> {
Some(Default::default())
fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
Ok(Default::default())
}

fn subscribe_origin() -> Option<MultiLocation> {
Some(Default::default())
fn subscribe_origin() -> Result<MultiLocation, BenchmarkError> {
Ok(Default::default())
}

fn claimable_asset() -> Option<(MultiLocation, MultiLocation, MultiAssets)> {
fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
let assets: MultiAssets = (Concrete(Here.into()), 100).into();
let ticket = MultiLocation { parents: 0, interior: X1(GeneralIndex(0)) };
Some((Default::default(), ticket, assets))
Ok((Default::default(), ticket, assets))
}
}

Expand Down
7 changes: 4 additions & 3 deletions xcm/pallet-xcm-benchmarks/src/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod mock;
pub mod pallet {
use frame_support::{dispatch::Dispatchable, pallet_prelude::Encode, weights::GetDispatchInfo};
use xcm::latest::{MultiAssets, MultiLocation, Response};
use frame_benchmarking::BenchmarkError;

#[pallet::config]
pub trait Config<I: 'static = ()>: frame_system::Config + crate::Config {
Expand All @@ -22,15 +23,15 @@ pub mod pallet {
/// The `MultiLocation` used for successful transaction XCMs.
///
/// If set to `None`, benchmarks which rely on a `transact_origin` will be skipped.
fn transact_origin() -> Option<MultiLocation>;
fn transact_origin() -> Result<MultiLocation, BenchmarkError>;

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

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

#[pallet::pallet]
Expand Down
4 changes: 2 additions & 2 deletions xcm/pallet-xcm-benchmarks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#![cfg_attr(not(feature = "std"), no_std)]

use codec::Encode;
use frame_benchmarking::account;
use frame_benchmarking::{account, BenchmarkError};
use sp_std::prelude::*;
use xcm::latest::prelude::*;
use xcm_executor::traits::Convert;
Expand All @@ -43,7 +43,7 @@ pub trait Config: frame_system::Config {

/// Does any necessary setup to create a valid destination for XCM messages.
/// Returns that destination's multi-location to be used in benchmarks.
fn valid_destination() -> Result<MultiLocation, sp_runtime::DispatchError>;
fn valid_destination() -> Result<MultiLocation, BenchmarkError>;

/// Worst case scenario for a holding account in this runtime.
fn worst_case_holding() -> MultiAssets;
Expand Down