mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 20:48:02 +00:00
Bump Nominator Reward Limits (#1668)
* Add reward limits * Fix weight tests and whatnot * add weight files * Update runtime/kusama/src/lib.rs * "Update Substrate" Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: parity-processbot <>
This commit is contained in:
Generated
+134
-134
File diff suppressed because it is too large
Load Diff
@@ -317,7 +317,7 @@ parameter_types! {
|
||||
// 27 eras in which slashes can be cancelled (slightly less than 7 days).
|
||||
pub const SlashDeferDuration: pallet_staking::EraIndex = 27;
|
||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 256;
|
||||
// quarter of the last session will be for election.
|
||||
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
|
||||
pub const MaxIterations: u32 = 10;
|
||||
@@ -352,7 +352,7 @@ impl pallet_staking::Trait for Runtime {
|
||||
type UnsignedPriority = StakingUnsignedPriority;
|
||||
type MaxIterations = MaxIterations;
|
||||
type MinSolutionScoreBump = MinSolutionScoreBump;
|
||||
type WeightInfo = ();
|
||||
type WeightInfo = weights::pallet_staking::WeightInfo;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -20,6 +20,7 @@ pub mod frame_system;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_collective;
|
||||
pub mod pallet_democracy;
|
||||
pub mod pallet_staking;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_utility;
|
||||
pub mod pallet_proxy;
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Default weights of pallet-staking.
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
pub struct WeightInfo;
|
||||
impl pallet_staking::WeightInfo for WeightInfo {
|
||||
fn bond() -> Weight {
|
||||
(144278000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn bond_extra() -> Weight {
|
||||
(110715000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn unbond() -> Weight {
|
||||
(99840000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
||||
(100728000 as Weight)
|
||||
.saturating_add((63000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
||||
(168879000 as Weight)
|
||||
.saturating_add((6666000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn validate() -> Weight {
|
||||
(35539000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn nominate(n: u32, ) -> Weight {
|
||||
(48596000 as Weight)
|
||||
.saturating_add((308000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn chill() -> Weight {
|
||||
(35144000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn set_payee() -> Weight {
|
||||
(24255000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn set_controller() -> Weight {
|
||||
(52294000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn set_validator_count() -> Weight {
|
||||
(5185000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_no_eras() -> Weight {
|
||||
(5907000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_new_era() -> Weight {
|
||||
(5917000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_new_era_always() -> Weight {
|
||||
(5952000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn set_invulnerables(v: u32, ) -> Weight {
|
||||
(6324000 as Weight)
|
||||
.saturating_add((9000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_unstake(s: u32, ) -> Weight {
|
||||
(119691000 as Weight)
|
||||
.saturating_add((6681000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
||||
(5820201000 as Weight)
|
||||
.saturating_add((34672000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((92486000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
||||
}
|
||||
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((117324000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
||||
}
|
||||
fn rebond(l: u32, ) -> Weight {
|
||||
(71316000 as Weight)
|
||||
.saturating_add((142000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn set_history_depth(e: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((51901000 as Weight).saturating_mul(e as Weight))
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
|
||||
}
|
||||
fn reap_stash(s: u32, ) -> Weight {
|
||||
(147166000 as Weight)
|
||||
.saturating_add((6661000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn new_era(v: u32, n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((1440459000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((182580000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(10 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
|
||||
}
|
||||
fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((964000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((432000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add((204294000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add((9546000 as Weight).saturating_mul(w as Weight))
|
||||
.saturating_add(DbWeight::get().reads(6 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight)))
|
||||
.saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight)))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ parameter_types! {
|
||||
pub const BondingDuration: pallet_staking::EraIndex = 28;
|
||||
pub const SlashDeferDuration: pallet_staking::EraIndex = 27;
|
||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 64;
|
||||
pub const MaxNominatorRewardedPerValidator: u32 = 256;
|
||||
// last 15 minutes of the last session will be for election.
|
||||
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 16;
|
||||
pub const MaxIterations: u32 = 10;
|
||||
@@ -361,7 +361,7 @@ impl pallet_staking::Trait for Runtime {
|
||||
type UnsignedPriority = StakingUnsignedPriority;
|
||||
type MaxIterations = MaxIterations;
|
||||
type MinSolutionScoreBump = MinSolutionScoreBump;
|
||||
type WeightInfo = ();
|
||||
type WeightInfo = weights::pallet_staking::WeightInfo;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -20,6 +20,7 @@ pub mod frame_system;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_collective;
|
||||
pub mod pallet_democracy;
|
||||
pub mod pallet_staking;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_utility;
|
||||
pub mod pallet_proxy;
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Default weights of pallet-staking.
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
pub struct WeightInfo;
|
||||
impl pallet_staking::WeightInfo for WeightInfo {
|
||||
fn bond() -> Weight {
|
||||
(144278000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn bond_extra() -> Weight {
|
||||
(110715000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn unbond() -> Weight {
|
||||
(99840000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
||||
(100728000 as Weight)
|
||||
.saturating_add((63000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
||||
(168879000 as Weight)
|
||||
.saturating_add((6666000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn validate() -> Weight {
|
||||
(35539000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn nominate(n: u32, ) -> Weight {
|
||||
(48596000 as Weight)
|
||||
.saturating_add((308000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn chill() -> Weight {
|
||||
(35144000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn set_payee() -> Weight {
|
||||
(24255000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn set_controller() -> Weight {
|
||||
(52294000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn set_validator_count() -> Weight {
|
||||
(5185000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_no_eras() -> Weight {
|
||||
(5907000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_new_era() -> Weight {
|
||||
(5917000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_new_era_always() -> Weight {
|
||||
(5952000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn set_invulnerables(v: u32, ) -> Weight {
|
||||
(6324000 as Weight)
|
||||
.saturating_add((9000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_unstake(s: u32, ) -> Weight {
|
||||
(119691000 as Weight)
|
||||
.saturating_add((6681000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
||||
(5820201000 as Weight)
|
||||
.saturating_add((34672000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((92486000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
||||
}
|
||||
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((117324000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
||||
}
|
||||
fn rebond(l: u32, ) -> Weight {
|
||||
(71316000 as Weight)
|
||||
.saturating_add((142000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn set_history_depth(e: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((51901000 as Weight).saturating_mul(e as Weight))
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
|
||||
}
|
||||
fn reap_stash(s: u32, ) -> Weight {
|
||||
(147166000 as Weight)
|
||||
.saturating_add((6661000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn new_era(v: u32, n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((1440459000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((182580000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(10 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
|
||||
}
|
||||
fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((964000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((432000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add((204294000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add((9546000 as Weight).saturating_mul(w as Weight))
|
||||
.saturating_add(DbWeight::get().reads(6 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight)))
|
||||
.saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight)))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,17 @@
|
||||
//! weights in Substrate will change. Instead they are supposed to provide
|
||||
//! some sort of indicator that calls we consider important (e.g pallet_balances::transfer)
|
||||
//! have not suddenly changed from under us.
|
||||
//!
|
||||
//! Some of the tests in this crate print insightful logs. Run with:
|
||||
//!
|
||||
//! ```
|
||||
//! $ cargo test -p polkadot-runtime -- --nocapture --test-threads=1
|
||||
//! ```
|
||||
|
||||
use codec::Encode;
|
||||
use frame_support::{
|
||||
traits::ContainsLengthBound,
|
||||
weights::{constants::*, GetDispatchInfo, Weight},
|
||||
weights::{constants::*, GetDispatchInfo, Weight, DispatchInfo},
|
||||
};
|
||||
use keyring::AccountKeyring;
|
||||
use polkadot_runtime::constants::currency::*;
|
||||
@@ -40,10 +47,26 @@ use pallet_treasury::Call as TreasuryCall;
|
||||
|
||||
type DbWeight = <Runtime as frame_system::Trait>::DbWeight;
|
||||
|
||||
|
||||
fn report_portion(name: &'static str, info: DispatchInfo, len: usize) {
|
||||
let maximum_weight = <Runtime as frame_system::Trait>::MaximumBlockWeight::get();
|
||||
let fee = sp_io::TestExternalities::new(Default::default()).execute_with(|| {
|
||||
<pallet_transaction_payment::Module<Runtime>>::compute_fee(len as u32, &info, 0)
|
||||
});
|
||||
|
||||
let portion = info.weight as f64 / maximum_weight as f64;
|
||||
|
||||
if portion > 0.5 {
|
||||
panic!("Weight of some call seem to have exceeded half of the block. Probably something is wrong.");
|
||||
}
|
||||
|
||||
println!("\nCall {} (with default args) takes {} of the block weight, pays {} in fee.", name, portion, fee);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sanity_check_weight_per_time_constants_are_as_expected() {
|
||||
// These values comes from Substrate, we want to make sure that if it
|
||||
// ever changes we don't accidently break Polkadot
|
||||
// ever changes we don't accidentally break Polkadot
|
||||
assert_eq!(WEIGHT_PER_SECOND, 1_000_000_000_000);
|
||||
assert_eq!(WEIGHT_PER_MILLIS, WEIGHT_PER_SECOND / 1000);
|
||||
assert_eq!(WEIGHT_PER_MICROS, WEIGHT_PER_MILLIS / 1000);
|
||||
@@ -54,37 +77,64 @@ fn sanity_check_weight_per_time_constants_are_as_expected() {
|
||||
fn weight_of_staking_bond_is_correct() {
|
||||
let controller: AccountId = AccountKeyring::Alice.into();
|
||||
|
||||
// #[weight = 67 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(5, 4)]
|
||||
let expected_weight = 67 * WEIGHT_PER_MICROS + (DbWeight::get().read * 5) + (DbWeight::get().write * 4);
|
||||
let weight = StakingCall::bond::<Runtime>(controller, 1 * DOLLARS, Default::default()).get_dispatch_info().weight;
|
||||
// (144278000 as Weight)
|
||||
// .saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
// .saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
let expected_weight = 144278000 + (DbWeight::get().read * 5) + (DbWeight::get().write * 4);
|
||||
let call = StakingCall::bond::<Runtime>(controller, 1 * DOLLARS, Default::default());
|
||||
let info = call.get_dispatch_info();
|
||||
|
||||
assert_eq!(weight, expected_weight);
|
||||
assert_eq!(info.weight, expected_weight);
|
||||
report_portion("staking_bond", info, call.encode().len())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn weight_of_staking_validate_is_correct() {
|
||||
// #[weight = 17 * WEIGHT_PER_MICROS + T::DbWeight::get().reads_writes(2, 2)]
|
||||
let expected_weight = 17 * WEIGHT_PER_MICROS + (DbWeight::get().read * 2) + (DbWeight::get().write * 2);
|
||||
let weight = StakingCall::validate::<Runtime>(Default::default()).get_dispatch_info().weight;
|
||||
// (35539000 as Weight)
|
||||
// .saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
// .saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
let expected_weight = 35539000 + (DbWeight::get().read * 2) + (DbWeight::get().write * 2);
|
||||
let call = StakingCall::validate::<Runtime>(Default::default());
|
||||
let info = call.get_dispatch_info();
|
||||
|
||||
assert_eq!(weight, expected_weight);
|
||||
assert_eq!(info.weight, expected_weight);
|
||||
report_portion("staking_validate", info, call.encode().len())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn weight_of_staking_nominate_is_correct() {
|
||||
let targets: Vec<AccountId> = vec![Default::default(), Default::default(), Default::default()];
|
||||
|
||||
// #[weight = T::DbWeight::get().reads_writes(3, 2)
|
||||
// .saturating_add(22 * WEIGHT_PER_MICROS)
|
||||
// .saturating_add((360 * WEIGHT_PER_NANOS).saturating_mul(targets.len() as Weight))
|
||||
// ]
|
||||
// (48596000 as Weight)
|
||||
// .saturating_add((308000 as Weight).saturating_mul(n as Weight))
|
||||
// .saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
// .saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
let db_weight = (DbWeight::get().read * 3) + (DbWeight::get().write * 2);
|
||||
let targets_weight = (360 * WEIGHT_PER_NANOS).saturating_mul(targets.len() as Weight);
|
||||
let targets_weight = (308 * WEIGHT_PER_NANOS).saturating_mul(targets.len() as Weight);
|
||||
|
||||
let expected_weight = db_weight.saturating_add(22 * WEIGHT_PER_MICROS).saturating_add(targets_weight);
|
||||
let weight = StakingCall::nominate::<Runtime>(targets).get_dispatch_info().weight;
|
||||
let expected_weight = db_weight.saturating_add(48596000).saturating_add(targets_weight);
|
||||
let call = StakingCall::nominate::<Runtime>(targets);
|
||||
let info = call.get_dispatch_info();
|
||||
|
||||
assert_eq!(weight, expected_weight);
|
||||
assert_eq!(info.weight, expected_weight);
|
||||
report_portion("staking_nominate", info, call.encode().len())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn weight_of_staking_payout_staker_is_correct() {
|
||||
// (0 as Weight)
|
||||
// .saturating_add((117324000 as Weight).saturating_mul(n as Weight))
|
||||
// .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
|
||||
// .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
||||
let call = StakingCall::payout_stakers::<Runtime>(Default::default(), 0u32);
|
||||
let info = call.get_dispatch_info();
|
||||
|
||||
let n = <Runtime as pallet_staking::Trait>::MaxNominatorRewardedPerValidator::get() as Weight;
|
||||
let mut expected_weight = (117324000 as Weight).saturating_mul(n as Weight);
|
||||
expected_weight += (DbWeight::get().read * 5 * n) + (DbWeight::get().write * 3 * n);
|
||||
|
||||
assert_eq!(info.weight, expected_weight);
|
||||
report_portion("staking_payout_stakers", info, call.encode().len())
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -324,7 +324,7 @@ impl pallet_staking::Trait for Runtime {
|
||||
type UnsignedPriority = StakingUnsignedPriority;
|
||||
type MaxIterations = MaxIterations;
|
||||
type MinSolutionScoreBump = MinSolutionScoreBump;
|
||||
type WeightInfo = ();
|
||||
type WeightInfo = weights::pallet_staking::WeightInfo;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
pub mod frame_system;
|
||||
pub mod pallet_balances;
|
||||
pub mod pallet_proxy;
|
||||
pub mod pallet_staking;
|
||||
pub mod pallet_timestamp;
|
||||
pub mod pallet_utility;
|
||||
pub mod pallet_proxy;
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Default weights of pallet-staking.
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6
|
||||
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
pub struct WeightInfo;
|
||||
impl pallet_staking::WeightInfo for WeightInfo {
|
||||
fn bond() -> Weight {
|
||||
(144278000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
}
|
||||
fn bond_extra() -> Weight {
|
||||
(110715000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn unbond() -> Weight {
|
||||
(99840000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
||||
(100728000 as Weight)
|
||||
.saturating_add((63000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
||||
(168879000 as Weight)
|
||||
.saturating_add((6666000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(7 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn validate() -> Weight {
|
||||
(35539000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn nominate(n: u32, ) -> Weight {
|
||||
(48596000 as Weight)
|
||||
.saturating_add((308000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn chill() -> Weight {
|
||||
(35144000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
fn set_payee() -> Weight {
|
||||
(24255000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn set_controller() -> Weight {
|
||||
(52294000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(3 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn set_validator_count() -> Weight {
|
||||
(5185000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_no_eras() -> Weight {
|
||||
(5907000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_new_era() -> Weight {
|
||||
(5917000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_new_era_always() -> Weight {
|
||||
(5952000 as Weight)
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn set_invulnerables(v: u32, ) -> Weight {
|
||||
(6324000 as Weight)
|
||||
.saturating_add((9000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn force_unstake(s: u32, ) -> Weight {
|
||||
(119691000 as Weight)
|
||||
.saturating_add((6681000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn cancel_deferred_slash(s: u32, ) -> Weight {
|
||||
(5820201000 as Weight)
|
||||
.saturating_add((34672000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
fn payout_stakers_dead_controller(n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((92486000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
||||
}
|
||||
fn payout_stakers_alive_staked(n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((117324000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight)))
|
||||
}
|
||||
fn rebond(l: u32, ) -> Weight {
|
||||
(71316000 as Weight)
|
||||
.saturating_add((142000 as Weight).saturating_mul(l as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(3 as Weight))
|
||||
}
|
||||
fn set_history_depth(e: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((51901000 as Weight).saturating_mul(e as Weight))
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
|
||||
}
|
||||
fn reap_stash(s: u32, ) -> Weight {
|
||||
(147166000 as Weight)
|
||||
.saturating_add((6661000 as Weight).saturating_mul(s as Weight))
|
||||
.saturating_add(DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
|
||||
}
|
||||
fn new_era(v: u32, n: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((1440459000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((182580000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(DbWeight::get().reads(10 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
|
||||
.saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(DbWeight::get().writes(8 as Weight))
|
||||
.saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
|
||||
}
|
||||
fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight {
|
||||
(0 as Weight)
|
||||
.saturating_add((964000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((432000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add((204294000 as Weight).saturating_mul(a as Weight))
|
||||
.saturating_add((9546000 as Weight).saturating_mul(w as Weight))
|
||||
.saturating_add(DbWeight::get().reads(6 as Weight))
|
||||
.saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight)))
|
||||
.saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight)))
|
||||
.saturating_add(DbWeight::get().writes(2 as Weight))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user