fix a few more things with nomination pools (#11373)

* fix a few more things with nomination pools

* add bench

* use weight fn

* cargo run --quiet --profile=production  --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark pallet --chain=dev --steps=50 --repeat=20 --pallet=pallet_nomination_pools --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/nomination-pools/src/weights.rs --template=./.maintain/frame-weight-template.hbs

* allow real root to also set roles

* Update frame/nomination-pools/src/lib.rs

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

* Update frame/nomination-pools/src/lib.rs

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

* move out of the closure

* fix a few more things

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Kian Paimani
2022-05-10 17:34:59 +01:00
committed by GitHub
parent 6e0ba2da8b
commit ce2124795a
5 changed files with 310 additions and 55 deletions
+48 -35
View File
@@ -18,7 +18,7 @@
//! Autogenerated weights for pallet_nomination_pools
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-04-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-05-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
@@ -58,6 +58,7 @@ pub trait WeightInfo {
fn set_state() -> Weight;
fn set_metadata(n: u32, ) -> Weight;
fn set_configs() -> Weight;
fn update_roles() -> Weight;
}
/// Weights for pallet_nomination_pools using the Substrate node and recommended hardware.
@@ -78,7 +79,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn join() -> Weight {
(117_870_000 as Weight)
(119_253_000 as Weight)
.saturating_add(T::DbWeight::get().reads(18 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
}
@@ -93,7 +94,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_transfer() -> Weight {
(110_176_000 as Weight)
(110_157_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
}
@@ -108,7 +109,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListNodes (r:2 w:2)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_reward() -> Weight {
(122_829_000 as Weight)
(124_003_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
}
@@ -118,7 +119,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools RewardPools (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn claim_payout() -> Weight {
(50_094_000 as Weight)
(51_767_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
@@ -138,7 +139,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
fn unbond() -> Weight {
(119_288_000 as Weight)
(116_959_000 as Weight)
.saturating_add(T::DbWeight::get().reads(19 as Weight))
.saturating_add(T::DbWeight::get().writes(14 as Weight))
}
@@ -148,9 +149,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
(39_986_000 as Weight)
(41_124_000 as Weight)
// Standard Error: 0
.saturating_add((50_000 as Weight).saturating_mul(s as Weight))
.saturating_add((52_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -164,9 +165,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Account (r:1 w:1)
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(76_897_000 as Weight)
(80_654_000 as Weight)
// Standard Error: 0
.saturating_add((48_000 as Weight).saturating_mul(s as Weight))
.saturating_add((50_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(9 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
}
@@ -191,7 +192,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools CounterForBondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
(135_837_000 as Weight)
(140_296_000 as Weight)
.saturating_add(T::DbWeight::get().reads(20 as Weight))
.saturating_add(T::DbWeight::get().writes(17 as Weight))
}
@@ -219,7 +220,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn create() -> Weight {
(129_265_000 as Weight)
(130_543_000 as Weight)
.saturating_add(T::DbWeight::get().reads(23 as Weight))
.saturating_add(T::DbWeight::get().writes(16 as Weight))
}
@@ -236,9 +237,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForNominators (r:1 w:1)
fn nominate(n: u32, ) -> Weight {
(45_546_000 as Weight)
// Standard Error: 11_000
.saturating_add((2_075_000 as Weight).saturating_mul(n as Weight))
(46_152_000 as Weight)
// Standard Error: 15_000
.saturating_add((2_114_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
@@ -246,7 +247,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Ledger (r:1 w:0)
fn set_state() -> Weight {
(23_256_000 as Weight)
(23_544_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -254,7 +255,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools Metadata (r:1 w:1)
// Storage: NominationPools CounterForMetadata (r:1 w:1)
fn set_metadata(n: u32, ) -> Weight {
(10_893_000 as Weight)
(11_032_000 as Weight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
@@ -266,9 +267,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools MinCreateBond (r:0 w:1)
// Storage: NominationPools MaxPools (r:0 w:1)
fn set_configs() -> Weight {
(2_793_000 as Weight)
(2_910_000 as Weight)
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
// Storage: NominationPools BondedPools (r:1 w:1)
fn update_roles() -> Weight {
(18_608_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
// For backwards compatibility and tests
@@ -288,7 +295,7 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn join() -> Weight {
(117_870_000 as Weight)
(119_253_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(18 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
}
@@ -303,7 +310,7 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_transfer() -> Weight {
(110_176_000 as Weight)
(110_157_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(14 as Weight))
.saturating_add(RocksDbWeight::get().writes(13 as Weight))
}
@@ -318,7 +325,7 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:2 w:2)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_reward() -> Weight {
(122_829_000 as Weight)
(124_003_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(14 as Weight))
.saturating_add(RocksDbWeight::get().writes(13 as Weight))
}
@@ -328,7 +335,7 @@ impl WeightInfo for () {
// Storage: NominationPools RewardPools (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn claim_payout() -> Weight {
(50_094_000 as Weight)
(51_767_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
@@ -348,7 +355,7 @@ impl WeightInfo for () {
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
fn unbond() -> Weight {
(119_288_000 as Weight)
(116_959_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(19 as Weight))
.saturating_add(RocksDbWeight::get().writes(14 as Weight))
}
@@ -358,9 +365,9 @@ impl WeightInfo for () {
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
(39_986_000 as Weight)
(41_124_000 as Weight)
// Standard Error: 0
.saturating_add((50_000 as Weight).saturating_mul(s as Weight))
.saturating_add((52_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
}
@@ -374,9 +381,9 @@ impl WeightInfo for () {
// Storage: System Account (r:1 w:1)
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(76_897_000 as Weight)
(80_654_000 as Weight)
// Standard Error: 0
.saturating_add((48_000 as Weight).saturating_mul(s as Weight))
.saturating_add((50_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(9 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
}
@@ -401,7 +408,7 @@ impl WeightInfo for () {
// Storage: NominationPools CounterForBondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
(135_837_000 as Weight)
(140_296_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(20 as Weight))
.saturating_add(RocksDbWeight::get().writes(17 as Weight))
}
@@ -429,7 +436,7 @@ impl WeightInfo for () {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn create() -> Weight {
(129_265_000 as Weight)
(130_543_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(23 as Weight))
.saturating_add(RocksDbWeight::get().writes(16 as Weight))
}
@@ -446,9 +453,9 @@ impl WeightInfo for () {
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForNominators (r:1 w:1)
fn nominate(n: u32, ) -> Weight {
(45_546_000 as Weight)
// Standard Error: 11_000
.saturating_add((2_075_000 as Weight).saturating_mul(n as Weight))
(46_152_000 as Weight)
// Standard Error: 15_000
.saturating_add((2_114_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
@@ -456,7 +463,7 @@ impl WeightInfo for () {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Ledger (r:1 w:0)
fn set_state() -> Weight {
(23_256_000 as Weight)
(23_544_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -464,7 +471,7 @@ impl WeightInfo for () {
// Storage: NominationPools Metadata (r:1 w:1)
// Storage: NominationPools CounterForMetadata (r:1 w:1)
fn set_metadata(n: u32, ) -> Weight {
(10_893_000 as Weight)
(11_032_000 as Weight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
@@ -476,7 +483,13 @@ impl WeightInfo for () {
// Storage: NominationPools MinCreateBond (r:0 w:1)
// Storage: NominationPools MaxPools (r:0 w:1)
fn set_configs() -> Weight {
(2_793_000 as Weight)
(2_910_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
}
// Storage: NominationPools BondedPools (r:1 w:1)
fn update_roles() -> Weight {
(18_608_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
}