Skip to content

Commit

Permalink
run bench
Browse files Browse the repository at this point in the history
  • Loading branch information
nanocryk committed Oct 5, 2023
1 parent 0c8de04 commit 77d1df3
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 55 deletions.
32 changes: 18 additions & 14 deletions pallets/pooled-staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,8 @@ mod benchmarks {

let source_stake = min_candidate_stk::<T>() * 10u32.into();

let (caller, _deposit_amount) = create_funded_user::<T>("caller", USER_SEED, source_stake * 2u32.into());
let (caller, _deposit_amount) =
create_funded_user::<T>("caller", USER_SEED, source_stake * 2u32.into());

T::EligibleCandidatesFilter::make_candidate_eligible(&caller, true);

Expand All @@ -554,26 +555,29 @@ mod benchmarks {

PooledStaking::<T>::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::<T>(&caller, source_stake));
crate::pools::distribute_rewards::<T>(&caller, source_stake)?;
}

Ok(())
Expand Down
117 changes: 76 additions & 41 deletions pallets/pooled-staking/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -82,8 +83,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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))
}
Expand All @@ -102,10 +103,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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))
Expand All @@ -124,8 +125,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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))
}
Expand All @@ -138,10 +139,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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))
Expand All @@ -158,8 +159,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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))
}
Expand All @@ -174,10 +175,10 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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))
Expand All @@ -190,11 +191,28 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// 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
Expand All @@ -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))
}
Expand All @@ -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))
Expand All @@ -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))
}
Expand All @@ -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))
Expand All @@ -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))
}
Expand All @@ -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))
Expand All @@ -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))
}
}

0 comments on commit 77d1df3

Please sign in to comment.