From 77d1df30b31df56d523a4c401b21024ac08f6142 Mon Sep 17 00:00:00 2001 From: nanocryk <6422796+nanocryk@users.noreply.github.com> Date: Thu, 5 Oct 2023 10:25:08 +0200 Subject: [PATCH] run bench --- pallets/pooled-staking/src/benchmarking.rs | 32 +++--- pallets/pooled-staking/src/weights.rs | 117 +++++++++++++-------- 2 files changed, 94 insertions(+), 55 deletions(-) diff --git a/pallets/pooled-staking/src/benchmarking.rs b/pallets/pooled-staking/src/benchmarking.rs index e78b2f95b..74cb15317 100644 --- a/pallets/pooled-staking/src/benchmarking.rs +++ b/pallets/pooled-staking/src/benchmarking.rs @@ -531,7 +531,8 @@ mod benchmarks { let source_stake = min_candidate_stk::() * 10u32.into(); - let (caller, _deposit_amount) = create_funded_user::("caller", USER_SEED, source_stake * 2u32.into()); + let (caller, _deposit_amount) = + create_funded_user::("caller", USER_SEED, source_stake * 2u32.into()); T::EligibleCandidatesFilter::make_candidate_eligible(&caller, true); @@ -554,26 +555,29 @@ mod benchmarks { PooledStaking::::execute_pending_operations( RawOrigin::Signed(caller.clone()).into(), - vec![PendingOperationQuery { - delegator: caller.clone(), - operation: JoiningAutoCompounding { - candidate: caller.clone(), - at: timer.clone(), + vec![ + PendingOperationQuery { + delegator: caller.clone(), + operation: JoiningAutoCompounding { + candidate: caller.clone(), + at: timer.clone(), + }, }, - }, PendingOperationQuery { - delegator: caller.clone(), - operation: JoiningManualRewards { - candidate: caller.clone(), - at: timer.clone(), + PendingOperationQuery { + delegator: caller.clone(), + operation: JoiningManualRewards { + candidate: caller.clone(), + at: timer.clone(), + }, }, - }], + ], )?; - T::Currency::mint_into(&caller, source_stake).unwrap(); + T::Currency::mint_into(&T::StakingAccount::get(), source_stake).unwrap(); #[block] { - frame_support::assert_ok!(crate::pools::distribute_rewards::(&caller, source_stake)); + crate::pools::distribute_rewards::(&caller, source_stake)?; } Ok(()) diff --git a/pallets/pooled-staking/src/weights.rs b/pallets/pooled-staking/src/weights.rs index df5d16d6e..5af329ca1 100644 --- a/pallets/pooled-staking/src/weights.rs +++ b/pallets/pooled-staking/src/weights.rs @@ -18,7 +18,7 @@ //! Autogenerated weights for pallet_pooled_staking //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-10-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `pop-os`, CPU: `12th Gen Intel(R) Core(TM) i7-1260P` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 @@ -59,6 +59,7 @@ pub trait WeightInfo { fn rebalance_hold() -> Weight; fn update_candidate_position(b: u32, ) -> Weight; fn swap_pool() -> Weight; + fn distribute_rewards() -> Weight; } /// Weights for pallet_pooled_staking using the Substrate node and recommended hardware. @@ -82,8 +83,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1321` // Estimated: `29536` - // Minimum execution time: 148_140_000 picoseconds. - Weight::from_parts(196_694_000, 29536) + // Minimum execution time: 127_339_000 picoseconds. + Weight::from_parts(133_146_000, 29536) .saturating_add(T::DbWeight::get().reads(17_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -102,10 +103,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `543 + b * (390 ±0)` // Estimated: `3593 + b * (25141 ±0)` - // Minimum execution time: 97_115_000 picoseconds. - Weight::from_parts(103_358_000, 3593) - // Standard Error: 243_606 - .saturating_add(Weight::from_parts(97_506_690, 0).saturating_mul(b.into())) + // Minimum execution time: 89_544_000 picoseconds. + Weight::from_parts(91_417_000, 3593) + // Standard Error: 630_031 + .saturating_add(Weight::from_parts(99_103_944, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().reads((11_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -124,8 +125,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `724` // Estimated: `33889` - // Minimum execution time: 125_481_000 picoseconds. - Weight::from_parts(142_689_000, 33889) + // Minimum execution time: 111_997_000 picoseconds. + Weight::from_parts(124_683_000, 33889) .saturating_add(T::DbWeight::get().reads(16_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } @@ -138,10 +139,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `360 + b * (456 ±0)` // Estimated: `6196 + b * (7882 ±0)` - // Minimum execution time: 67_358_000 picoseconds. - Weight::from_parts(62_976_252, 6196) - // Standard Error: 364_479 - .saturating_add(Weight::from_parts(51_801_209, 0).saturating_mul(b.into())) + // Minimum execution time: 57_580_000 picoseconds. + Weight::from_parts(60_814_000, 6196) + // Standard Error: 421_370 + .saturating_add(Weight::from_parts(55_273_020, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((3_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -158,8 +159,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `980` // Estimated: `11870` - // Minimum execution time: 94_217_000 picoseconds. - Weight::from_parts(109_367_000, 11870) + // Minimum execution time: 98_014_000 picoseconds. + Weight::from_parts(128_615_000, 11870) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -174,10 +175,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `399 + b * (356 ±0)` // Estimated: `1881 + b * (15206 ±0)` - // Minimum execution time: 43_231_000 picoseconds. - Weight::from_parts(56_401_000, 1881) - // Standard Error: 91_302 - .saturating_add(Weight::from_parts(35_820_280, 0).saturating_mul(b.into())) + // Minimum execution time: 46_082_000 picoseconds. + Weight::from_parts(60_293_000, 1881) + // Standard Error: 131_937 + .saturating_add(Weight::from_parts(35_500_124, 0).saturating_mul(b.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((7_u64).saturating_mul(b.into()))) .saturating_add(T::DbWeight::get().writes(1_u64)) @@ -190,11 +191,28 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `478` // Estimated: `31168` - // Minimum execution time: 87_575_000 picoseconds. - Weight::from_parts(91_480_000, 31168) + // Minimum execution time: 80_829_000 picoseconds. + Weight::from_parts(97_569_000, 31168) .saturating_add(T::DbWeight::get().reads(12_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } + /// Storage: PooledStaking Pools (r:9 w:5) + /// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured) + /// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1) + /// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn distribute_rewards() -> Weight { + // Proof Size summary in bytes: + // Measured: `1302` + // Estimated: `24567` + // Minimum execution time: 151_254_000 picoseconds. + Weight::from_parts(178_410_000, 24567) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().writes(8_u64)) + } } // For backwards compatibility and tests @@ -217,8 +235,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1321` // Estimated: `29536` - // Minimum execution time: 148_140_000 picoseconds. - Weight::from_parts(196_694_000, 29536) + // Minimum execution time: 127_339_000 picoseconds. + Weight::from_parts(133_146_000, 29536) .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -237,10 +255,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `543 + b * (390 ±0)` // Estimated: `3593 + b * (25141 ±0)` - // Minimum execution time: 97_115_000 picoseconds. - Weight::from_parts(103_358_000, 3593) - // Standard Error: 243_606 - .saturating_add(Weight::from_parts(97_506_690, 0).saturating_mul(b.into())) + // Minimum execution time: 89_544_000 picoseconds. + Weight::from_parts(91_417_000, 3593) + // Standard Error: 630_031 + .saturating_add(Weight::from_parts(99_103_944, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().reads((11_u64).saturating_mul(b.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -259,8 +277,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `724` // Estimated: `33889` - // Minimum execution time: 125_481_000 picoseconds. - Weight::from_parts(142_689_000, 33889) + // Minimum execution time: 111_997_000 picoseconds. + Weight::from_parts(124_683_000, 33889) .saturating_add(RocksDbWeight::get().reads(16_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } @@ -273,10 +291,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `360 + b * (456 ±0)` // Estimated: `6196 + b * (7882 ±0)` - // Minimum execution time: 67_358_000 picoseconds. - Weight::from_parts(62_976_252, 6196) - // Standard Error: 364_479 - .saturating_add(Weight::from_parts(51_801_209, 0).saturating_mul(b.into())) + // Minimum execution time: 57_580_000 picoseconds. + Weight::from_parts(60_814_000, 6196) + // Standard Error: 421_370 + .saturating_add(Weight::from_parts(55_273_020, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((3_u64).saturating_mul(b.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -293,8 +311,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `980` // Estimated: `11870` - // Minimum execution time: 94_217_000 picoseconds. - Weight::from_parts(109_367_000, 11870) + // Minimum execution time: 98_014_000 picoseconds. + Weight::from_parts(128_615_000, 11870) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -309,10 +327,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `399 + b * (356 ±0)` // Estimated: `1881 + b * (15206 ±0)` - // Minimum execution time: 43_231_000 picoseconds. - Weight::from_parts(56_401_000, 1881) - // Standard Error: 91_302 - .saturating_add(Weight::from_parts(35_820_280, 0).saturating_mul(b.into())) + // Minimum execution time: 46_082_000 picoseconds. + Weight::from_parts(60_293_000, 1881) + // Standard Error: 131_937 + .saturating_add(Weight::from_parts(35_500_124, 0).saturating_mul(b.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((7_u64).saturating_mul(b.into()))) .saturating_add(RocksDbWeight::get().writes(1_u64)) @@ -325,9 +343,26 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `478` // Estimated: `31168` - // Minimum execution time: 87_575_000 picoseconds. - Weight::from_parts(91_480_000, 31168) + // Minimum execution time: 80_829_000 picoseconds. + Weight::from_parts(97_569_000, 31168) .saturating_add(RocksDbWeight::get().reads(12_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } + /// Storage: PooledStaking Pools (r:9 w:5) + /// Proof Skipped: PooledStaking Pools (max_values: None, max_size: None, mode: Measured) + /// Storage: PooledStaking SortedEligibleCandidates (r:1 w:1) + /// Proof Skipped: PooledStaking SortedEligibleCandidates (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: Session NextKeys (r:1 w:0) + /// Proof Skipped: Session NextKeys (max_values: None, max_size: None, mode: Measured) + /// Storage: System Account (r:2 w:2) + /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + fn distribute_rewards() -> Weight { + // Proof Size summary in bytes: + // Measured: `1302` + // Estimated: `24567` + // Minimum execution time: 151_254_000 picoseconds. + Weight::from_parts(178_410_000, 24567) + .saturating_add(RocksDbWeight::get().reads(13_u64)) + .saturating_add(RocksDbWeight::get().writes(8_u64)) + } }