From 879960a815308526a776ed64b13b90c839636c04 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Thu, 24 Mar 2022 22:12:48 +0100 Subject: [PATCH] Clear storage before running the bench (#11109) Signed-off-by: Oliver Tale-Yazdi Co-authored-by: Shawn Tabrizi --- substrate/frame/bags-list/src/benchmarks.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/substrate/frame/bags-list/src/benchmarks.rs b/substrate/frame/bags-list/src/benchmarks.rs index b94a97093d..bcfd1e3392 100644 --- a/substrate/frame/bags-list/src/benchmarks.rs +++ b/substrate/frame/bags-list/src/benchmarks.rs @@ -144,6 +144,10 @@ frame_benchmarking::benchmarks! { // - 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. + // clear any pre-existing storage. + // NOTE: safe to call outside block production + List::::unsafe_clear(); + let bag_thresh = T::BagThresholds::get()[0]; // insert the nodes in order