Improve paras runtime BenchBuilder api (#4318)

* Improve paras runtime `BenchBuilder` api

* fix

* Improve doc comment

* Some doc improvemens'

* Use setters and no params for build

* +nightly-2021-10-29 fmt

* Clean up some comments

* Simplify set_code_upgrade

* Accept a slice for set_dispute_sessions

* Doc comments

* Spelling

* use impl AsRef

* Prepare for merge

* fmt

Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
This commit is contained in:
Zeke Mostov
2021-12-01 19:32:43 -08:00
committed by GitHub
parent f6c8d0d023
commit df19d3faa8
3 changed files with 148 additions and 77 deletions
@@ -29,7 +29,8 @@ benchmarks! {
let v in 10..BenchBuilder::<T>::fallback_max_validators();
let scenario = BenchBuilder::<T>::new()
.build(Default::default(), &[2], None);
.set_dispute_sessions(&[2])
.build();
let mut benchmark = scenario.data.clone();
let dispute = benchmark.disputes.pop().unwrap();
@@ -60,7 +61,8 @@ benchmarks! {
.collect();
let scenario = BenchBuilder::<T>::new()
.build(cores_with_backed, &[1], None);
.set_backed_and_concluding_cores(cores_with_backed)
.build();
let mut benchmark = scenario.data.clone();
let bitfield = benchmark.bitfields.pop().unwrap();
@@ -104,7 +106,8 @@ benchmarks! {
.collect();
let scenario = BenchBuilder::<T>::new()
.build(cores_with_backed.clone(), &[1], None);
.set_backed_and_concluding_cores(cores_with_backed.clone())
.build();
let mut benchmark = scenario.data.clone();
@@ -156,7 +159,9 @@ benchmarks! {
.collect();
let scenario = BenchBuilder::<T>::new()
.build(cores_with_backed.clone(), &[1], Some(v));
.set_backed_and_concluding_cores(cores_with_backed.clone())
.set_code_upgrade(v)
.build();
let mut benchmark = scenario.data.clone();