Skip to content

Commit

Permalink
Add missing parameter to base bench
Browse files Browse the repository at this point in the history
  • Loading branch information
HCastano committed Aug 21, 2024
1 parent f5b1150 commit f8a357c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
5 changes: 3 additions & 2 deletions pallets/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,12 +539,13 @@ pub mod pallet {
pub fn new_session_handler(
validators: &[<T as pallet_session::Config>::ValidatorId],
) -> Result<Weight, DispatchError> {
let mut weight: Weight = <T as Config>::WeightInfo::new_session_base_weight();

let mut current_signers = Self::signers();
let current_signers_length = current_signers.len();
let signers_info = pallet_parameters::Pallet::<T>::signers_info();

let mut weight: Weight =
<T as Config>::WeightInfo::new_session_base_weight(current_signers_length as u32);

// Since not enough validators do not allow rotation
// TODO: https://github.com/entropyxyz/entropy-core/issues/943
if validators.len() <= current_signers_length {
Expand Down
32 changes: 17 additions & 15 deletions pallets/staking/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub trait WeightInfo {
fn declare_synced() -> Weight;
fn confirm_key_reshare_confirmed(c: u32) -> Weight;
fn confirm_key_reshare_completed() -> Weight;
fn new_session_base_weight() -> Weight;
fn new_session_base_weight(s: u32) -> Weight;
fn new_session(c: u32, l: u32) -> Weight;
}

Expand Down Expand Up @@ -194,14 +194,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
}
/// Storage: `StakingExtension::Signers` (r:1 w:0)
/// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn new_session_base_weight() -> Weight {
fn new_session_base_weight(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `234`
// Estimated: `1719`
// Minimum execution time: 4_000_000 picoseconds.
Weight::from_parts(4_000_000, 0)
.saturating_add(Weight::from_parts(0, 1719))
.saturating_add(T::DbWeight::get().reads(1))
// Measured: `254 + s * (32 ±0)`
// Estimated: `1739 + s * (32 ±0)`
// Minimum execution time: 7_000_000 picoseconds.
Weight::from_parts(7_682_879, 0)
.saturating_add(Weight::from_parts(0, 1739))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(s.into()))
}
/// Storage: `StakingExtension::Signers` (r:1 w:0)
/// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
Expand Down Expand Up @@ -366,14 +367,15 @@ impl WeightInfo for () {
}
/// Storage: `StakingExtension::Signers` (r:1 w:0)
/// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
fn new_session_base_weight() -> Weight {
fn new_session_base_weight(s: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `234`
// Estimated: `1719`
// Minimum execution time: 4_000_000 picoseconds.
Weight::from_parts(4_000_000, 0)
.saturating_add(Weight::from_parts(0, 1719))
.saturating_add(RocksDbWeight::get().reads(1))
// Measured: `254 + s * (32 ±0)`
// Estimated: `1739 + s * (32 ±0)`
// Minimum execution time: 7_000_000 picoseconds.
Weight::from_parts(7_682_879, 0)
.saturating_add(Weight::from_parts(0, 1739))
.saturating_add(RocksDbWeight::get().reads(2))
.saturating_add(Weight::from_parts(0, 32).saturating_mul(s.into()))
}
/// Storage: `StakingExtension::Signers` (r:1 w:0)
/// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
Expand Down

0 comments on commit f8a357c

Please sign in to comment.