mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 22:05:42 +00:00
Weight v1.5: Opaque Struct (#12138)
* initial idea * update frame_support * update a bunch more * add ord * adjust RuntimeDbWeight * frame_system builds * re-export * frame_support tests pass * frame_executive compile * frame_executive builds * frame_system tests passing * pallet-utility tests pass * fix a bunch of pallets * more * phragmen * state-trie-migration * scheduler and referenda * pallet-election-provider-multi-phase * aura * staking * more * babe * balances * bunch more * sudo * transaction-payment * asset-tx-payment * last pallets * fix alliance merge * fix node template runtime * fix pallet-contracts cc @athei * fix node runtime * fix compile on runtime-benchmarks feature * comment * fix frame-support-test * fix more tests * weight regex * frame system works * fix a bunch * more * more * more * more * more * more fixes * update templates * fix contracts benchmarks * Update lib.rs * Update lib.rs * fix ui * make scalar saturating mul const * more const functions * scalar div * refactor using constant functions * move impl * fix overhead template * use compactas * Update lib.rs
This commit is contained in:
@@ -22,6 +22,7 @@ use std::collections::BTreeMap;
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok,
|
||||
error::BadOrigin,
|
||||
pallet_prelude::Weight,
|
||||
parameter_types,
|
||||
traits::{ConstU16, ConstU32, ConstU64, EitherOf, Everything, MapSuccess, Polling},
|
||||
};
|
||||
@@ -50,7 +51,7 @@ frame_support::construct_runtime!(
|
||||
|
||||
parameter_types! {
|
||||
pub BlockWeights: frame_system::limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(1_000_000);
|
||||
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1_000_000));
|
||||
}
|
||||
impl frame_system::Config for Test {
|
||||
type BaseCallFilter = Everything;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
||||
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions needed for pallet_ranked_collective.
|
||||
@@ -61,62 +61,62 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
|
||||
// Storage: RankedCollective IndexToId (r:0 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:0 w:1)
|
||||
fn add_member() -> Weight {
|
||||
(11_000_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
Weight::from_ref_time(11_000_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:1)
|
||||
// Storage: RankedCollective MemberCount (r:1 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:1 w:1)
|
||||
// Storage: RankedCollective IndexToId (r:1 w:1)
|
||||
fn remove_member(r: u32, ) -> Weight {
|
||||
(16_855_000 as Weight)
|
||||
Weight::from_ref_time(16_855_000 as RefTimeWeight)
|
||||
// Standard Error: 27_000
|
||||
.saturating_add((8_107_000 as Weight).saturating_mul(r as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(r as Weight)))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(r as Weight)))
|
||||
.saturating_add(Weight::from_ref_time(8_107_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().reads((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:1)
|
||||
// Storage: RankedCollective MemberCount (r:1 w:1)
|
||||
// Storage: RankedCollective IndexToId (r:0 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:0 w:1)
|
||||
fn promote_member(r: u32, ) -> Weight {
|
||||
(11_936_000 as Weight)
|
||||
Weight::from_ref_time(11_936_000 as RefTimeWeight)
|
||||
// Standard Error: 3_000
|
||||
.saturating_add((9_000 as Weight).saturating_mul(r as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(Weight::from_ref_time(9_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:1)
|
||||
// Storage: RankedCollective MemberCount (r:1 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:1 w:1)
|
||||
// Storage: RankedCollective IndexToId (r:1 w:1)
|
||||
fn demote_member(r: u32, ) -> Weight {
|
||||
(17_582_000 as Weight)
|
||||
Weight::from_ref_time(17_582_000 as RefTimeWeight)
|
||||
// Standard Error: 14_000
|
||||
.saturating_add((142_000 as Weight).saturating_mul(r as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(Weight::from_ref_time(142_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:0)
|
||||
// Storage: RankedPolls ReferendumInfoFor (r:1 w:1)
|
||||
// Storage: RankedCollective Voting (r:1 w:1)
|
||||
// Storage: Scheduler Agenda (r:2 w:2)
|
||||
fn vote() -> Weight {
|
||||
(22_000_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||
Weight::from_ref_time(22_000_000 as RefTimeWeight)
|
||||
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedPolls ReferendumInfoFor (r:1 w:0)
|
||||
// Storage: RankedCollective Voting (r:0 w:1)
|
||||
fn cleanup_poll(n: u32, ) -> Weight {
|
||||
(6_188_000 as Weight)
|
||||
Weight::from_ref_time(6_188_000 as RefTimeWeight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((867_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(Weight::from_ref_time(867_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(n as RefTimeWeight)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,61 +127,61 @@ impl WeightInfo for () {
|
||||
// Storage: RankedCollective IndexToId (r:0 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:0 w:1)
|
||||
fn add_member() -> Weight {
|
||||
(11_000_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
Weight::from_ref_time(11_000_000 as RefTimeWeight)
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:1)
|
||||
// Storage: RankedCollective MemberCount (r:1 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:1 w:1)
|
||||
// Storage: RankedCollective IndexToId (r:1 w:1)
|
||||
fn remove_member(r: u32, ) -> Weight {
|
||||
(16_855_000 as Weight)
|
||||
Weight::from_ref_time(16_855_000 as RefTimeWeight)
|
||||
// Standard Error: 27_000
|
||||
.saturating_add((8_107_000 as Weight).saturating_mul(r as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(r as Weight)))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(r as Weight)))
|
||||
.saturating_add(Weight::from_ref_time(8_107_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().reads((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:1)
|
||||
// Storage: RankedCollective MemberCount (r:1 w:1)
|
||||
// Storage: RankedCollective IndexToId (r:0 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:0 w:1)
|
||||
fn promote_member(r: u32, ) -> Weight {
|
||||
(11_936_000 as Weight)
|
||||
Weight::from_ref_time(11_936_000 as RefTimeWeight)
|
||||
// Standard Error: 3_000
|
||||
.saturating_add((9_000 as Weight).saturating_mul(r as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(Weight::from_ref_time(9_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:1)
|
||||
// Storage: RankedCollective MemberCount (r:1 w:1)
|
||||
// Storage: RankedCollective IdToIndex (r:1 w:1)
|
||||
// Storage: RankedCollective IndexToId (r:1 w:1)
|
||||
fn demote_member(r: u32, ) -> Weight {
|
||||
(17_582_000 as Weight)
|
||||
Weight::from_ref_time(17_582_000 as RefTimeWeight)
|
||||
// Standard Error: 14_000
|
||||
.saturating_add((142_000 as Weight).saturating_mul(r as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
.saturating_add(Weight::from_ref_time(142_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedCollective Members (r:1 w:0)
|
||||
// Storage: RankedPolls ReferendumInfoFor (r:1 w:1)
|
||||
// Storage: RankedCollective Voting (r:1 w:1)
|
||||
// Storage: Scheduler Agenda (r:2 w:2)
|
||||
fn vote() -> Weight {
|
||||
(22_000_000 as Weight)
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
|
||||
Weight::from_ref_time(22_000_000 as RefTimeWeight)
|
||||
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
|
||||
}
|
||||
// Storage: RankedPolls ReferendumInfoFor (r:1 w:0)
|
||||
// Storage: RankedCollective Voting (r:0 w:1)
|
||||
fn cleanup_poll(n: u32, ) -> Weight {
|
||||
(6_188_000 as Weight)
|
||||
Weight::from_ref_time(6_188_000 as RefTimeWeight)
|
||||
// Standard Error: 1_000
|
||||
.saturating_add((867_000 as Weight).saturating_mul(n as Weight))
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
||||
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(n as Weight)))
|
||||
.saturating_add(Weight::from_ref_time(867_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
|
||||
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(n as RefTimeWeight)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user