Companion for Store voters in unsorted bags to get good stake iteration properties (#3413)

* add voter bags generation script and generated values for all runtimes

* VoterBagThresholds for test-runtime

* semicolon

* turns out the header is called file_header.txt

* perform benchmarks to get real numbers

* add note about when to re-run this script

* Suggestions for #3413 (Store voters in unsorted bags companion) (#3488)

Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: parity-processbot <>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: radupopa2010 <radupopa2010@yahoo.com>
Co-authored-by: CI system <>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: André Silva <andrerfosilva@gmail.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Robert Klotzner <eskimor@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Lldenaurois <ljdenaurois@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Seun Lanlege <seun@parity.io>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
Co-authored-by: Andreas Doerr <adoerr@users.noreply.github.com>
Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Denis Tsai <denistsai@aetheras.io>
Co-authored-by: Pierre Besson <pierre.besson@parity.io>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: ferrell-code <automatedcharlesferrell@gmail.com>
Co-authored-by: Shaun W <spxwang@gmail.com>

* Try resolve Cargo.lock conflicts

* Add temp VoterSnapshotPerBlock value to compile

* Improve voter_bags test with nominator/validator breakdown

* Remove miner.log

* Update README

* Module doc comments

* Build working

* remote-ext-tests very  WIP

* Remove system module query

* formatting and log target

* clean up

* Save

* Fix issues with polkadot runtime after mergin

* Save

* Some updates to runtimes to make sure things compile

* save

* udpate weights

* Use UseNominatorsAndUpdateBagsList

* make remote-ext tests a bin

* Adjust remote-ext test to use pub; update some comments

* Use list_bags_get

* Try fix cargo.lock

* Gate kusama feat code

* Carg.lock .. again

* point bags-list deps to master

* Update voter-bags  CLI to take total issuance and min balance as args

* Switch polkadot runtime to UseNominatorMap

* Some tweaks to the remote-test

* Delete some stuff for polkadot; comments

* Various fixes

* Add comment for VoterSnapshotPerBlock

* Remove bags-list import from polakdot cargo

* use benchmarking feature for pallet-bags-list

* Add custom migration for westend and kusama for bags-list

* :facepalm

* Fix kusama runtime

* Small clean up

* Be more alphabetical ordered

* Use 22_500 for VoterSnapshotPerBlock

* point back to master

* remove unused type

* SortedListProvider for staking runtime

* Remove polkadot for remote-ext bags test

* Revert "Remove polkadot for remote-ext bags test"

This reverts commit 3608c466002063761cd669880a00b2e05c1ff7d1.

* Remove polkadot for remote-ext bags test

* update Substrate

Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Andronik Ordian <write@reusable.software>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: radupopa2010 <radupopa2010@yahoo.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
Co-authored-by: André Silva <andrerfosilva@gmail.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
Co-authored-by: Robert Klotzner <eskimor@users.noreply.github.com>
Co-authored-by: Alexander Theißen <alex.theissen@me.com>
Co-authored-by: Lldenaurois <ljdenaurois@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Seun Lanlege <seun@parity.io>
Co-authored-by: Denis Pisarev <denis.pisarev@parity.io>
Co-authored-by: Andreas Doerr <adoerr@users.noreply.github.com>
Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Denis Tsai <denistsai@aetheras.io>
Co-authored-by: Pierre Besson <pierre.besson@parity.io>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: ferrell-code <automatedcharlesferrell@gmail.com>
Co-authored-by: Shaun W <spxwang@gmail.com>
Co-authored-by: parity-processbot <>
This commit is contained in:
Peter Goodspeed-Niklaus
2021-09-17 05:24:59 +02:00
committed by GitHub
parent 608ad0f6bf
commit 9a6f43ab8f
25 changed files with 1479 additions and 268 deletions
+3
View File
@@ -69,6 +69,7 @@ pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "m
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false }
pallet-bags-list = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
@@ -149,6 +150,7 @@ std = [
"pallet-vesting/std",
"pallet-xcm/std",
"pallet-babe/std",
"pallet-bags-list/std",
"frame-executive/std",
"sp-runtime/std",
"sp-staking/std",
@@ -201,6 +203,7 @@ runtime-benchmarks = [
"hex-literal",
"xcm-builder/runtime-benchmarks",
"frame-election-provider-support/runtime-benchmarks",
"pallet-bags-list/runtime-benchmarks",
]
try-runtime = [
"frame-executive/try-runtime",
+49 -1
View File
@@ -20,6 +20,7 @@
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
use frame_support::traits::OnRuntimeUpgrade;
use pallet_transaction_payment::CurrencyAdapter;
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use primitives::v1::{
@@ -100,6 +101,9 @@ use constants::{currency::*, fee::*, time::*};
// Weights used in the runtime
mod weights;
// Voter bag threshold definitions.
mod voter_bags;
#[cfg(test)]
mod tests;
@@ -339,6 +343,11 @@ parameter_types! {
// miner configs
pub OffchainRepeat: BlockNumber = 5;
/// Whilst `UseNominatorsAndUpdateBagsList` or `UseNominatorsMap` is in use, this can still be a
/// very large value. Once the `BagsList` is in full motion, staking might open its door to many
/// more nominators, and this value should instead be what is a "safe" number (e.g. 22500).
pub const VoterSnapshotPerBlock: u32 = 22_500;
}
sp_npos_elections::generate_solution_type!(
@@ -380,6 +389,18 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type BenchmarkingConfig = runtime_common::elections::BenchmarkConfig;
type ForceOrigin = EnsureRoot<AccountId>;
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
type VoterSnapshotPerBlock = VoterSnapshotPerBlock;
}
parameter_types! {
pub const BagThresholds: &'static [u64] = &voter_bags::THRESHOLDS;
}
impl pallet_bags_list::Config for Runtime {
type Event = Event;
type VoteWeightProvider = Staking;
type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
type BagThresholds = BagThresholds;
}
pallet_staking_reward_curve::build! {
@@ -430,6 +451,9 @@ impl pallet_staking::Config for Runtime {
type NextNewSession = Session;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = runtime_common::elections::GenesisElectionOf<Self>;
// Use the nominators map to iter voters, but also perform the bags-list migration and keep
// it up-to-date.
type SortedListProvider = runtime_common::elections::UseNominatorsAndUpdateBagsList<Runtime>;
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}
@@ -1041,6 +1065,9 @@ construct_runtime! {
// Election pallet. Only works with staking, but placed here to maintain indices.
ElectionProviderMultiPhase: pallet_election_provider_multi_phase::{Pallet, Call, Storage, Event<T>, ValidateUnsigned} = 24,
// Provides a semi-sorted list of nominators for staking.
BagsList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 25,
// Parachains pallets. Start indices at 40 to leave room.
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41,
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
@@ -1096,11 +1123,30 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPallets,
(),
(StakingBagsListMigrationV8,),
>;
/// The payload being signed in transactions.
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
// Migration to generate pallet staking's `SortedListProvider` from pre-existing nominators.
pub struct StakingBagsListMigrationV8;
impl OnRuntimeUpgrade for StakingBagsListMigrationV8 {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
pallet_staking::migrations::v8::migrate::<Runtime>()
}
#[cfg(feature = "try-runtime")]
fn pre_upgrade() -> Result<(), &'static str> {
pallet_staking::migrations::v8::pre_migrate::<Runtime>()
}
#[cfg(feature = "try-runtime")]
fn post_upgrade() -> Result<(), &'static str> {
pallet_staking::migrations::v8::post_migrate::<Runtime>()
}
}
#[cfg(not(feature = "disable-runtime-api"))]
sp_api::impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime {
@@ -1417,6 +1463,7 @@ sp_api::impl_runtime_apis! {
list_benchmark!(list, extra, runtime_common::paras_registrar, Registrar);
list_benchmark!(list, extra, runtime_common::slots, Slots);
// Substrate
list_benchmark!(list, extra, pallet_bags_list, BagsList);
list_benchmark!(list, extra, pallet_balances, Balances);
list_benchmark!(list, extra, pallet_election_provider_multi_phase, ElectionProviderMultiPhase);
list_benchmark!(list, extra, pallet_identity, Identity);
@@ -1481,6 +1528,7 @@ sp_api::impl_runtime_apis! {
add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar);
add_benchmark!(params, batches, runtime_common::slots, Slots);
// Substrate
add_benchmark!(params, batches, pallet_bags_list, BagsList);
add_benchmark!(params, batches, pallet_balances, Balances);
add_benchmark!(params, batches, pallet_election_provider_multi_phase, ElectionProviderMultiPhase);
add_benchmark!(params, batches, pallet_identity, Identity);
+234
View File
@@ -0,0 +1,234 @@
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated voter bag thresholds.
//!
//! Generated on 2021-07-05T14:35:50.538338181+00:00
//! for the westend runtime.
/// Existential weight for this runtime.
#[cfg(any(test, feature = "std"))]
#[allow(unused)]
pub const EXISTENTIAL_WEIGHT: u64 = 10_000_000_000;
/// Constant ratio between bags for this runtime.
#[cfg(any(test, feature = "std"))]
#[allow(unused)]
pub const CONSTANT_RATIO: f64 = 1.1131723507077667;
/// Upper thresholds delimiting the bag list.
pub const THRESHOLDS: [u64; 200] = [
10_000_000_000,
11_131_723_507,
12_391_526_824,
13_793_905_044,
15_354_993_703,
17_092_754_435,
19_027_181_634,
21_180_532_507,
23_577_583_160,
26_245_913_670,
29_216_225_417,
32_522_694_326,
36_203_364_094,
40_300_583_912,
44_861_495_728,
49_938_576_656,
55_590_242_767,
61_881_521_217,
68_884_798_439,
76_680_653_006,
85_358_782_760,
95_019_036_859,
105_772_564_622,
117_743_094_401,
131_068_357_174,
145_901_671_259,
162_413_706_368,
180_794_447_305,
201_255_379_901,
224_031_924_337,
249_386_143_848,
277_609_759_981,
309_027_509_097,
344_000_878_735,
382_932_266_827,
426_269_611_626,
474_511_545_609,
528_213_132_664,
587_992_254_562,
654_536_720_209,
728_612_179_460,
811_070_932_564,
902_861_736_593,
1_005_040_721_687,
1_118_783_542_717,
1_245_398_906_179,
1_386_343_627_960,
1_543_239_395_225,
1_717_891_425_287,
1_912_309_236_147,
2_128_729_767_682,
2_369_643_119_512,
2_637_821_201_686,
2_936_349_627_828,
3_268_663_217_709,
3_638_585_517_729,
4_050_372_794_022,
4_508_763_004_364,
5_019_030_312_352,
5_587_045_771_074,
6_219_344_874_498,
6_923_202_753_807,
7_706_717_883_882,
8_578_905_263_043,
9_549_800_138_161,
10_630_573_468_586,
11_833_660_457_397,
13_172_903_628_838,
14_663_712_098_160,
16_323_238_866_411,
18_170_578_180_087,
20_226_985_226_447,
22_516_120_692_255,
25_064_322_999_817,
27_900_911_352_605,
31_058_523_077_268,
34_573_489_143_434,
38_486_252_181_966,
42_841_831_811_331,
47_690_342_626_046,
53_087_570_807_094,
59_095_615_988_698,
65_783_605_766_662,
73_228_491_069_308,
81_515_931_542_404,
90_741_281_135_191,
101_010_685_227_495,
112_442_301_921_293,
125_167_661_548_718,
139_333_180_038_781,
155_101_843_555_358,
172_655_083_789_626,
192_194_865_483_744,
213_946_010_204_502,
238_158_783_103_893,
265_111_772_429_462,
295_115_094_915_607,
328_513_963_936_552,
365_692_661_475_578,
407_078_959_611_349,
453_149_042_394_237,
504_432_984_742_966,
561_520_851_400_862,
625_069_486_125_324,
695_810_069_225_823,
774_556_530_406_243,
862_214_913_708_369,
959_793_802_308_039,
1_068_415_923_109_985,
1_189_331_064_661_951,
1_323_930_457_019_515,
1_473_762_779_014_021,
1_640_551_977_100_649,
1_826_217_100_807_404,
2_032_894_383_008_501,
2_262_961_819_074_188,
2_519_066_527_700_738,
2_804_155_208_229_882,
3_121_508_044_894_685,
3_474_776_448_088_622,
3_868_025_066_902_796,
4_305_778_556_320_752,
4_793_073_637_166_665,
5_335_517_047_800_242,
5_939_350_054_341_159,
6_611_520_261_667_250,
7_359_761_551_432_161,
8_192_683_066_856_378,
9_119_868_268_136_230,
10_151_985_198_186_376,
11_300_909_227_415_580,
12_579_859_689_817_292,
14_003_551_982_487_792,
15_588_366_878_604_342,
17_352_539_001_951_086,
19_316_366_631_550_092,
21_502_445_250_375_680,
23_935_927_525_325_748,
26_644_812_709_737_600,
29_660_268_798_266_784,
33_016_991_140_790_860,
36_753_601_641_491_664,
40_913_093_136_236_104,
45_543_324_061_189_736,
50_697_569_104_240_168,
56_435_132_174_936_472,
62_822_028_745_677_552,
69_931_745_415_056_768,
77_846_085_432_775_824,
86_656_109_914_600_688,
96_463_185_576_826_656,
107_380_151_045_315_664,
119_532_615_158_469_088,
133_060_402_202_199_856,
148_119_160_705_543_712,
164_882_154_307_451_552,
183_542_255_300_186_560,
204_314_163_786_713_728,
227_436_877_985_347_776,
253_176_444_104_585_088,
281_829_017_427_734_464,
313_724_269_827_691_328,
349_229_182_918_168_832,
388_752_270_484_770_624,
432_748_278_778_513_664,
481_723_418_752_617_984,
536_241_190_443_833_600,
596_928_866_512_693_376,
664_484_709_541_257_600,
739_686_006_129_409_280,
823_398_010_228_713_984,
916_583_898_614_395_264,
1_020_315_853_041_475_584,
1_135_787_396_594_579_584,
1_264_327_126_171_442_688,
1_407_413_999_103_859_968,
1_566_694_349_801_462_272,
1_744_000_832_209_069_824,
1_941_373_506_026_471_680,
2_161_083_309_305_266_176,
2_405_658_187_494_662_656,
2_677_912_179_572_818_944,
2_980_977_795_924_034_048,
3_318_342_060_496_414_208,
3_693_886_631_935_247_360,
4_111_932_465_319_354_368,
4_577_289_528_371_127_808,
5_095_312_144_166_932_480,
5_671_960_597_112_134_656,
6_313_869_711_009_142_784,
7_028_425_188_266_614_784,
7_823_848_588_596_424_704,
8_709_291_924_949_524_480,
9_694_942_965_096_232_960,
10_792_142_450_433_898_496,
12_013_514_580_722_579_456,
13_373_112_266_084_982_784,
14_886_578_817_516_689_408,
16_571_327_936_291_497_984,
18_446_744_073_709_551_615,
];
@@ -16,6 +16,7 @@
//! A list of the different weight modules for our runtime.
pub mod frame_system;
pub mod pallet_bags_list;
pub mod pallet_balances;
pub mod pallet_election_provider_multi_phase;
pub mod pallet_identity;
@@ -0,0 +1,66 @@
// This file is part of Substrate.
// Copyright (C) 2021 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.
//! Autogenerated weights for pallet_bags_list
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-09-02, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128
// Executed Command:
// target/release/substrate
// benchmark
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_bags_list
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/bags-list/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs
// NOTE: this is copy pasta from substrate % some tweaks
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_bags_list.
/// Weights for pallet_bags_list using the Substrate node and recommended hardware.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
fn rebag_non_terminal() -> Weight {
(75_718_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
// Storage: BagsList ListNodes (r:4 w:4)
// Storage: BagsList ListBags (r:1 w:1)
fn rebag_terminal() -> Weight {
(75_718_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
}
@@ -16,7 +16,7 @@
//! Autogenerated weights for `pallet_staking`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
//! DATE: 2021-07-02, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-07-07, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128
// Executed Command:
@@ -31,7 +31,7 @@
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/westend/src/weights/
// --output=runtime/westend/src/weights/
#![allow(unused_parens)]
#![allow(unused_imports)]
@@ -43,24 +43,24 @@ use sp_std::marker::PhantomData;
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
fn bond() -> Weight {
(71_835_000 as Weight)
(70_644_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
fn bond_extra() -> Weight {
(54_894_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
(57_596_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn unbond() -> Weight {
(59_419_000 as Weight)
(57_410_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
fn withdraw_unbonded_update(s: u32) -> Weight {
(50_384_000 as Weight)
// Standard Error: 0
.saturating_add((26_000 as Weight).saturating_mul(s as Weight))
.saturating_add((33_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -73,9 +73,9 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
fn validate() -> Weight {
(33_672_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
(69_191_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
fn kick(k: u32) -> Weight {
(11_371_000 as Weight)
@@ -91,18 +91,18 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
.saturating_add((5_341_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
}
fn chill() -> Weight {
(17_740_000 as Weight).saturating_add(T::DbWeight::get().reads(3 as Weight))
}
fn set_payee() -> Weight {
(11_624_000 as Weight)
(11_867_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn set_controller() -> Weight {
(25_480_000 as Weight)
(26_102_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
@@ -121,15 +121,15 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
fn set_invulnerables(v: u32) -> Weight {
(2_352_000 as Weight)
// Standard Error: 0
.saturating_add((27_000 as Weight).saturating_mul(v as Weight))
.saturating_add((5_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
fn force_unstake(s: u32) -> Weight {
(58_375_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_282_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
.saturating_add((2_220_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))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
fn cancel_deferred_slash(s: u32) -> Weight {
@@ -166,8 +166,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
}
fn set_history_depth(e: u32) -> Weight {
(0 as Weight)
// Standard Error: 63_000
.saturating_add((33_032_000 as Weight).saturating_mul(e as Weight))
// Standard Error: 76_000
.saturating_add((33_612_000 as Weight).saturating_mul(e as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight)))
@@ -175,40 +175,38 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
fn reap_stash(s: u32) -> Weight {
(69_690_000 as Weight)
// Standard Error: 1_000
.saturating_add((2_271_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
.saturating_add((2_214_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(11 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight)))
}
fn new_era(v: u32, n: u32) -> Weight {
(0 as Weight)
// Standard Error: 787_000
.saturating_add((310_720_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 39_000
.saturating_add((48_687_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
// Standard Error: 1_065_000
.saturating_add((309_528_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 53_000
.saturating_add((52_832_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(187 as Weight))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
}
fn get_npos_voters(v: u32, n: u32, s: u32) -> Weight {
(0 as Weight)
// Standard Error: 110_000
.saturating_add((25_641_000 as Weight).saturating_mul(v as Weight))
.saturating_add((25_393_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 110_000
.saturating_add((27_889_000 as Weight).saturating_mul(n as Weight))
// Standard Error: 3_749_000
.saturating_add((15_769_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add((34_992_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(179 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight)))
}
fn get_npos_targets(v: u32) -> Weight {
(0 as Weight)
// Standard Error: 36_000
.saturating_add((10_960_000 as Weight).saturating_mul(v as Weight))
// Standard Error: 42_000
.saturating_add((11_340_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
}
@@ -216,8 +214,8 @@ impl<T: frame_system::Config> pallet_staking::WeightInfo for WeightInfo<T> {
(5_696_000 as Weight).saturating_add(T::DbWeight::get().writes(5 as Weight))
}
fn chill_other() -> Weight {
(41_216_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
(84_796_000 as Weight)
.saturating_add(T::DbWeight::get().reads(11 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
}