mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 18:07:58 +00:00
Benchmark Staking and Session Pallet (#5183)
* starting bench * More * more * Payout Validator * Give each validator exactly n nominators * Update with test * Try to add accounts to chain spec * Undo changes to chainspec * Payout nominator * Rebond and Reap Stash * Set history depth * fix smelly code * cancel deferred slash * new_era bench * do_slash benchmark * Add features * undo extrinsic move * lower * Update new era * Update benchmarking.rs * whitespace * Apply suggestions from code review Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * fixes * nit * Refactor tests, initial code * Move session benchmarks to avoid cyclic deps * Update lib.rs * Fix warnings * Move impl * Update to do random nominator allocation * add feature to benchmark pallet * Remove extra stuff * Update based on feedback * Less intrusive * Remove `transfer_idle_users` * remove again * unused dep * test feature flag * Update to latest substrate Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -59,6 +59,7 @@ pallet-offences = { version = "2.0.0-alpha.2", default-features = false, path =
|
||||
pallet-randomness-collective-flip = { version = "2.0.0-alpha.2", default-features = false, path = "../../../frame/randomness-collective-flip" }
|
||||
pallet-recovery = { version = "2.0.0-alpha.2", default-features = false, path = "../../../frame/recovery" }
|
||||
pallet-session = { version = "2.0.0-alpha.2", features = ["historical"], path = "../../../frame/session", default-features = false }
|
||||
pallet-session-benchmarking = { version = "2.0.0-alpha.2", path = "../../../frame/session/benchmarking", default-features = false, optional = true }
|
||||
pallet-staking = { version = "2.0.0-alpha.2", features = ["migrate"], path = "../../../frame/staking", default-features = false }
|
||||
pallet-staking-reward-curve = { version = "2.0.0-alpha.2", path = "../../../frame/staking/reward-curve" }
|
||||
pallet-sudo = { version = "2.0.0-alpha.2", default-features = false, path = "../../../frame/sudo" }
|
||||
@@ -134,8 +135,10 @@ std = [
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"frame-benchmarking",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-identity/runtime-benchmarks",
|
||||
"pallet-balances/runtime-benchmarks",
|
||||
"pallet-identity/runtime-benchmarks",
|
||||
"pallet-session-benchmarking",
|
||||
"pallet-timestamp/runtime-benchmarks",
|
||||
"pallet-vesting/runtime-benchmarks",
|
||||
"pallet-staking/runtime-benchmarks",
|
||||
]
|
||||
|
||||
@@ -851,6 +851,11 @@ impl_runtime_apis! {
|
||||
repeat: u32,
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkResults>, sp_runtime::RuntimeString> {
|
||||
use frame_benchmarking::Benchmarking;
|
||||
// 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;
|
||||
impl pallet_session_benchmarking::Trait for Runtime {}
|
||||
|
||||
let result = match module.as_slice() {
|
||||
b"pallet-balances" | b"balances" => Balances::run_benchmark(
|
||||
@@ -867,6 +872,20 @@ impl_runtime_apis! {
|
||||
steps,
|
||||
repeat,
|
||||
),
|
||||
b"pallet-session" | b"session" => SessionBench::<Runtime>::run_benchmark(
|
||||
extrinsic,
|
||||
lowest_range_values,
|
||||
highest_range_values,
|
||||
steps,
|
||||
repeat,
|
||||
),
|
||||
b"pallet-staking" | b"staking" => Staking::run_benchmark(
|
||||
extrinsic,
|
||||
lowest_range_values,
|
||||
highest_range_values,
|
||||
steps,
|
||||
repeat,
|
||||
),
|
||||
b"pallet-timestamp" | b"timestamp" => Timestamp::run_benchmark(
|
||||
extrinsic,
|
||||
lowest_range_values,
|
||||
|
||||
Reference in New Issue
Block a user