Benchmark Offences Pallet (#5411)

* Add initial report_ofence bench.

* Remove unused imports

* Style nit

* Add nominators

* Remove logs.

* Nits.

* Add nominators param.

* Reorg, comment.

* Remove whitespaces.

* Apply review suggestion: move benchmark to own crate.

* Remove import.

* Remove line.

* Add feature flag.

* Pass can_report.

* Cleaning up.

* More cleaning
This commit is contained in:
Marcio Diaz
2020-04-07 11:36:57 +02:00
committed by GitHub
parent d3cc051419
commit fb9bbf306d
10 changed files with 463 additions and 205 deletions
+2
View File
@@ -55,6 +55,7 @@ pallet-indices = { version = "2.0.0-alpha.5", default-features = false, path = "
pallet-identity = { version = "2.0.0-alpha.5", default-features = false, path = "../../../frame/identity" }
pallet-membership = { version = "2.0.0-alpha.5", default-features = false, path = "../../../frame/membership" }
pallet-offences = { version = "2.0.0-alpha.5", default-features = false, path = "../../../frame/offences" }
pallet-offences-benchmarking = { version = "2.0.0-alpha.5", path = "../../../frame/offences/benchmarking", default-features = false, optional = true }
pallet-randomness-collective-flip = { version = "2.0.0-alpha.5", default-features = false, path = "../../../frame/randomness-collective-flip" }
pallet-recovery = { version = "2.0.0-alpha.5", default-features = false, path = "../../../frame/recovery" }
pallet-session = { version = "2.0.0-alpha.5", features = ["historical"], path = "../../../frame/session", default-features = false }
@@ -150,6 +151,7 @@ runtime-benchmarks = [
"pallet-utility/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-offences-benchmarking",
"pallet-session-benchmarking",
]
+6
View File
@@ -887,10 +887,14 @@ impl_runtime_apis! {
// 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"collective", Council);
add_benchmark!(params, batches, b"democracy", Democracy);
@@ -902,6 +906,8 @@ impl_runtime_apis! {
add_benchmark!(params, batches, b"treasury", Treasury);
add_benchmark!(params, batches, b"utility", Utility);
add_benchmark!(params, batches, b"vesting", Vesting);
add_benchmark!(params, batches, b"offences", OffencesBench::<Runtime>);
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
Ok(batches)
}