diff --git a/CHANGELOG.md b/CHANGELOG.md index 299523c18..f8151e4c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ At the moment this project **does not** adhere to cleaned up. A lot of storage entries, events, and extrinsics were removed from the `Registry` pallet. The genesis build config was also removed. Additionally, the `new/user/` HTTP endpoint in the TSS was removed since it was no longer necessary. +- In [#1031](https://github.com/entropyxyz/entropy-core/pull/1031), more Staking calls were blocked + to go through the `staking_extention` pallet. This makes sure no funds can be unbonded from a + validator if they are currently in the signing comittee. This was applied to `unbond`, `chill`, + and `withdraw_unbonded` - In [#1045](https://github.com/entropyxyz/entropy-core/pull/1045), `ProgramsInfo` now takes `version_number` to maintain backwards compatibility if programs runtime is updated - In [#1050](https://github.com/entropyxyz/entropy-core/pull/1050), the flow for signing has changed. A user now sends their request to any validator that is not a signer. This will act as a relayer. @@ -45,6 +49,7 @@ At the moment this project **does not** adhere to ### Changed - Fix TSS `AccountId` keys in chainspec ([#993](https://github.com/entropyxyz/entropy-core/pull/993)) +- No unbonding when signer or next signer ([#1031](https://github.com/entropyxyz/entropy-core/pull/1031)) - Add relay tx endpoint ([#1050](https://github.com/entropyxyz/entropy-core/pull/1050)) ### Removed diff --git a/crates/client/entropy_metadata.scale b/crates/client/entropy_metadata.scale index 3c2856de6..d6d04ba7e 100644 Binary files a/crates/client/entropy_metadata.scale and b/crates/client/entropy_metadata.scale differ diff --git a/pallets/staking/src/benchmarking.rs b/pallets/staking/src/benchmarking.rs index 088342a9a..3b9d612b9 100644 --- a/pallets/staking/src/benchmarking.rs +++ b/pallets/staking/src/benchmarking.rs @@ -15,23 +15,25 @@ //! Benchmarking setup for pallet-propgation #![allow(unused_imports)] +use super::*; +#[allow(unused_imports)] +use crate::Pallet as Staking; use entropy_shared::MAX_SIGNERS; use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller}; use frame_support::{ assert_ok, ensure, sp_runtime::traits::StaticLookup, - traits::{Currency, Get}, + traits::{Currency, Defensive, Get}, BoundedVec, }; use frame_system::{EventRecord, RawOrigin}; use pallet_parameters::{SignersInfo, SignersSize}; -use pallet_staking::{Pallet as FrameStaking, RewardDestination, ValidatorPrefs}; +use pallet_staking::{ + Event as FrameStakingEvent, MaxNominationsOf, Nominations, Pallet as FrameStaking, + RewardDestination, ValidatorPrefs, +}; use sp_std::{vec, vec::Vec}; -use super::*; -#[allow(unused_imports)] -use crate::Pallet as Staking; - const NULL_ARR: [u8; 32] = [0; 32]; const SEED: u32 = 0; @@ -43,6 +45,16 @@ fn assert_last_event(generic_event: ::RuntimeEvent) { assert_eq!(event, &system_event); } +fn assert_last_event_frame_staking( + generic_event: ::RuntimeEvent, +) { + let events = frame_system::Pallet::::events(); + let system_event: ::RuntimeEvent = generic_event.into(); + // compare to the last event record + let EventRecord { event, .. } = &events[events.len() - 1]; + assert_eq!(event, &system_event); +} + pub fn create_validators( count: u32, seed: u32, @@ -130,13 +142,88 @@ benchmarks! { assert_last_event::(Event::::ThresholdAccountChanged(bonder, server_info).into()); } + unbond { + let s in 0 .. MAX_SIGNERS as u32; + let n in 0 .. MaxNominationsOf::::get(); + + let caller: T::AccountId = whitelisted_caller(); + let validator_id_res = ::ValidatorId::try_from(caller.clone()).or(Err(Error::::InvalidValidatorId)).unwrap(); + let bonder: T::AccountId = account("bond", 0, SEED); + let threshold: T::AccountId = account("threshold", 0, SEED); + + let signers = vec![validator_id_res.clone(); s as usize]; + Signers::::put(signers.clone()); + NextSigners::::put(NextSignerInfo { + next_signers: signers, + confirmations: vec![], + }); + + prep_bond_and_validate::(true, caller.clone(), bonder.clone(), threshold.clone(), NULL_ARR); + + let targets = BoundedVec::try_from(vec![threshold.clone(); n as usize]).unwrap(); + let nominations = Nominations { targets, submitted_in: 0, suppressed: false }; + pallet_staking::Nominators::::insert(bonder.clone(), nominations); + }: _(RawOrigin::Signed(bonder.clone()), 10u32.into()) + verify { + assert_last_event_frame_staking::(FrameStakingEvent::Unbonded{ stash: bonder, amount: 10u32.into() }.into() ); + + } + + chill { + let c in 0 .. MAX_SIGNERS as u32; + let n in 0 .. MaxNominationsOf::::get(); + + let caller: T::AccountId = whitelisted_caller(); + let validator_id_res = ::ValidatorId::try_from(caller.clone()).or(Err(Error::::InvalidValidatorId)).unwrap(); + let bonder: T::AccountId = account("bond", 0, SEED); + let threshold: T::AccountId = account("threshold", 0, SEED); + + let signers = vec![validator_id_res.clone(); c as usize]; + Signers::::put(signers.clone()); + NextSigners::::put(NextSignerInfo { + next_signers: signers, + confirmations: vec![], + }); + + prep_bond_and_validate::(true, caller.clone(), bonder.clone(), threshold.clone(), NULL_ARR); + let bond = ::Currency::minimum_balance() * 10u32.into(); + + // assume fully unbonded as slightly more weight, but not enough to handle partial unbond + assert_ok!(>::unbond( + RawOrigin::Signed(bonder.clone()).into(), + bond, + )); + + let targets = BoundedVec::try_from(vec![threshold.clone(); n as usize]).unwrap(); + let nominations = Nominations { targets, submitted_in: 0, suppressed: false }; + pallet_staking::Nominators::::insert(bonder.clone(), nominations); + + let _ = pallet_staking::Validators::::clear(100, None); + + }: _(RawOrigin::Signed(bonder.clone())) + verify { + assert_last_event_frame_staking::(FrameStakingEvent::Chilled{ stash: bonder }.into() ); + + } + withdraw_unbonded { + let c in 0 .. MAX_SIGNERS as u32; + let n in 0 .. MaxNominationsOf::::get(); + let caller: T::AccountId = whitelisted_caller(); let bonder: T::AccountId = account("bond", 0, SEED); let threshold: T::AccountId = account("threshold", 0, SEED); + let validator_id_res = ::ValidatorId::try_from(caller.clone()).or(Err(Error::::InvalidValidatorId)).unwrap(); - prep_bond_and_validate::(true, caller.clone(), bonder.clone(), threshold, NULL_ARR); + let signers = vec![validator_id_res.clone(); c as usize]; + Signers::::put(signers.clone()); + NextSigners::::put(NextSignerInfo { + next_signers: signers, + confirmations: vec![], + }); + + prep_bond_and_validate::(true, caller.clone(), bonder.clone(), threshold.clone(), NULL_ARR); let bond = ::Currency::minimum_balance() * 10u32.into(); // assume fully unbonded as slightly more weight, but not enough to handle partial unbond @@ -145,6 +232,9 @@ benchmarks! { bond, )); + let targets = BoundedVec::try_from(vec![threshold.clone(); n as usize]).unwrap(); + let nominations = Nominations { targets, submitted_in: 0, suppressed: false }; + pallet_staking::Nominators::::insert(bonder.clone(), nominations); }: _(RawOrigin::Signed(bonder.clone()), 0u32) verify { diff --git a/pallets/staking/src/lib.rs b/pallets/staking/src/lib.rs index 85b51ae5a..c83e94eef 100644 --- a/pallets/staking/src/lib.rs +++ b/pallets/staking/src/lib.rs @@ -35,7 +35,7 @@ use core::convert::TryInto; pub use pallet::*; -use pallet_staking::ValidatorPrefs; +use pallet_staking::{MaxNominationsOf, ValidatorPrefs}; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; @@ -307,6 +307,10 @@ pub mod pallet { NotNextSigner, ReshareNotInProgress, AlreadyConfirmed, + NoUnbondingWhenSigner, + NoUnbondingWhenNextSigner, + NoUnnominatingWhenSigner, + NoUnnominatingWhenNextSigner, } #[pallet::event] @@ -400,9 +404,46 @@ pub mod pallet { Ok(()) } - /// Wraps's substrate withdraw unbonded but clears extra state if fully unbonded + /// Wraps's Substrate's `unbond` extrinsic but checks to make sure targeted account is not a signer or next signer #[pallet::call_index(2)] - #[pallet::weight(::WeightInfo::withdraw_unbonded())] + #[pallet::weight(::WeightInfo::unbond(MAX_SIGNERS as u32, MaxNominationsOf::::get()))] + pub fn unbond( + origin: OriginFor, + #[pallet::compact] value: BalanceOf, + ) -> DispatchResultWithPostInfo { + let controller = ensure_signed(origin.clone())?; + let ledger = + pallet_staking::Pallet::::ledger(StakingAccount::Controller(controller.clone())) + .map_err(|_| Error::::NoThresholdKey)?; + + let (signers_length, nominators_length) = + Self::ensure_not_signer_or_next_signer_or_nominating(&ledger.stash)?; + + pallet_staking::Pallet::::unbond(origin, value)?; + + Ok(Some(::WeightInfo::unbond(signers_length, nominators_length)).into()) + } + + /// Wraps's Substrate's `chill` extrinsic but checks to make sure the targeted account is not a signer or next signer + #[pallet::call_index(3)] + #[pallet::weight(::WeightInfo::chill(MAX_SIGNERS as u32, MaxNominationsOf::::get()))] + pub fn chill(origin: OriginFor) -> DispatchResultWithPostInfo { + let controller = ensure_signed(origin.clone())?; + let ledger = + pallet_staking::Pallet::::ledger(StakingAccount::Controller(controller.clone())) + .map_err(|_| Error::::NoThresholdKey)?; + + let (signers_length, nominators_length) = + Self::ensure_not_signer_or_next_signer_or_nominating(&ledger.stash)?; + + pallet_staking::Pallet::::chill(origin)?; + + Ok(Some(::WeightInfo::chill(signers_length, nominators_length)).into()) + } + + /// Wraps's Substrate's `withdraw_unbonded` extrinsic but clears extra state if fully unbonded + #[pallet::call_index(4)] + #[pallet::weight(::WeightInfo::withdraw_unbonded(MAX_SIGNERS as u32, MaxNominationsOf::::get()))] pub fn withdraw_unbonded( origin: OriginFor, num_slashing_spans: u32, @@ -412,8 +453,12 @@ pub mod pallet { pallet_staking::Pallet::::ledger(StakingAccount::Controller(controller.clone())) .map_err(|_| Error::::NoThresholdKey)?; - let validator_id = ::ValidatorId::try_from(ledger.stash) - .or(Err(Error::::InvalidValidatorId))?; + let validator_id = + ::ValidatorId::try_from(ledger.stash.clone()) + .or(Err(Error::::InvalidValidatorId))?; + + let (signers_length, nominators_length) = + Self::ensure_not_signer_or_next_signer_or_nominating(&ledger.stash)?; pallet_staking::Pallet::::withdraw_unbonded(origin, num_slashing_spans)?; // TODO: do not allow unbonding of validator if not enough validators https://github.com/entropyxyz/entropy-core/issues/942 @@ -424,7 +469,11 @@ pub mod pallet { IsValidatorSynced::::remove(&validator_id); Self::deposit_event(Event::NodeInfoRemoved(controller)); } - Ok(().into()) + Ok(Some(::WeightInfo::withdraw_unbonded( + signers_length, + nominators_length, + )) + .into()) } /// Wrap's Substrate's `staking_pallet::validate()` extrinsic, but enforces that @@ -432,7 +481,7 @@ pub mod pallet { /// /// Note that - just like the original `validate()` extrinsic - the effects of this are /// only applied in the following era. - #[pallet::call_index(3)] + #[pallet::call_index(5)] #[pallet::weight(::WeightInfo::validate())] pub fn validate( origin: OriginFor, @@ -471,7 +520,7 @@ pub mod pallet { /// Let a validator declare if their kvdb is synced or not synced /// `synced`: State of validator's kvdb - #[pallet::call_index(4)] + #[pallet::call_index(6)] #[pallet::weight(::WeightInfo::declare_synced())] pub fn declare_synced(origin: OriginFor, synced: bool) -> DispatchResult { let who = ensure_signed(origin.clone())?; @@ -481,7 +530,7 @@ pub mod pallet { Ok(()) } - #[pallet::call_index(5)] + #[pallet::call_index(7)] #[pallet::weight(({ ::WeightInfo::confirm_key_reshare_confirmed(MAX_SIGNERS as u32) .max(::WeightInfo::confirm_key_reshare_completed()) @@ -531,6 +580,47 @@ pub mod pallet { Ok(ledger.stash) } + /// Ensures that the current validator is not a signer or a next signer + pub fn ensure_not_signer_or_next_signer_or_nominating( + stash: &T::AccountId, + ) -> Result<(u32, u32), DispatchError> { + let nominations = pallet_staking::Nominators::::get(stash) + .map_or_else(Vec::new, |x| x.targets.into_inner()); + + let signers = Self::signers(); + + // Check if the validator_id or any nominated validator is in signers + let in_signers = |id: &T::AccountId| { + let validator_id = ::ValidatorId::try_from(id.clone()); + match validator_id { + Ok(v_id) => signers.contains(&v_id), + Err(_) => false, + } + }; + + ensure!(!in_signers(stash), Error::::NoUnbondingWhenSigner); + ensure!(!nominations.iter().any(in_signers), Error::::NoUnnominatingWhenSigner); + + if let Some(next_signers) = Self::next_signers() { + let next_signers_contains = |id: &T::AccountId| { + let validator_id = + ::ValidatorId::try_from(id.clone()); + match validator_id { + Ok(v_id) => next_signers.next_signers.contains(&v_id), + Err(_) => false, + } + }; + + ensure!(!next_signers_contains(stash), Error::::NoUnbondingWhenNextSigner); + ensure!( + !nominations.iter().any(next_signers_contains), + Error::::NoUnnominatingWhenNextSigner + ); + } + + Ok((signers.len() as u32, nominations.len() as u32)) + } + pub fn get_randomness() -> ChaCha20Rng { let phrase = b"signer_rotation"; // TODO: Is randomness freshness an issue here diff --git a/pallets/staking/src/mock.rs b/pallets/staking/src/mock.rs index 9ab987bfd..716132b87 100644 --- a/pallets/staking/src/mock.rs +++ b/pallets/staking/src/mock.rs @@ -397,7 +397,7 @@ impl pallet_parameters::Config for Test { pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = system::GenesisConfig::::default().build_storage().unwrap(); let pallet_balances = pallet_balances::GenesisConfig:: { - balances: vec![(1, 100), (2, 100), (3, 100), (4, 100)], + balances: vec![(1, 100), (2, 100), (3, 100), (4, 100), (7, 100), (8, 100), (9, 200)], }; let pallet_staking_extension = pallet_staking_extension::GenesisConfig:: { // (ValidatorID, (AccountId, X25519PublicKey, TssServerURL, VerifyingKey)) diff --git a/pallets/staking/src/tests.rs b/pallets/staking/src/tests.rs index 7f1c21ba1..70c0c80a5 100644 --- a/pallets/staking/src/tests.rs +++ b/pallets/staking/src/tests.rs @@ -286,7 +286,7 @@ fn it_will_not_allow_existing_tss_account_when_changing_threshold_account() { #[test] fn it_deletes_when_no_bond_left() { new_test_ext().execute_with(|| { - Signers::::put(vec![5, 6]); + Signers::::put(vec![5, 6, 7]); start_active_era(1); assert_ok!(FrameStaking::bond( RuntimeOrigin::signed(2), @@ -359,6 +359,49 @@ fn it_deletes_when_no_bond_left() { assert_eq!(Staking::threshold_to_stash(3), None); // validator no longer synced assert_eq!(Staking::is_validator_synced(2), false); + + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(7), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + + assert_noop!( + Staking::withdraw_unbonded(RuntimeOrigin::signed(7), 0), + Error::::NoUnbondingWhenSigner + ); + + // test nominating flow + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(9), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + assert_ok!(FrameStaking::nominate(RuntimeOrigin::signed(9), vec![7])); + assert_noop!( + Staking::withdraw_unbonded(RuntimeOrigin::signed(9), 0), + Error::::NoUnnominatingWhenSigner + ); + + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(8), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + + NextSigners::::put(NextSignerInfo { next_signers: vec![8], confirmations: vec![] }); + + assert_noop!( + Staking::withdraw_unbonded(RuntimeOrigin::signed(8), 0), + Error::::NoUnbondingWhenNextSigner + ); + + // test nominating flow + assert_ok!(FrameStaking::nominate(RuntimeOrigin::signed(9), vec![8])); + assert_noop!( + Staking::withdraw_unbonded(RuntimeOrigin::signed(9), 0), + Error::::NoUnnominatingWhenNextSigner + ); }); } @@ -507,3 +550,103 @@ fn it_confirms_keyshare() { assert_eq!(Staking::signers(), [6, 5], "next signers rotated into current signers"); }); } + +#[test] +fn it_stops_unbonded_when_signer_or_next_signer() { + new_test_ext().execute_with(|| { + Signers::::put(vec![7]); + start_active_era(1); + + // test nominating flow + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(9), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + assert_ok!(FrameStaking::nominate(RuntimeOrigin::signed(9), vec![7])); + assert_noop!( + Staking::unbond(RuntimeOrigin::signed(9), 100u64), + Error::::NoUnnominatingWhenSigner + ); + + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(7), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + + assert_noop!( + Staking::unbond(RuntimeOrigin::signed(7), 0), + Error::::NoUnbondingWhenSigner + ); + + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(8), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + + NextSigners::::put(NextSignerInfo { next_signers: vec![8], confirmations: vec![] }); + assert_noop!( + Staking::unbond(RuntimeOrigin::signed(8), 0), + Error::::NoUnbondingWhenNextSigner + ); + + // test nominating flow + assert_ok!(FrameStaking::nominate(RuntimeOrigin::signed(9), vec![8])); + assert_noop!( + Staking::unbond(RuntimeOrigin::signed(9), 100u64), + Error::::NoUnnominatingWhenNextSigner + ); + }); +} + +#[test] +fn it_stops_chill_when_signer_or_next_signer() { + new_test_ext().execute_with(|| { + Signers::::put(vec![7]); + start_active_era(1); + + // test nominating flow + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(9), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + assert_ok!(FrameStaking::nominate(RuntimeOrigin::signed(9), vec![7])); + assert_noop!( + Staking::chill(RuntimeOrigin::signed(9)), + Error::::NoUnnominatingWhenSigner + ); + + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(7), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + + assert_noop!( + Staking::chill(RuntimeOrigin::signed(7)), + Error::::NoUnbondingWhenSigner + ); + + assert_ok!(FrameStaking::bond( + RuntimeOrigin::signed(8), + 100u64, + pallet_staking::RewardDestination::Account(1), + )); + + NextSigners::::put(NextSignerInfo { next_signers: vec![8], confirmations: vec![] }); + + assert_noop!( + Staking::chill(RuntimeOrigin::signed(8)), + Error::::NoUnbondingWhenNextSigner + ); + // test nominating flow + assert_ok!(FrameStaking::nominate(RuntimeOrigin::signed(9), vec![8])); + assert_noop!( + Staking::chill(RuntimeOrigin::signed(9)), + Error::::NoUnnominatingWhenNextSigner + ); + }); +} diff --git a/pallets/staking/src/weights.rs b/pallets/staking/src/weights.rs index 25be1c558..fedc25021 100644 --- a/pallets/staking/src/weights.rs +++ b/pallets/staking/src/weights.rs @@ -54,7 +54,9 @@ use core::marker::PhantomData; pub trait WeightInfo { fn change_endpoint() -> Weight; fn change_threshold_accounts() -> Weight; - fn withdraw_unbonded() -> Weight; + fn chill(c: u32, n: u32) -> Weight; + fn unbond(c: u32, n: u32) -> Weight; + fn withdraw_unbonded(c: u32, n: u32) -> Weight; fn validate() -> Weight; fn declare_synced() -> Weight; fn confirm_key_reshare_confirmed(c: u32) -> Weight; @@ -96,22 +98,117 @@ impl WeightInfo for SubstrateWeight { } /// Storage: `Staking::Ledger` (r:1 w:1) /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) /// Storage: `Staking::CurrentEra` (r:1 w:0) /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Balances::Locks` (r:1 w:1) /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) /// Storage: `Balances::Freezes` (r:1 w:0) - /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(193), added: 2668, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn withdraw_unbonded() -> Weight { + /// Storage: `BagsList::ListNodes` (r:1 w:1) + /// Proof: `BagsList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn unbond(s: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1039` - // Estimated: `4764` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(41_000_000, 4764) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) + // Measured: `1986 + n * (32 ±0) + s * (64 ±0)` + // Estimated: `4764 + n * (32 ±0) + s * (64 ±0)` + // Minimum execution time: 72_000_000 picoseconds. + Weight::from_parts(71_588_925, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 254_432 + .saturating_add(Weight::from_parts(266_286, 0).saturating_mul(s.into())) + // Standard Error: 244_899 + .saturating_add(Weight::from_parts(241_693, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(s.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BagsList::ListNodes` (r:2 w:2) + /// Proof: `BagsList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `BagsList::ListBags` (r:1 w:1) + /// Proof: `BagsList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `BagsList::CounterForListNodes` (r:1 w:1) + /// Proof: `BagsList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn chill(c: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1864 + c * (64 ±0) + n * (32 ±0)` + // Estimated: `6248 + c * (64 ±0) + n * (32 ±0)` + // Minimum execution time: 59_000_000 picoseconds. + Weight::from_parts(57_194_136, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 195_789 + .saturating_add(Weight::from_parts(161_563, 0).saturating_mul(c.into())) + // Standard Error: 188_454 + .saturating_add(Weight::from_parts(295_602, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(193), added: 2668, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn withdraw_unbonded(c: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1534 + c * (64 ±0) + n * (32 ±0)` + // Estimated: `4764 + c * (64 ±0) + n * (32 ±0)` + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(47_473_941, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 190_804 + .saturating_add(Weight::from_parts(73_615, 0).saturating_mul(c.into())) + // Standard Error: 183_655 + .saturating_add(Weight::from_parts(405_456, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(9)) + .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) } /// Storage: `Staking::Ledger` (r:1 w:0) /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) @@ -269,22 +366,117 @@ impl WeightInfo for () { } /// Storage: `Staking::Ledger` (r:1 w:1) /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) /// Storage: `Staking::CurrentEra` (r:1 w:0) /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Balances::Locks` (r:1 w:1) /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) /// Storage: `Balances::Freezes` (r:1 w:0) - /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(193), added: 2668, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn withdraw_unbonded() -> Weight { + /// Storage: `BagsList::ListNodes` (r:1 w:1) + /// Proof: `BagsList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn unbond(s: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1039` - // Estimated: `4764` - // Minimum execution time: 40_000_000 picoseconds. - Weight::from_parts(41_000_000, 4764) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) + // Measured: `1986 + n * (32 ±0) + s * (64 ±0)` + // Estimated: `4764 + n * (32 ±0) + s * (64 ±0)` + // Minimum execution time: 72_000_000 picoseconds. + Weight::from_parts(71_588_925, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 254_432 + .saturating_add(Weight::from_parts(266_286, 0).saturating_mul(s.into())) + // Standard Error: 244_899 + .saturating_add(Weight::from_parts(241_693, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(11)) + .saturating_add(RocksDbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(s.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BagsList::ListNodes` (r:2 w:2) + /// Proof: `BagsList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `BagsList::ListBags` (r:1 w:1) + /// Proof: `BagsList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `BagsList::CounterForListNodes` (r:1 w:1) + /// Proof: `BagsList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn chill(c: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1864 + c * (64 ±0) + n * (32 ±0)` + // Estimated: `6248 + c * (64 ±0) + n * (32 ±0)` + // Minimum execution time: 59_000_000 picoseconds. + Weight::from_parts(57_194_136, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 195_789 + .saturating_add(Weight::from_parts(161_563, 0).saturating_mul(c.into())) + // Standard Error: 188_454 + .saturating_add(Weight::from_parts(295_602, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(11)) + .saturating_add(RocksDbWeight::get().writes(6)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(193), added: 2668, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn withdraw_unbonded(c: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1534 + c * (64 ±0) + n * (32 ±0)` + // Estimated: `4764 + c * (64 ±0) + n * (32 ±0)` + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(47_473_941, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 190_804 + .saturating_add(Weight::from_parts(73_615, 0).saturating_mul(c.into())) + // Standard Error: 183_655 + .saturating_add(Weight::from_parts(405_456, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads(9)) + .saturating_add(RocksDbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) } /// Storage: `Staking::Ledger` (r:1 w:0) /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index d5a469662..5985de516 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -318,6 +318,8 @@ impl Contains for BaseCallFilter { call, RuntimeCall::Staking(pallet_staking::Call::withdraw_unbonded { .. }) | RuntimeCall::Staking(pallet_staking::Call::validate { .. }) + | RuntimeCall::Staking(pallet_staking::Call::unbond { .. }) + | RuntimeCall::Staking(pallet_staking::Call::chill { .. }) ); if is_paused || system_reject { // no paused call diff --git a/runtime/src/weights/pallet_staking_extension.rs b/runtime/src/weights/pallet_staking_extension.rs index f3232611b..158c1fb48 100644 --- a/runtime/src/weights/pallet_staking_extension.rs +++ b/runtime/src/weights/pallet_staking_extension.rs @@ -16,9 +16,9 @@ //! Autogenerated weights for `pallet_staking_extension` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 33.0.0 -//! DATE: 2024-08-21, STEPS: `5`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2024-09-21, STEPS: `5`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `hcastano`, CPU: `` +//! HOSTNAME: `Jesses-MacBook-Pro.local`, CPU: `` //! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024 // Executed Command: @@ -55,8 +55,8 @@ impl pallet_staking_extension::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `1309` // Estimated: `4774` - // Minimum execution time: 28_000_000 picoseconds. - Weight::from_parts(30_000_000, 0) + // Minimum execution time: 24_000_000 picoseconds. + Weight::from_parts(26_000_000, 0) .saturating_add(Weight::from_parts(0, 4774)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(1)) @@ -73,8 +73,8 @@ impl pallet_staking_extension::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `1430` // Estimated: `4895` - // Minimum execution time: 31_000_000 picoseconds. - Weight::from_parts(32_000_000, 0) + // Minimum execution time: 28_000_000 picoseconds. + Weight::from_parts(28_000_000, 0) .saturating_add(Weight::from_parts(0, 4895)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) @@ -83,6 +83,14 @@ impl pallet_staking_extension::WeightInfo for WeightInf /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) /// Storage: `Staking::Bonded` (r:1 w:0) /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::MinNominatorBond` (r:1 w:0) + /// Proof: `Staking::MinNominatorBond` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) /// Storage: `Staking::CurrentEra` (r:1 w:0) /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `Balances::Locks` (r:1 w:1) @@ -91,15 +99,99 @@ impl pallet_staking_extension::WeightInfo for WeightInf /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(193), added: 2668, mode: `MaxEncodedLen`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - fn withdraw_unbonded() -> Weight { + /// Storage: `BagsList::ListNodes` (r:1 w:1) + /// Proof: `BagsList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// The range of component `s` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn unbond(s: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1262` - // Estimated: `4764` - // Minimum execution time: 45_000_000 picoseconds. - Weight::from_parts(48_000_000, 0) + // Measured: `1986 + n * (32 ±0) + s * (64 ±0)` + // Estimated: `4764 + n * (32 ±0) + s * (64 ±0)` + // Minimum execution time: 72_000_000 picoseconds. + Weight::from_parts(71_588_925, 0) .saturating_add(Weight::from_parts(0, 4764)) - .saturating_add(T::DbWeight::get().reads(6)) + // Standard Error: 254_432 + .saturating_add(Weight::from_parts(266_286, 0).saturating_mul(s.into())) + // Standard Error: 244_899 + .saturating_add(Weight::from_parts(241_693, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(4)) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(s.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:0) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:1) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::Validators` (r:1 w:0) + /// Proof: `Staking::Validators` (`max_values`: None, `max_size`: Some(45), added: 2520, mode: `MaxEncodedLen`) + /// Storage: `Staking::CounterForNominators` (r:1 w:1) + /// Proof: `Staking::CounterForNominators` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BagsList::ListNodes` (r:2 w:2) + /// Proof: `BagsList::ListNodes` (`max_values`: None, `max_size`: Some(154), added: 2629, mode: `MaxEncodedLen`) + /// Storage: `BagsList::ListBags` (r:1 w:1) + /// Proof: `BagsList::ListBags` (`max_values`: None, `max_size`: Some(82), added: 2557, mode: `MaxEncodedLen`) + /// Storage: `BagsList::CounterForListNodes` (r:1 w:1) + /// Proof: `BagsList::CounterForListNodes` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn chill(c: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1864 + c * (64 ±0) + n * (32 ±0)` + // Estimated: `6248 + c * (64 ±0) + n * (32 ±0)` + // Minimum execution time: 59_000_000 picoseconds. + Weight::from_parts(57_194_136, 0) + .saturating_add(Weight::from_parts(0, 6248)) + // Standard Error: 195_789 + .saturating_add(Weight::from_parts(161_563, 0).saturating_mul(c.into())) + // Standard Error: 188_454 + .saturating_add(Weight::from_parts(295_602, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(11)) + .saturating_add(T::DbWeight::get().writes(6)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) + } + /// Storage: `Staking::Ledger` (r:1 w:1) + /// Proof: `Staking::Ledger` (`max_values`: None, `max_size`: Some(1091), added: 3566, mode: `MaxEncodedLen`) + /// Storage: `Staking::Bonded` (r:1 w:0) + /// Proof: `Staking::Bonded` (`max_values`: None, `max_size`: Some(72), added: 2547, mode: `MaxEncodedLen`) + /// Storage: `Staking::Nominators` (r:1 w:0) + /// Proof: `Staking::Nominators` (`max_values`: None, `max_size`: Some(558), added: 3033, mode: `MaxEncodedLen`) + /// Storage: `StakingExtension::Signers` (r:1 w:0) + /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::NextSigners` (r:1 w:0) + /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Staking::CurrentEra` (r:1 w:0) + /// Proof: `Staking::CurrentEra` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(193), added: 2668, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `c` is `[0, 15]`. + /// The range of component `n` is `[0, 16]`. + fn withdraw_unbonded(c: u32, n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1534 + c * (64 ±0) + n * (32 ±0)` + // Estimated: `4764 + c * (64 ±0) + n * (32 ±0)` + // Minimum execution time: 47_000_000 picoseconds. + Weight::from_parts(47_473_941, 0) + .saturating_add(Weight::from_parts(0, 4764)) + // Standard Error: 190_804 + .saturating_add(Weight::from_parts(73_615, 0).saturating_mul(c.into())) + // Standard Error: 183_655 + .saturating_add(Weight::from_parts(405_456, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(3)) + .saturating_add(Weight::from_parts(0, 64).saturating_mul(c.into())) + .saturating_add(Weight::from_parts(0, 32).saturating_mul(n.into())) } /// Storage: `StakingExtension::ThresholdToStash` (r:1 w:1) /// Proof: `StakingExtension::ThresholdToStash` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -131,8 +223,8 @@ impl pallet_staking_extension::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `1918` // Estimated: `6248` - // Minimum execution time: 76_000_000 picoseconds. - Weight::from_parts(184_000_000, 0) + // Minimum execution time: 64_000_000 picoseconds. + Weight::from_parts(66_000_000, 0) .saturating_add(Weight::from_parts(0, 6248)) .saturating_add(T::DbWeight::get().reads(13)) .saturating_add(T::DbWeight::get().writes(8)) @@ -145,8 +237,8 @@ impl pallet_staking_extension::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `320` // Estimated: `3785` - // Minimum execution time: 11_000_000 picoseconds. - Weight::from_parts(13_000_000, 0) + // Minimum execution time: 9_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) .saturating_add(Weight::from_parts(0, 3785)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -160,11 +252,11 @@ impl pallet_staking_extension::WeightInfo for WeightInf // Proof Size summary in bytes: // Measured: `797 + c * (32 ±0)` // Estimated: `4298 + c * (29 ±1)` - // Minimum execution time: 13_000_000 picoseconds. - Weight::from_parts(14_248_618, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(11_715_469, 0) .saturating_add(Weight::from_parts(0, 4298)) - // Standard Error: 122_082 - .saturating_add(Weight::from_parts(90_469, 0).saturating_mul(c.into())) + // Standard Error: 48_988 + .saturating_add(Weight::from_parts(11_740, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) .saturating_add(Weight::from_parts(0, 29).saturating_mul(c.into())) @@ -175,15 +267,17 @@ impl pallet_staking_extension::WeightInfo for WeightInf /// Proof: `StakingExtension::NextSigners` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `StakingExtension::Signers` (r:0 w:1) /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `StakingExtension::RotateKeyshares` (r:0 w:1) + /// Proof: `StakingExtension::RotateKeyshares` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn confirm_key_reshare_completed() -> Weight { // Proof Size summary in bytes: // Measured: `1309` // Estimated: `4774` - // Minimum execution time: 14_000_000 picoseconds. - Weight::from_parts(14_000_000, 0) + // Minimum execution time: 11_000_000 picoseconds. + Weight::from_parts(13_000_000, 0) .saturating_add(Weight::from_parts(0, 4774)) .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) + .saturating_add(T::DbWeight::get().writes(3)) } /// Storage: `StakingExtension::Signers` (r:1 w:0) /// Proof: `StakingExtension::Signers` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -192,11 +286,11 @@ impl pallet_staking_extension::WeightInfo for WeightInf /// The range of component `s` is `[2, 15]`. fn new_session_base_weight(s: u32, ) -> Weight { // Proof Size summary in bytes: - // 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)) + // Measured: `266 + s * (32 ±0)` + // Estimated: `1751 + s * (32 ±0)` + // Minimum execution time: 5_000_000 picoseconds. + Weight::from_parts(6_171_206, 0) + .saturating_add(Weight::from_parts(0, 1751)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(s.into())) } @@ -218,13 +312,13 @@ impl pallet_staking_extension::WeightInfo for WeightInf /// The range of component `l` is `[0, 15]`. fn new_session(c: u32, _l: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `482 + c * (32 ±0)` - // Estimated: `1966 + c * (32 ±0)` - // Minimum execution time: 15_000_000 picoseconds. - Weight::from_parts(16_252_259, 0) - .saturating_add(Weight::from_parts(0, 1966)) - // Standard Error: 101_760 - .saturating_add(Weight::from_parts(74_486, 0).saturating_mul(c.into())) + // Measured: `494 + c * (32 ±0)` + // Estimated: `1978 + c * (32 ±0)` + // Minimum execution time: 12_000_000 picoseconds. + Weight::from_parts(12_883_398, 0) + .saturating_add(Weight::from_parts(0, 1978)) + // Standard Error: 33_391 + .saturating_add(Weight::from_parts(69_713, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) .saturating_add(Weight::from_parts(0, 32).saturating_mul(c.into()))