mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 08:41:02 +00:00
XCM Benchmarks for Generic Instructions (#3940)
* initial stuff * quick fixes * move to individual tests * dont need these * Update benchmarking.rs * add to westend * make benchmarks execute * fix compile * add post_execute * ClaimAsset benchmark working * subscribe and unsubscribe benchmarks * benchmark for initiate reserve withdraw * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * fix spell check * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * update worst case for query_holding * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * move verification logic below * introduce worst case holding to initiate reserve withdraw * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * feedback * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * Revert "cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs" This reverts commit 277903944be620dc57d83b9bcf3b462d2fb73ab5. * fix benchmark template * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * use response::version * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * refactor worst case holding * cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=pallet_xcm_benchmarks::generic --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --template=./xcm/pallet-xcm-benchmarks/template.hbs --output=./runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs * fmt * one more todo needs to be labeled * change option to result with benchmark error * fmt and fix import Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
@@ -19,12 +19,13 @@
|
||||
#![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, Assets};
|
||||
use xcm_executor::traits::Convert;
|
||||
|
||||
pub mod fungible;
|
||||
pub mod generic;
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
@@ -42,7 +43,10 @@ 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;
|
||||
}
|
||||
|
||||
const SEED: u32 = 0;
|
||||
@@ -56,12 +60,10 @@ pub type AssetTransactorOf<T> = <<T as Config>::XcmConfig as xcm_executor::Confi
|
||||
/// The call type of executor's config. Should eventually resolve to the same overarching call type.
|
||||
pub type XcmCallOf<T> = <<T as Config>::XcmConfig as xcm_executor::Config>::Call;
|
||||
|
||||
/// The worst case number of assets in the holding.
|
||||
const HOLDING_FUNGIBLES: u32 = 99;
|
||||
const HOLDING_NON_FUNGIBLES: u32 = 99;
|
||||
|
||||
pub fn worst_case_holding() -> Assets {
|
||||
let fungibles_amount: u128 = 100; // TODO probably update
|
||||
pub fn mock_worst_case_holding() -> MultiAssets {
|
||||
const HOLDING_FUNGIBLES: u32 = 99;
|
||||
const HOLDING_NON_FUNGIBLES: u32 = 99;
|
||||
let fungibles_amount: u128 = 100;
|
||||
(0..HOLDING_FUNGIBLES)
|
||||
.map(|i| {
|
||||
MultiAsset {
|
||||
|
||||
Reference in New Issue
Block a user