Whitelist Transactional key (#11394)

* Make constants public

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Whitelist the transactional layer

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* 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

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Oliver Tale-Yazdi
2022-05-12 03:34:38 +02:00
committed by GitHub
parent d06d20d65b
commit 0873e1703b
3 changed files with 80 additions and 92 deletions
+6
View File
@@ -1021,6 +1021,12 @@ macro_rules! impl_benchmark {
$crate::whitelisted_caller::<T::AccountId>()
);
whitelist.push(whitelisted_caller_key.into());
// Whitelist the transactional layer.
let transactional_layer_key = $crate::TrackedStorageKey::new(
$crate::frame_support::storage::transactional::TRANSACTION_LEVEL_KEY.into()
);
whitelist.push(transactional_layer_key);
$crate::benchmarking::set_whitelist(whitelist);
let mut results: $crate::Vec<$crate::BenchmarkResult> = $crate::Vec::new();
+71 -89
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-05-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-05-11, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
// Executed Command:
@@ -64,7 +64,6 @@ pub trait WeightInfo {
/// Weights for pallet_nomination_pools using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools MinJoinBond (r:1 w:0)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -79,11 +78,10 @@ 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 {
(119_253_000 as Weight)
.saturating_add(T::DbWeight::get().reads(18 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
(122_806_000 as Weight)
.saturating_add(T::DbWeight::get().reads(17 as Weight))
.saturating_add(T::DbWeight::get().writes(11 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
@@ -94,11 +92,10 @@ 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_157_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
(114_398_000 as Weight)
.saturating_add(T::DbWeight::get().reads(13 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
@@ -109,21 +106,19 @@ 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 {
(124_003_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
(128_370_000 as Weight)
.saturating_add(T::DbWeight::get().reads(13 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn claim_payout() -> Weight {
(51_767_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
(52_338_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
@@ -139,23 +134,21 @@ 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 {
(116_959_000 as Weight)
.saturating_add(T::DbWeight::get().reads(19 as Weight))
.saturating_add(T::DbWeight::get().writes(14 as Weight))
(120_866_000 as Weight)
.saturating_add(T::DbWeight::get().reads(18 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
(41_124_000 as Weight)
(42_038_000 as Weight)
// Standard Error: 0
.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))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -165,13 +158,12 @@ 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 {
(80_654_000 as Weight)
(83_220_000 as Weight)
// Standard Error: 0
.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))
.saturating_add((48_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(8 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -192,11 +184,10 @@ 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 {
(140_296_000 as Weight)
.saturating_add(T::DbWeight::get().reads(20 as Weight))
.saturating_add(T::DbWeight::get().writes(17 as Weight))
(143_981_000 as Weight)
.saturating_add(T::DbWeight::get().reads(19 as Weight))
.saturating_add(T::DbWeight::get().writes(16 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: NominationPools MinCreateBond (r:1 w:0)
// Storage: NominationPools MinJoinBond (r:1 w:0)
@@ -220,9 +211,9 @@ 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 {
(130_543_000 as Weight)
.saturating_add(T::DbWeight::get().reads(23 as Weight))
.saturating_add(T::DbWeight::get().writes(16 as Weight))
(134_974_000 as Weight)
.saturating_add(T::DbWeight::get().reads(22 as Weight))
.saturating_add(T::DbWeight::get().writes(15 as Weight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
@@ -237,9 +228,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 {
(46_152_000 as Weight)
// Standard Error: 15_000
.saturating_add((2_114_000 as Weight).saturating_mul(n as Weight))
(47_085_000 as Weight)
// Standard Error: 11_000
.saturating_add((2_222_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))
@@ -247,7 +238,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_544_000 as Weight)
(24_192_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -255,7 +246,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 {
(11_032_000 as Weight)
(11_448_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))
@@ -267,12 +258,12 @@ 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_910_000 as Weight)
(2_829_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)
(19_017_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -280,7 +271,6 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// For backwards compatibility and tests
impl WeightInfo for () {
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools MinJoinBond (r:1 w:0)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -295,11 +285,10 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn join() -> Weight {
(119_253_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(18 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
(122_806_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(17 as Weight))
.saturating_add(RocksDbWeight::get().writes(11 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
@@ -310,11 +299,10 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_transfer() -> Weight {
(110_157_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(14 as Weight))
.saturating_add(RocksDbWeight::get().writes(13 as Weight))
(114_398_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(13 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
@@ -325,21 +313,19 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:2 w:2)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_reward() -> Weight {
(124_003_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(14 as Weight))
.saturating_add(RocksDbWeight::get().writes(13 as Weight))
(128_370_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(13 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn claim_payout() -> Weight {
(51_767_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
(52_338_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
@@ -355,23 +341,21 @@ impl WeightInfo for () {
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
fn unbond() -> Weight {
(116_959_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(19 as Weight))
.saturating_add(RocksDbWeight::get().writes(14 as Weight))
(120_866_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(18 as Weight))
.saturating_add(RocksDbWeight::get().writes(13 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: Balances Locks (r:1 w:1)
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
(41_124_000 as Weight)
(42_038_000 as Weight)
// Standard Error: 0
.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))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -381,13 +365,12 @@ impl WeightInfo for () {
// Storage: System Account (r:1 w:1)
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(80_654_000 as Weight)
(83_220_000 as Weight)
// Standard Error: 0
.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))
.saturating_add((48_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -408,11 +391,10 @@ impl WeightInfo for () {
// Storage: NominationPools CounterForBondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
(140_296_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(20 as Weight))
.saturating_add(RocksDbWeight::get().writes(17 as Weight))
(143_981_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(19 as Weight))
.saturating_add(RocksDbWeight::get().writes(16 as Weight))
}
// Storage: unknown [0x3a7472616e73616374696f6e5f6c6576656c3a] (r:1 w:1)
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: NominationPools MinCreateBond (r:1 w:0)
// Storage: NominationPools MinJoinBond (r:1 w:0)
@@ -436,9 +418,9 @@ impl WeightInfo for () {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn create() -> Weight {
(130_543_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(23 as Weight))
.saturating_add(RocksDbWeight::get().writes(16 as Weight))
(134_974_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(22 as Weight))
.saturating_add(RocksDbWeight::get().writes(15 as Weight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
@@ -453,9 +435,9 @@ impl WeightInfo for () {
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: Staking CounterForNominators (r:1 w:1)
fn nominate(n: u32, ) -> Weight {
(46_152_000 as Weight)
// Standard Error: 15_000
.saturating_add((2_114_000 as Weight).saturating_mul(n as Weight))
(47_085_000 as Weight)
// Standard Error: 11_000
.saturating_add((2_222_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))
@@ -463,7 +445,7 @@ impl WeightInfo for () {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Ledger (r:1 w:0)
fn set_state() -> Weight {
(23_544_000 as Weight)
(24_192_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -471,7 +453,7 @@ impl WeightInfo for () {
// Storage: NominationPools Metadata (r:1 w:1)
// Storage: NominationPools CounterForMetadata (r:1 w:1)
fn set_metadata(n: u32, ) -> Weight {
(11_032_000 as Weight)
(11_448_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))
@@ -483,12 +465,12 @@ impl WeightInfo for () {
// Storage: NominationPools MinCreateBond (r:0 w:1)
// Storage: NominationPools MaxPools (r:0 w:1)
fn set_configs() -> Weight {
(2_910_000 as Weight)
(2_829_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)
(19_017_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
}
@@ -30,11 +30,11 @@ use sp_io::storage::{commit_transaction, rollback_transaction, start_transaction
use sp_runtime::{DispatchError, TransactionOutcome, TransactionalError};
/// The type that is being used to store the current number of active layers.
type Layer = u32;
pub type Layer = u32;
/// The key that is holds the current number of active layers.
const TRANSACTION_LEVEL_KEY: &[u8] = b":transaction_level:";
pub const TRANSACTION_LEVEL_KEY: &[u8] = b":transaction_level:";
/// The maximum number of nested layers.
const TRANSACTIONAL_LIMIT: Layer = 255;
pub const TRANSACTIONAL_LIMIT: Layer = 255;
/// Returns the current number of nested transactional layers.
fn get_transaction_level() -> Layer {