mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 02:21:04 +00:00
Add runtime benchmarking suite to all runtimes (#1034)
* Add benchmarking suite to all runtimes * Add `runtime-benchmarks` feature to `test-linux-stable` * Update Cargo.lock * Update Cargo.lock * Update Cargo.lock * "user" instead of "caller" * undo these changes
This commit is contained in:
@@ -61,7 +61,10 @@ timestamp = { package = "pallet-timestamp", git = "https://github.com/paritytech
|
||||
treasury = { package = "pallet-treasury", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
utility = { package = "pallet-utility", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
vesting = { package = "pallet-vesting", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||
|
||||
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||
pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||
pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||
|
||||
runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
|
||||
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
|
||||
@@ -141,11 +144,23 @@ std = [
|
||||
"runtime-common/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"collective/runtime-benchmarks",
|
||||
"runtime-common/runtime-benchmarks",
|
||||
"frame-benchmarking",
|
||||
"frame-support/runtime-benchmarks",
|
||||
"runtime-common/runtime-benchmarks",
|
||||
"elections-phragmen/runtime-benchmarks",
|
||||
"society/runtime-benchmarks",
|
||||
"system/runtime-benchmarks",
|
||||
"sp-runtime/runtime-benchmarks",
|
||||
"balances/runtime-benchmarks",
|
||||
"collective/runtime-benchmarks",
|
||||
"democracy/runtime-benchmarks",
|
||||
"elections-phragmen/runtime-benchmarks",
|
||||
"identity/runtime-benchmarks",
|
||||
"im-online/runtime-benchmarks",
|
||||
"society/runtime-benchmarks",
|
||||
"staking/runtime-benchmarks",
|
||||
"timestamp/runtime-benchmarks",
|
||||
"treasury/runtime-benchmarks",
|
||||
"utility/runtime-benchmarks",
|
||||
"vesting/runtime-benchmarks",
|
||||
"pallet-offences-benchmarking",
|
||||
"pallet-session-benchmarking",
|
||||
]
|
||||
|
||||
@@ -818,9 +818,28 @@ sp_api::impl_runtime_apis! {
|
||||
repeat: u32,
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
|
||||
// Trying to add benchmarks directly to the Session Pallet caused cyclic dependency issues.
|
||||
// To get around that, we separated the Session benchmarks into its own crate, which is why
|
||||
// we need these two lines below.
|
||||
use pallet_session_benchmarking::Module as SessionBench;
|
||||
use pallet_offences_benchmarking::Module as OffencesBench;
|
||||
|
||||
impl pallet_session_benchmarking::Trait for Runtime {}
|
||||
impl pallet_offences_benchmarking::Trait for Runtime {}
|
||||
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat);
|
||||
|
||||
add_benchmark!(params, batches, b"balances", Balances);
|
||||
add_benchmark!(params, batches, b"identity", Identity);
|
||||
add_benchmark!(params, batches, b"im-online", ImOnline);
|
||||
add_benchmark!(params, batches, b"offences", OffencesBench::<Runtime>);
|
||||
add_benchmark!(params, batches, b"session", SessionBench::<Runtime>);
|
||||
add_benchmark!(params, batches, b"staking", Staking);
|
||||
add_benchmark!(params, batches, b"timestamp", Timestamp);
|
||||
add_benchmark!(params, batches, b"utility", Utility);
|
||||
add_benchmark!(params, batches, b"vesting", Vesting);
|
||||
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user