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
+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)
}