From 91deee7a1dba52e5e73d1a97d9fd5b8ad1e916a4 Mon Sep 17 00:00:00 2001
From: gupnik <17176722+gupnik@users.noreply.github.com>
Date: Thu, 7 Sep 2023 08:05:31 +0530
Subject: [PATCH] Adds base benchmark for do_tick in broker pallet (#1235)

* Adds base benchmark for do_tick

* ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_broker

* Update substrate/frame/broker/src/benchmarking.rs

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update substrate/frame/broker/src/benchmarking.rs

* ".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime=dev --target_dir=substrate --pallet=pallet_broker

* Addresses review comment

---------

Co-authored-by: command-bot <>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
---
 substrate/frame/broker/src/benchmarking.rs |  21 ++
 substrate/frame/broker/src/tick_impls.rs   |   7 +-
 substrate/frame/broker/src/weights.rs      | 367 ++++++++++++---------
 3 files changed, 239 insertions(+), 156 deletions(-)

diff --git a/substrate/frame/broker/src/benchmarking.rs b/substrate/frame/broker/src/benchmarking.rs
index 663bf2f466c..d22f3936c3e 100644
--- a/substrate/frame/broker/src/benchmarking.rs
+++ b/substrate/frame/broker/src/benchmarking.rs
@@ -852,6 +852,27 @@ mod benches {
 		}
 	}
 
+	#[benchmark]
+	fn do_tick_base() -> Result<(), BenchmarkError> {
+		setup_and_start_sale::<T>()?;
+
+		advance_to::<T>(5);
+
+		let mut status = Status::<T>::get().unwrap();
+		status.last_committed_timeslice = 3;
+		Status::<T>::put(&status);
+
+		#[block]
+		{
+			Broker::<T>::do_tick();
+		}
+
+		let updated_status = Status::<T>::get().unwrap();
+		assert_eq!(status, updated_status);
+
+		Ok(())
+	}
+
 	// Implements a test for each benchmark. Execute with:
 	// `cargo test -p pallet-broker --features runtime-benchmarks`.
 	impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
diff --git a/substrate/frame/broker/src/tick_impls.rs b/substrate/frame/broker/src/tick_impls.rs
index a1a50a61908..7df8bd39d42 100644
--- a/substrate/frame/broker/src/tick_impls.rs
+++ b/substrate/frame/broker/src/tick_impls.rs
@@ -36,13 +36,14 @@ impl<T: Config> Pallet<T> {
 	/// - Request revenue information for a previous timeslice
 	/// - Initialize an instantaneous core pool historical revenue record
 	pub(crate) fn do_tick() -> Weight {
+		let mut meter = WeightMeter::new();
+		meter.consume(T::WeightInfo::do_tick_base());
+
 		let (mut status, config) = match (Status::<T>::get(), Configuration::<T>::get()) {
 			(Some(s), Some(c)) => (s, c),
-			_ => return Weight::zero(),
+			_ => return meter.consumed(),
 		};
 
-		let mut meter = WeightMeter::new();
-
 		if Self::process_core_count(&mut status) {
 			meter.consume(T::WeightInfo::process_core_count(status.core_count.into()));
 		}
diff --git a/substrate/frame/broker/src/weights.rs b/substrate/frame/broker/src/weights.rs
index 93b568bf2a0..b3a151c6062 100644
--- a/substrate/frame/broker/src/weights.rs
+++ b/substrate/frame/broker/src/weights.rs
@@ -18,10 +18,10 @@
 //! Autogenerated weights for `pallet_broker`
 //!
 //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-07-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-09-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
 //! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `runner-ynta1nyy-project-145-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
-//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024`
+//! HOSTNAME: `runner-pzhd7p6z-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
+//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024`
 
 // Executed Command:
 // target/production/substrate-node
@@ -32,12 +32,12 @@
 // --extrinsic=*
 // --wasm-execution=compiled
 // --heap-pages=4096
-// --json-file=/builds/parity/mirrors/substrate/.git/.artifacts/bench.json
+// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
 // --pallet=pallet_broker
 // --chain=dev
-// --header=./HEADER-APACHE2
-// --output=./frame/broker/src/weights.rs
-// --template=./.maintain/frame-weight-template.hbs
+// --header=./substrate/HEADER-APACHE2
+// --output=./substrate/frame/broker/src/weights.rs
+// --template=./substrate/.maintain/frame-weight-template.hbs
 
 #![cfg_attr(rustfmt, rustfmt_skip)]
 #![allow(unused_parens)]
@@ -74,6 +74,7 @@ pub trait WeightInfo {
 	fn process_pool() -> Weight;
 	fn process_core_schedule() -> Weight;
 	fn request_revenue_info_at() -> Weight;
+	fn do_tick_base() -> Weight;
 }
 
 /// Weights for `pallet_broker` using the Substrate node and recommended hardware.
@@ -85,8 +86,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 3_448_000 picoseconds.
-		Weight::from_parts(3_729_000, 0)
+		// Minimum execution time: 3_040_000 picoseconds.
+		Weight::from_parts(3_344_000, 0)
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
 	/// Storage: `Broker::Reservations` (r:1 w:1)
@@ -95,8 +96,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `5016`
 		//  Estimated: `7496`
-		// Minimum execution time: 22_537_000 picoseconds.
-		Weight::from_parts(23_335_000, 7496)
+		// Minimum execution time: 21_259_000 picoseconds.
+		Weight::from_parts(22_110_000, 7496)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -106,8 +107,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `6218`
 		//  Estimated: `7496`
-		// Minimum execution time: 21_668_000 picoseconds.
-		Weight::from_parts(22_442_000, 7496)
+		// Minimum execution time: 20_330_000 picoseconds.
+		Weight::from_parts(20_826_000, 7496)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -117,8 +118,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `239`
 		//  Estimated: `1526`
-		// Minimum execution time: 13_606_000 picoseconds.
-		Weight::from_parts(14_104_000, 1526)
+		// Minimum execution time: 13_411_000 picoseconds.
+		Weight::from_parts(13_960_000, 1526)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -137,12 +138,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 	/// Storage: `Broker::Workplan` (r:0 w:10)
 	/// Proof: `Broker::Workplan` (`max_values`: None, `max_size`: Some(1216), added: 3691, mode: `MaxEncodedLen`)
 	/// The range of component `n` is `[0, 1000]`.
-	fn start_sales(_n: u32, ) -> Weight {
+	fn start_sales(n: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `6330`
 		//  Estimated: `8499`
-		// Minimum execution time: 64_012_000 picoseconds.
-		Weight::from_parts(67_819_922, 8499)
+		// Minimum execution time: 57_770_000 picoseconds.
+		Weight::from_parts(61_047_512, 8499)
+			// Standard Error: 165
+			.saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into()))
 			.saturating_add(T::DbWeight::get().reads(6_u64))
 			.saturating_add(T::DbWeight::get().writes(16_u64))
 	}
@@ -160,8 +163,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `568`
 		//  Estimated: `2053`
-		// Minimum execution time: 48_110_000 picoseconds.
-		Weight::from_parts(49_234_000, 2053)
+		// Minimum execution time: 51_196_000 picoseconds.
+		Weight::from_parts(52_382_000, 2053)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
@@ -183,8 +186,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `686`
 		//  Estimated: `4698`
-		// Minimum execution time: 69_580_000 picoseconds.
-		Weight::from_parts(70_914_000, 4698)
+		// Minimum execution time: 71_636_000 picoseconds.
+		Weight::from_parts(73_679_000, 4698)
 			.saturating_add(T::DbWeight::get().reads(6_u64))
 			.saturating_add(T::DbWeight::get().writes(4_u64))
 	}
@@ -194,8 +197,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `3550`
-		// Minimum execution time: 17_687_000 picoseconds.
-		Weight::from_parts(18_573_000, 3550)
+		// Minimum execution time: 19_182_000 picoseconds.
+		Weight::from_parts(19_775_000, 3550)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -205,8 +208,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `3550`
-		// Minimum execution time: 19_675_000 picoseconds.
-		Weight::from_parts(20_234_000, 3550)
+		// Minimum execution time: 20_688_000 picoseconds.
+		Weight::from_parts(21_557_000, 3550)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
@@ -216,8 +219,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `3550`
-		// Minimum execution time: 19_426_000 picoseconds.
-		Weight::from_parts(20_414_000, 3550)
+		// Minimum execution time: 21_190_000 picoseconds.
+		Weight::from_parts(22_215_000, 3550)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
@@ -233,8 +236,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `740`
 		//  Estimated: `4681`
-		// Minimum execution time: 31_751_000 picoseconds.
-		Weight::from_parts(32_966_000, 4681)
+		// Minimum execution time: 34_591_000 picoseconds.
+		Weight::from_parts(36_227_000, 4681)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
@@ -252,8 +255,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `775`
 		//  Estimated: `5996`
-		// Minimum execution time: 36_709_000 picoseconds.
-		Weight::from_parts(38_930_000, 5996)
+		// Minimum execution time: 40_346_000 picoseconds.
+		Weight::from_parts(41_951_000, 5996)
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(5_u64))
 	}
@@ -261,20 +264,20 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 	/// Proof: `Broker::InstaPoolContribution` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
 	/// Storage: `Broker::InstaPoolHistory` (r:3 w:1)
 	/// Proof: `Broker::InstaPoolHistory` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
-	/// Storage: `System::Account` (r:2 w:0)
+	/// Storage: `System::Account` (r:2 w:2)
 	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
 	/// The range of component `m` is `[1, 3]`.
 	fn claim_revenue(m: u32, ) -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `720`
+		//  Measured:  `859`
 		//  Estimated: `6196 + m * (2520 ±0)`
-		// Minimum execution time: 55_510_000 picoseconds.
-		Weight::from_parts(56_665_061, 6196)
-			// Standard Error: 61_729
-			.saturating_add(Weight::from_parts(1_724_824, 0).saturating_mul(m.into()))
+		// Minimum execution time: 75_734_000 picoseconds.
+		Weight::from_parts(78_168_395, 6196)
+			// Standard Error: 63_180
+			.saturating_add(Weight::from_parts(1_076_259, 0).saturating_mul(m.into()))
 			.saturating_add(T::DbWeight::get().reads(3_u64))
 			.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(m.into())))
-			.saturating_add(T::DbWeight::get().writes(3_u64))
+			.saturating_add(T::DbWeight::get().writes(5_u64))
 			.saturating_add(Weight::from_parts(0, 2520).saturating_mul(m.into()))
 	}
 	/// Storage: `System::Account` (r:1 w:1)
@@ -283,8 +286,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `103`
 		//  Estimated: `3593`
-		// Minimum execution time: 44_992_000 picoseconds.
-		Weight::from_parts(46_225_000, 3593)
+		// Minimum execution time: 46_383_000 picoseconds.
+		Weight::from_parts(47_405_000, 3593)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -296,8 +299,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `603`
 		//  Estimated: `3550`
-		// Minimum execution time: 28_207_000 picoseconds.
-		Weight::from_parts(28_707_000, 3550)
+		// Minimum execution time: 30_994_000 picoseconds.
+		Weight::from_parts(31_979_000, 3550)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -311,8 +314,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `601`
 		//  Estimated: `3533`
-		// Minimum execution time: 31_813_000 picoseconds.
-		Weight::from_parts(32_612_000, 3533)
+		// Minimum execution time: 37_584_000 picoseconds.
+		Weight::from_parts(44_010_000, 3533)
 			.saturating_add(T::DbWeight::get().reads(3_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -326,10 +329,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
 	fn drop_history() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `829`
+		//  Measured:  `830`
 		//  Estimated: `3593`
-		// Minimum execution time: 38_571_000 picoseconds.
-		Weight::from_parts(39_493_000, 3593)
+		// Minimum execution time: 45_266_000 picoseconds.
+		Weight::from_parts(48_000_000, 3593)
 			.saturating_add(T::DbWeight::get().reads(4_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -341,42 +344,53 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `525`
 		//  Estimated: `4698`
-		// Minimum execution time: 24_714_000 picoseconds.
-		Weight::from_parts(25_288_000, 4698)
+		// Minimum execution time: 25_365_000 picoseconds.
+		Weight::from_parts(26_920_000, 4698)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:0 w:1)
-	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:0 w:1)
 	/// The range of component `n` is `[0, 1000]`.
-	fn request_core_count(_n: u32, ) -> Weight {
+	fn request_core_count(n: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 7_258_000 picoseconds.
-		Weight::from_parts(7_925_570, 0)
-			.saturating_add(T::DbWeight::get().writes(1_u64))
+		// Minimum execution time: 6_519_000 picoseconds.
+		Weight::from_parts(7_098_698, 0)
+			// Standard Error: 20
+			.saturating_add(Weight::from_parts(8, 0).saturating_mul(n.into()))
 	}
-	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:0)
-	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:0)
+	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
 	/// The range of component `n` is `[0, 1000]`.
-	fn process_core_count(_n: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `97`
-		//  Estimated: `3562`
-		// Minimum execution time: 7_136_000 picoseconds.
-		Weight::from_parts(7_788_194, 3562)
+	fn process_core_count(n: u32, ) -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `98`
+		//  Estimated: `3563`
+		// Minimum execution time: 7_608_000 picoseconds.
+		Weight::from_parts(8_157_815, 3563)
+			// Standard Error: 26
+			.saturating_add(Weight::from_parts(48, 0).saturating_mul(n.into()))
 			.saturating_add(T::DbWeight::get().reads(1_u64))
+			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
-	/// Storage: `Broker::InstaPoolHistory` (r:0 w:1)
+	/// Storage: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	/// Storage: `Broker::InstaPoolHistory` (r:1 w:1)
 	/// Proof: `Broker::InstaPoolHistory` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:1 w:1)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Authorship::Author` (r:1 w:0)
+	/// Proof: `Authorship::Author` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `System::Digest` (r:1 w:0)
+	/// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
 	fn process_revenue() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `0`
-		//  Estimated: `0`
-		// Minimum execution time: 6_049_000 picoseconds.
-		Weight::from_parts(6_311_000, 0)
-			.saturating_add(T::DbWeight::get().writes(1_u64))
+		//  Measured:  `905`
+		//  Estimated: `4370`
+		// Minimum execution time: 59_993_000 picoseconds.
+		Weight::from_parts(61_752_000, 4370)
+			.saturating_add(T::DbWeight::get().reads(5_u64))
+			.saturating_add(T::DbWeight::get().writes(3_u64))
 	}
 	/// Storage: `Broker::InstaPoolIo` (r:3 w:3)
 	/// Proof: `Broker::InstaPoolIo` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`)
@@ -393,10 +407,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `6281`
 		//  Estimated: `8499`
-		// Minimum execution time: 47_504_000 picoseconds.
-		Weight::from_parts(49_778_098, 8499)
-			// Standard Error: 109
-			.saturating_add(Weight::from_parts(427, 0).saturating_mul(n.into()))
+		// Minimum execution time: 41_863_000 picoseconds.
+		Weight::from_parts(44_033_031, 8499)
+			// Standard Error: 116
+			.saturating_add(Weight::from_parts(764, 0).saturating_mul(n.into()))
 			.saturating_add(T::DbWeight::get().reads(5_u64))
 			.saturating_add(T::DbWeight::get().writes(15_u64))
 	}
@@ -408,8 +422,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `180`
 		//  Estimated: `3493`
-		// Minimum execution time: 9_573_000 picoseconds.
-		Weight::from_parts(10_034_000, 3493)
+		// Minimum execution time: 9_588_000 picoseconds.
+		Weight::from_parts(9_925_000, 3493)
 			.saturating_add(T::DbWeight::get().reads(1_u64))
 			.saturating_add(T::DbWeight::get().writes(1_u64))
 	}
@@ -421,8 +435,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `1423`
 		//  Estimated: `4681`
-		// Minimum execution time: 21_331_000 picoseconds.
-		Weight::from_parts(22_235_000, 4681)
+		// Minimum execution time: 19_308_000 picoseconds.
+		Weight::from_parts(20_482_000, 4681)
 			.saturating_add(T::DbWeight::get().reads(2_u64))
 			.saturating_add(T::DbWeight::get().writes(2_u64))
 	}
@@ -430,8 +444,25 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 191_000 picoseconds.
-		Weight::from_parts(234_000, 0)
+		// Minimum execution time: 147_000 picoseconds.
+		Weight::from_parts(184_000, 0)
+	}
+	/// Storage: `Broker::Status` (r:1 w:1)
+	/// Proof: `Broker::Status` (`max_values`: Some(1), `max_size`: Some(18), added: 513, mode: `MaxEncodedLen`)
+	/// Storage: `Broker::Configuration` (r:1 w:0)
+	/// Proof: `Broker::Configuration` (`max_values`: Some(1), `max_size`: Some(31), added: 526, mode: `MaxEncodedLen`)
+	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
+	/// Storage: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	fn do_tick_base() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `699`
+		//  Estimated: `4164`
+		// Minimum execution time: 19_824_000 picoseconds.
+		Weight::from_parts(20_983_000, 4164)
+			.saturating_add(T::DbWeight::get().reads(4_u64))
+			.saturating_add(T::DbWeight::get().writes(3_u64))
 	}
 }
 
@@ -443,8 +474,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 3_448_000 picoseconds.
-		Weight::from_parts(3_729_000, 0)
+		// Minimum execution time: 3_040_000 picoseconds.
+		Weight::from_parts(3_344_000, 0)
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
 	/// Storage: `Broker::Reservations` (r:1 w:1)
@@ -453,8 +484,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `5016`
 		//  Estimated: `7496`
-		// Minimum execution time: 22_537_000 picoseconds.
-		Weight::from_parts(23_335_000, 7496)
+		// Minimum execution time: 21_259_000 picoseconds.
+		Weight::from_parts(22_110_000, 7496)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -464,8 +495,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `6218`
 		//  Estimated: `7496`
-		// Minimum execution time: 21_668_000 picoseconds.
-		Weight::from_parts(22_442_000, 7496)
+		// Minimum execution time: 20_330_000 picoseconds.
+		Weight::from_parts(20_826_000, 7496)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -475,8 +506,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `239`
 		//  Estimated: `1526`
-		// Minimum execution time: 13_606_000 picoseconds.
-		Weight::from_parts(14_104_000, 1526)
+		// Minimum execution time: 13_411_000 picoseconds.
+		Weight::from_parts(13_960_000, 1526)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -495,12 +526,14 @@ impl WeightInfo for () {
 	/// Storage: `Broker::Workplan` (r:0 w:10)
 	/// Proof: `Broker::Workplan` (`max_values`: None, `max_size`: Some(1216), added: 3691, mode: `MaxEncodedLen`)
 	/// The range of component `n` is `[0, 1000]`.
-	fn start_sales(_n: u32, ) -> Weight {
+	fn start_sales(n: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `6330`
 		//  Estimated: `8499`
-		// Minimum execution time: 64_012_000 picoseconds.
-		Weight::from_parts(67_819_922, 8499)
+		// Minimum execution time: 57_770_000 picoseconds.
+		Weight::from_parts(61_047_512, 8499)
+			// Standard Error: 165
+			.saturating_add(Weight::from_parts(3, 0).saturating_mul(n.into()))
 			.saturating_add(RocksDbWeight::get().reads(6_u64))
 			.saturating_add(RocksDbWeight::get().writes(16_u64))
 	}
@@ -518,8 +551,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `568`
 		//  Estimated: `2053`
-		// Minimum execution time: 48_110_000 picoseconds.
-		Weight::from_parts(49_234_000, 2053)
+		// Minimum execution time: 51_196_000 picoseconds.
+		Weight::from_parts(52_382_000, 2053)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
@@ -541,8 +574,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `686`
 		//  Estimated: `4698`
-		// Minimum execution time: 69_580_000 picoseconds.
-		Weight::from_parts(70_914_000, 4698)
+		// Minimum execution time: 71_636_000 picoseconds.
+		Weight::from_parts(73_679_000, 4698)
 			.saturating_add(RocksDbWeight::get().reads(6_u64))
 			.saturating_add(RocksDbWeight::get().writes(4_u64))
 	}
@@ -552,8 +585,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `3550`
-		// Minimum execution time: 17_687_000 picoseconds.
-		Weight::from_parts(18_573_000, 3550)
+		// Minimum execution time: 19_182_000 picoseconds.
+		Weight::from_parts(19_775_000, 3550)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -563,8 +596,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `3550`
-		// Minimum execution time: 19_675_000 picoseconds.
-		Weight::from_parts(20_234_000, 3550)
+		// Minimum execution time: 20_688_000 picoseconds.
+		Weight::from_parts(21_557_000, 3550)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
@@ -574,8 +607,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `495`
 		//  Estimated: `3550`
-		// Minimum execution time: 19_426_000 picoseconds.
-		Weight::from_parts(20_414_000, 3550)
+		// Minimum execution time: 21_190_000 picoseconds.
+		Weight::from_parts(22_215_000, 3550)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
@@ -591,8 +624,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `740`
 		//  Estimated: `4681`
-		// Minimum execution time: 31_751_000 picoseconds.
-		Weight::from_parts(32_966_000, 4681)
+		// Minimum execution time: 34_591_000 picoseconds.
+		Weight::from_parts(36_227_000, 4681)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
@@ -610,8 +643,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `775`
 		//  Estimated: `5996`
-		// Minimum execution time: 36_709_000 picoseconds.
-		Weight::from_parts(38_930_000, 5996)
+		// Minimum execution time: 40_346_000 picoseconds.
+		Weight::from_parts(41_951_000, 5996)
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(5_u64))
 	}
@@ -619,20 +652,20 @@ impl WeightInfo for () {
 	/// Proof: `Broker::InstaPoolContribution` (`max_values`: None, `max_size`: Some(68), added: 2543, mode: `MaxEncodedLen`)
 	/// Storage: `Broker::InstaPoolHistory` (r:3 w:1)
 	/// Proof: `Broker::InstaPoolHistory` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
-	/// Storage: `System::Account` (r:2 w:0)
+	/// Storage: `System::Account` (r:2 w:2)
 	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
 	/// The range of component `m` is `[1, 3]`.
 	fn claim_revenue(m: u32, ) -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `720`
+		//  Measured:  `859`
 		//  Estimated: `6196 + m * (2520 ±0)`
-		// Minimum execution time: 55_510_000 picoseconds.
-		Weight::from_parts(56_665_061, 6196)
-			// Standard Error: 61_729
-			.saturating_add(Weight::from_parts(1_724_824, 0).saturating_mul(m.into()))
+		// Minimum execution time: 75_734_000 picoseconds.
+		Weight::from_parts(78_168_395, 6196)
+			// Standard Error: 63_180
+			.saturating_add(Weight::from_parts(1_076_259, 0).saturating_mul(m.into()))
 			.saturating_add(RocksDbWeight::get().reads(3_u64))
 			.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(m.into())))
-			.saturating_add(RocksDbWeight::get().writes(3_u64))
+			.saturating_add(RocksDbWeight::get().writes(5_u64))
 			.saturating_add(Weight::from_parts(0, 2520).saturating_mul(m.into()))
 	}
 	/// Storage: `System::Account` (r:1 w:1)
@@ -641,8 +674,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `103`
 		//  Estimated: `3593`
-		// Minimum execution time: 44_992_000 picoseconds.
-		Weight::from_parts(46_225_000, 3593)
+		// Minimum execution time: 46_383_000 picoseconds.
+		Weight::from_parts(47_405_000, 3593)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -654,8 +687,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `603`
 		//  Estimated: `3550`
-		// Minimum execution time: 28_207_000 picoseconds.
-		Weight::from_parts(28_707_000, 3550)
+		// Minimum execution time: 30_994_000 picoseconds.
+		Weight::from_parts(31_979_000, 3550)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -669,8 +702,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `601`
 		//  Estimated: `3533`
-		// Minimum execution time: 31_813_000 picoseconds.
-		Weight::from_parts(32_612_000, 3533)
+		// Minimum execution time: 37_584_000 picoseconds.
+		Weight::from_parts(44_010_000, 3533)
 			.saturating_add(RocksDbWeight::get().reads(3_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -684,10 +717,10 @@ impl WeightInfo for () {
 	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
 	fn drop_history() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `829`
+		//  Measured:  `830`
 		//  Estimated: `3593`
-		// Minimum execution time: 38_571_000 picoseconds.
-		Weight::from_parts(39_493_000, 3593)
+		// Minimum execution time: 45_266_000 picoseconds.
+		Weight::from_parts(48_000_000, 3593)
 			.saturating_add(RocksDbWeight::get().reads(4_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -699,42 +732,53 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `525`
 		//  Estimated: `4698`
-		// Minimum execution time: 24_714_000 picoseconds.
-		Weight::from_parts(25_288_000, 4698)
+		// Minimum execution time: 25_365_000 picoseconds.
+		Weight::from_parts(26_920_000, 4698)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:0 w:1)
-	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:0 w:1)
 	/// The range of component `n` is `[0, 1000]`.
-	fn request_core_count(_n: u32, ) -> Weight {
+	fn request_core_count(n: u32, ) -> Weight {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 7_258_000 picoseconds.
-		Weight::from_parts(7_925_570, 0)
-			.saturating_add(RocksDbWeight::get().writes(1_u64))
+		// Minimum execution time: 6_519_000 picoseconds.
+		Weight::from_parts(7_098_698, 0)
+			// Standard Error: 20
+			.saturating_add(Weight::from_parts(8, 0).saturating_mul(n.into()))
 	}
-	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:0)
-	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:0)
+	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
 	/// The range of component `n` is `[0, 1000]`.
-	fn process_core_count(_n: u32, ) -> Weight {
-		// Proof Size summary in bytes:
-		//  Measured:  `97`
-		//  Estimated: `3562`
-		// Minimum execution time: 7_136_000 picoseconds.
-		Weight::from_parts(7_788_194, 3562)
+	fn process_core_count(n: u32, ) -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `98`
+		//  Estimated: `3563`
+		// Minimum execution time: 7_608_000 picoseconds.
+		Weight::from_parts(8_157_815, 3563)
+			// Standard Error: 26
+			.saturating_add(Weight::from_parts(48, 0).saturating_mul(n.into()))
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
+			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
-	/// Storage: `Broker::InstaPoolHistory` (r:0 w:1)
+	/// Storage: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	/// Storage: `Broker::InstaPoolHistory` (r:1 w:1)
 	/// Proof: `Broker::InstaPoolHistory` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`)
+	/// Storage: `System::Account` (r:1 w:1)
+	/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
+	/// Storage: `Authorship::Author` (r:1 w:0)
+	/// Proof: `Authorship::Author` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
+	/// Storage: `System::Digest` (r:1 w:0)
+	/// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
 	fn process_revenue() -> Weight {
 		// Proof Size summary in bytes:
-		//  Measured:  `0`
-		//  Estimated: `0`
-		// Minimum execution time: 6_049_000 picoseconds.
-		Weight::from_parts(6_311_000, 0)
-			.saturating_add(RocksDbWeight::get().writes(1_u64))
+		//  Measured:  `905`
+		//  Estimated: `4370`
+		// Minimum execution time: 59_993_000 picoseconds.
+		Weight::from_parts(61_752_000, 4370)
+			.saturating_add(RocksDbWeight::get().reads(5_u64))
+			.saturating_add(RocksDbWeight::get().writes(3_u64))
 	}
 	/// Storage: `Broker::InstaPoolIo` (r:3 w:3)
 	/// Proof: `Broker::InstaPoolIo` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`)
@@ -751,10 +795,10 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `6281`
 		//  Estimated: `8499`
-		// Minimum execution time: 47_504_000 picoseconds.
-		Weight::from_parts(49_778_098, 8499)
-			// Standard Error: 109
-			.saturating_add(Weight::from_parts(427, 0).saturating_mul(n.into()))
+		// Minimum execution time: 41_863_000 picoseconds.
+		Weight::from_parts(44_033_031, 8499)
+			// Standard Error: 116
+			.saturating_add(Weight::from_parts(764, 0).saturating_mul(n.into()))
 			.saturating_add(RocksDbWeight::get().reads(5_u64))
 			.saturating_add(RocksDbWeight::get().writes(15_u64))
 	}
@@ -766,8 +810,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `180`
 		//  Estimated: `3493`
-		// Minimum execution time: 9_573_000 picoseconds.
-		Weight::from_parts(10_034_000, 3493)
+		// Minimum execution time: 9_588_000 picoseconds.
+		Weight::from_parts(9_925_000, 3493)
 			.saturating_add(RocksDbWeight::get().reads(1_u64))
 			.saturating_add(RocksDbWeight::get().writes(1_u64))
 	}
@@ -779,8 +823,8 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `1423`
 		//  Estimated: `4681`
-		// Minimum execution time: 21_331_000 picoseconds.
-		Weight::from_parts(22_235_000, 4681)
+		// Minimum execution time: 19_308_000 picoseconds.
+		Weight::from_parts(20_482_000, 4681)
 			.saturating_add(RocksDbWeight::get().reads(2_u64))
 			.saturating_add(RocksDbWeight::get().writes(2_u64))
 	}
@@ -788,7 +832,24 @@ impl WeightInfo for () {
 		// Proof Size summary in bytes:
 		//  Measured:  `0`
 		//  Estimated: `0`
-		// Minimum execution time: 191_000 picoseconds.
-		Weight::from_parts(234_000, 0)
+		// Minimum execution time: 147_000 picoseconds.
+		Weight::from_parts(184_000, 0)
+	}
+	/// Storage: `Broker::Status` (r:1 w:1)
+	/// Proof: `Broker::Status` (`max_values`: Some(1), `max_size`: Some(18), added: 513, mode: `MaxEncodedLen`)
+	/// Storage: `Broker::Configuration` (r:1 w:0)
+	/// Proof: `Broker::Configuration` (`max_values`: Some(1), `max_size`: Some(31), added: 526, mode: `MaxEncodedLen`)
+	/// Storage: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0x18194fcb5c1fcace44d2d0a004272614` (r:1 w:1)
+	/// Storage: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	/// Proof: UNKNOWN KEY `0xf308d869daf021a7724e69c557dd8dbe` (r:1 w:1)
+	fn do_tick_base() -> Weight {
+		// Proof Size summary in bytes:
+		//  Measured:  `699`
+		//  Estimated: `4164`
+		// Minimum execution time: 19_824_000 picoseconds.
+		Weight::from_parts(20_983_000, 4164)
+			.saturating_add(RocksDbWeight::get().reads(4_u64))
+			.saturating_add(RocksDbWeight::get().writes(3_u64))
 	}
 }
-- 
GitLab