Clear storage before running the bench (#11109)

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
Oliver Tale-Yazdi
2022-03-24 22:12:48 +01:00
committed by GitHub
parent 44e71d8d7e
commit 879960a815
@@ -144,6 +144,10 @@ frame_benchmarking::benchmarks! {
// - both heavier's `prev` and `next` are nodes that will need to be read and written. // - both heavier's `prev` and `next` are nodes that will need to be read and written.
// - `lighter` is the bag's `head`, so the bag will need to be read and written. // - `lighter` is the bag's `head`, so the bag will need to be read and written.
// clear any pre-existing storage.
// NOTE: safe to call outside block production
List::<T>::unsafe_clear();
let bag_thresh = T::BagThresholds::get()[0]; let bag_thresh = T::BagThresholds::get()[0];
// insert the nodes in order // insert the nodes in order