Unverified Commit 6e32f586 authored by Peter Goodspeed-Niklaus's avatar Peter Goodspeed-Niklaus Committed by GitHub
Browse files

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's avatarAndronik Ordian <write@reusable.software>
Co-authored-by: parity-processbot <>
Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Radu Popa's avatarradupopa2010 <radupopa2010@yahoo.com>
Co-authored-by: CI system <>
Co-authored-by: default avatardependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: default avatarAndré Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: thiolliere's avatarthiolliere <gui.thiolliere@gmail.com>
Co-authored-by: default avatarAndré Silva <andrerfosilva@gmail.com>
Co-authored-by: Keith Yeung's avatarKeith Yeung <kungfukeith11@gmail.com>
Co-authored-by: default avatarBernhard Schuster <bernhard@ahoi.io>
Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: asynchronous rob's avatarRobert Habermeier <rphmeier@gmail.com>
Co-authored-by: default avatarRobert Klotzner <eskimor@users.noreply.github.com>
Co-authored-by: Alexander Theißen's avatarAlexander Theißen <alex.theissen@me.com>
Co-authored-by: Lldenaurois's avatarLldenaurois <ljdenaurois@gmail.com>
Co-authored-by: default avatarQinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: default avatarSeun Lanlege <seun@parity.io>
Co-authored-by: Denis_P's avatarDenis Pisarev <denis.pisarev@parity.io>
Co-authored-by: default avatarAndreas Doerr <adoerr@users.noreply.github.com>
Co-authored-by: default avatarChevdor <chevdor@users.noreply.github.com>
Co-authored-by: default avatarTomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: default avatarDenis Tsai <denistsai@aetheras.io>
Co-authored-by: Pierre Besson's avatarPierre Besson <pierre.besson@parity.io>
Co-authored-by: default avatarkianenigma <kian@parity.io>
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: default avatarXiliang Chen <xlchen1291@gmail.com>
Co-authored-by: default avatarHernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: default avatarferrell-code <automatedcharlesferrell@gmail.com>
Co-authored-by: default avatarShaun 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 3608c466

.

* Remove polkadot for remote-ext bags test

* update Substrate
Co-authored-by: default avatarZeke Mostov <32168567+emostov@users.noreply.github.com>
Co-authored-by: Andronik Ordian's avatarAndronik Ordian <write@reusable.software>
Co-authored-by: Shawn Tabrizi's avatarShawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Radu Popa's avatarradupopa2010 <radupopa2010@yahoo.com>
Co-authored-by: default avatardependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: default avatarAndré Silva <123550+andresilva@users.noreply.github.com>
Co-authored-by: thiolliere's avatarthiolliere <gui.thiolliere@gmail.com>
Co-authored-by: default avatarAndré Silva <andrerfosilva@gmail.com>
Co-authored-by: Keith Yeung's avatarKeith Yeung <kungfukeith11@gmail.com>
Co-authored-by: default avatarBernhard Schuster <bernhard@ahoi.io>
Co-authored-by: default avatarKian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-authored-by: asynchronous rob's avatarRobert Habermeier <rphmeier@gmail.com>
Co-authored-by: default avatarRobert Klotzner <eskimor@users.noreply.github.com>
Co-authored-by: Alexander Theißen's avatarAlexander Theißen <alex.theissen@me.com>
Co-authored-by: Lldenaurois's avatarLldenaurois <ljdenaurois@gmail.com>
Co-authored-by: default avatarQinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: default avatarSeun Lanlege <seun@parity.io>
Co-authored-by: Denis_P's avatarDenis Pisarev <denis.pisarev@parity.io>
Co-authored-by: default avatarAndreas Doerr <adoerr@users.noreply.github.com>
Co-authored-by: default avatarChevdor <chevdor@users.noreply.github.com>
Co-authored-by: default avatarTomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: default avatarDenis Tsai <denistsai@aetheras.io>
Co-authored-by: Pierre Besson's avatarPierre Besson <pierre.besson@parity.io>
Co-authored-by: default avatarkianenigma <kian@parity.io>
Co-authored-by: default avatarBastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: default avatarXiliang Chen <xlchen1291@gmail.com>
Co-authored-by: default avatarHernando Castano <HCastano@users.noreply.github.com>
Co-authored-by: default avatarferrell-code <automatedcharlesferrell@gmail.com>
Co-authored-by: default avatarShaun W <spxwang@gmail.com>
Co-authored-by: parity-processbot <>
parent 00c478aa
Pipeline #157690 failed with stages
in 24 minutes and 11 seconds
This diff is collapsed.
......@@ -92,6 +92,8 @@ members = [
"parachain/test-parachains/adder",
"parachain/test-parachains/adder/collator",
"utils/staking-miner",
"utils/remote-ext-tests/bags-list",
"utils/voter-bags",
]
# We want to be able to build the bridge relayer without pulling it (and all of its
......
......@@ -39,6 +39,7 @@ pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "m
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-beefy-mmr = { git = "https://github.com/paritytech/grandpa-bridge-gadget", branch = "master", default-features = false }
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", 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 }
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
......@@ -96,6 +97,7 @@ std = [
"runtime-parachains/std",
"xcm/std",
"sp-npos-elections/std",
"pallet-bags-list/std"
]
runtime-benchmarks = [
"libsecp256k1/hmac",
......
......@@ -17,11 +17,13 @@
//! Code for elections.
use super::{BlockExecutionWeight, BlockLength, BlockWeights};
use frame_election_provider_support::{SortedListProvider, VoteWeight};
use frame_support::{
parameter_types,
weights::{DispatchClass, Weight},
};
use sp_runtime::Perbill;
use sp_std::{boxed::Box, convert::From, marker::PhantomData};
parameter_types! {
/// A limit for off-chain phragmen unsigned solution submission.
......@@ -89,3 +91,59 @@ impl frame_support::pallet_prelude::Get<Option<(usize, sp_npos_elections::Extend
Some((iters, 0))
}
}
/// Implementation of `frame_election_provider_support::SortedListProvider` that updates the
/// bags-list but uses [`pallet_staking::Nominators`] for `iter`. This is meant to be a transitionary
/// implementation for runtimes to "test" out the bags-list by keeping it up to date, but not yet
/// using it for snapshot generation. In contrast, a "complete" implementation would use bags-list
/// for `iter`.
pub struct UseNominatorsAndUpdateBagsList<T>(PhantomData<T>);
impl<T: pallet_bags_list::Config + pallet_staking::Config> SortedListProvider<T::AccountId>
for UseNominatorsAndUpdateBagsList<T>
{
type Error = pallet_bags_list::Error;
fn iter() -> Box<dyn Iterator<Item = T::AccountId>> {
Box::new(pallet_staking::Nominators::<T>::iter().map(|(n, _)| n))
}
fn count() -> u32 {
pallet_bags_list::Pallet::<T>::count()
}
fn contains(id: &T::AccountId) -> bool {
pallet_bags_list::Pallet::<T>::contains(id)
}
fn on_insert(id: T::AccountId, weight: VoteWeight) -> Result<(), Self::Error> {
pallet_bags_list::Pallet::<T>::on_insert(id, weight)
}
fn on_update(id: &T::AccountId, new_weight: VoteWeight) {
pallet_bags_list::Pallet::<T>::on_update(id, new_weight);
}
fn on_remove(id: &T::AccountId) {
pallet_bags_list::Pallet::<T>::on_remove(id);
}
fn regenerate(
all: impl IntoIterator<Item = T::AccountId>,
weight_of: Box<dyn Fn(&T::AccountId) -> VoteWeight>,
) -> u32 {
pallet_bags_list::Pallet::<T>::regenerate(all, weight_of)
}
fn sanity_check() -> Result<(), &'static str> {
pallet_bags_list::Pallet::<T>::sanity_check()
}
fn clear(count: Option<u32>) -> u32 {
pallet_bags_list::Pallet::<T>::clear(count)
}
#[cfg(feature = "runtime-benchmarks")]
fn weight_update_worst_case(who: &T::AccountId, is_increase: bool) -> VoteWeight {
pallet_bags_list::Pallet::<T>::weight_update_worst_case(who, is_increase)
}
}
......@@ -72,6 +72,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-election-provider-support = { 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 }
......@@ -174,6 +175,7 @@ std = [
"xcm-executor/std",
"xcm-builder/std",
"frame-election-provider-support/std",
"pallet-bags-list/std",
]
runtime-benchmarks = [
"runtime-common/runtime-benchmarks",
......@@ -211,6 +213,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",
......
......@@ -103,6 +103,9 @@ use constants::{currency::*, fee::*, time::*};
// Weights used in the runtime.
mod weights;
// Voter bag threshold definitions.
mod voter_bags;
#[cfg(test)]
mod tests;
......@@ -354,6 +357,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!(
......@@ -399,6 +407,18 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilCollective>,
>;
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;
}
fn era_payout(
......@@ -505,6 +525,9 @@ impl pallet_staking::Config for Runtime {
type EraPayout = EraPayout;
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
// 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>;
}
......@@ -1462,6 +1485,9 @@ construct_runtime! {
// Gilts pallet.
Gilt: pallet_gilt::{Pallet, Call, Storage, Event<T>, Config} = 38,
// Provides a semi-sorted list of nominators for staking.
BagsList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 39,
// Parachains pallets. Start indices at 50 to leave room.
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
......@@ -1521,6 +1547,7 @@ pub type Executive = frame_executive::Executive<
TechnicalCommitteeStoragePrefixMigration,
TechnicalMembershipStoragePrefixMigration,
MigrateTipsPalletPrefix,
StakingBagsListMigrationV8,
),
>;
/// The payload being signed in the transactions.
......@@ -1638,6 +1665,25 @@ impl OnRuntimeUpgrade for MigrateTipsPalletPrefix {
}
}
// 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 {
......@@ -1955,6 +2001,7 @@ sp_api::impl_runtime_apis! {
list_benchmark!(list, extra, runtime_common::slots, Slots);
list_benchmark!(list, extra, runtime_common::paras_registrar, Registrar);
// Substrate
list_benchmark!(list, extra, pallet_bags_list, BagsList);
list_benchmark!(list, extra, pallet_balances, Balances);
list_benchmark!(list, extra, pallet_bounties, Bounties);
list_benchmark!(list, extra, pallet_collective, Council);
......@@ -2029,6 +2076,7 @@ sp_api::impl_runtime_apis! {
add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar);
// Substrate
add_benchmark!(params, batches, pallet_balances, Balances);
add_benchmark!(params, batches, pallet_bags_list, BagsList);
add_benchmark!(params, batches, pallet_bounties, Bounties);
add_benchmark!(params, batches, pallet_collective, Council);
add_benchmark!(params, batches, pallet_collective, TechnicalCommittee);
......
// 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:34:44.453491278+00:00
//! for the kusama runtime.
/// Existential weight for this runtime.
#[cfg(any(test, feature = "std"))]
#[allow(unused)]
pub const EXISTENTIAL_WEIGHT: u64 = 33_333_333;
/// Constant ratio between bags for this runtime.
#[cfg(any(test, feature = "std"))]
#[allow(unused)]
pub const CONSTANT_RATIO: f64 = 1.1455399939091000;
/// Upper thresholds delimiting the bag list.
pub const THRESHOLDS: [u64; 200] = [
33_333_333,
38_184_666,
43_742_062,
50_108_281,
57_401_040,
65_755_187,
75_325_197,
86_288_026,
98_846_385,
113_232_487,
129_712_342,
148_590_675,
170_216_561,
194_989_878,
223_368_704,
255_877_784,
293_118_235,
335_778_661,
384_647_885,
440_629_536,
504_758_756,
578_221_342,
662_375_673,
758_777_824,
869_210_344,
995_715_212,
1_140_631_598,
1_306_639_114,
1_496_807_363,
1_714_652_697,
1_964_203_240,
2_250_073_368,
2_577_549_032,
2_952_685_502,
3_382_419_332,
3_874_696_621,
4_438_619_944,
5_084_616_664,
5_824_631_742,
6_672_348_610,
7_643_442_186,
8_755_868_715,
10_030_197_794,
11_489_992_720,
13_162_246_190,
15_077_879_420,
17_272_313_899,
19_786_126_359,
22_665_799_069,
25_964_579_327,
29_743_464_044,
34_072_327_620,
39_031_213_974,
44_711_816_618,
51_219_174_136,
58_673_612_428,
67_212_969_623,
76_995_144_813,
88_201_017_720,
101_037_793_302,
115_742_833_124,
132_588_044_352,
151_884_907_519,
173_990_236_034,
199_312_773_927,
228_320_753_830,
261_550_554_952,
299_616_621_127,
343_222_822_341,
393_175_469_814,
450_398_225_296,
515_949_180_262,
591_040_420_815,
677_060_440_060,
775_599_812_382,
888_480_604_352,
1_017_790_066_098,
1_165_919_226_119,
1_335_607_103_187,
1_529_991_352_850,
1_752_666_285_025,
2_007_749_325_472,
2_299_957_150_072,
2_634_692_899_685,
3_018_146_088_258,
3_457_407_051_560,
3_960_598_052_785,
4_537_023_469_264,
5_197_341_837_346,
5_953_762_936_697,
6_820_273_558_240,
7_812_896_130_365,
8_949_984_985_591,
10_252_565_745_880,
11_744_724_102_088,
13_454_051_176_370,
15_412_153_702_632,
17_655_238_458_639,
20_224_781_756_373,
23_168_296_370_008,
26_540_210_082_583,
30_402_872_096_348,
34_827_705_916_070,
39_896_530_022_963,
45_703_070_759_499,
52_354_695_399_464,
59_974_397_449_015,
68_703_070_888_447,
78_702_115_407_088,
90_156_420_804_069,
103_277_785_738_759,
118_308_834_046_123,
135_527_501_032_588,
155_252_172_707_386,
177_847_572_977_594,
203_731_507_665_501,
233_382_590_050_230,
267_349_090_784_630,
306_259_075_829_029,
350_832_019_859_793,
401_892_109_893_305,
460_383_485_119_292,
527_387_694_739_404,
604_143_696_619_511,
692_070_766_545_736,
792_794_741_693_469,
908_178_083_570_703,
1_040_354_316_321_961,
1_191_767_477_182_765,
1_365_217_308_553_008,
1_563_911_027_324_411,
1_791_522_628_715_580,
2_052_260_821_186_860,
2_350_946_848_602_280,
2_693_103_638_628_474,
3_085_057_925_791_037,
3_534_057_237_519_885,
4_048_403_906_342_940,
4_637_608_586_213_668,
5_312_566_111_603_995,
6_085_756_951_128_531,
6_971_477_980_728_040,
7_986_106_843_580_624,
9_148_404_784_952_770,
10_479_863_561_632_778,
12_005_102_840_561_012,
13_752_325_434_854_380,
15_753_838_794_879_048,
18_046_652_397_130_688,
20_673_162_077_088_732,
23_681_933_959_870_064,
27_128_602_484_145_260,
31_076_899_124_450_156,
35_599_830_833_736_348,
40_781_029_996_443_328,
46_716_300_853_732_512,
53_515_390_995_440_424,
61_304_020_674_959_928,
70_226_207_470_596_936,
80_446_929_278_126_800,
92_155_174_875_271_168,
105_567_438_465_310_176,
120_931_722_816_550_704,
138_532_125_018_688_464,
158_694_089_650_123_072,
181_790_426_491_212_160,
208_248_204_055_475_872,
238_556_646_405_290_848,
273_276_179_270_092_192,
313_048_792_736_563_520,
358_609_912_124_694_080,
410_801_996_551_064_960,
470_590_116_626_953_088,
539_079_799_334_522_496,
617_537_470_046_187_776,
707_413_869_675_350_912,
810_370_879_959_114_368,
928_312_252_892_475_904,
1_063_418_812_524_189_696,
1_218_188_780_021_782_528,
1_395_483_967_646_286_592,
1_598_582_695_797_773_824,
1_831_240_411_607_374_592,
2_097_759_129_958_809_600,
2_403_066_980_955_773_440,
2_752_809_334_727_236_096,
3_153_453_188_536_351_744,
3_612_406_746_388_564_480,
4_138_156_402_255_148_032,
4_740_423_659_834_265_600,
5_430_344_890_413_097_984,
6_220_677_252_688_132_096,
7_126_034_582_154_840_064,
8_163_157_611_837_691_904,
9_351_223_520_943_572_992,
10_712_200_535_224_332_288,
12_271_254_135_873_939_456,
14_057_212_388_066_050_048,
16_103_098_993_404_108_800,
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_bounties;
pub mod pallet_collective_council;
......
// 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-01, 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("kusama-dev"), DB CACHE: 128
// Executed Command:
......@@ -31,7 +31,7 @@
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/kusama/src/weights/
// --output=runtime/kusama/src/weights/
#![allow(unused_parens)]
#![allow(unused_imports)]
......@@ -43,17 +43,17 @@ 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 {
(70_648_000 as Weight)
(68_673_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_235_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
(57_515_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
}
fn unbond() -> Weight {
(57_950_000 as Weight)
(56_018_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 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 {
(31_838_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
(64_915_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))