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:
Shawn Tabrizi
2022-08-31 12:26:13 +01:00
committed by GitHub
parent 299f4ba541
commit 30951822ba
187 changed files with 5932 additions and 4930 deletions
+1 -1
View File
@@ -532,7 +532,7 @@ mod tests {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
pub static Members: Vec<u64> = vec![];
pub static Prime: Option<u64> = None;
}
@@ -46,7 +46,7 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,
target: "runtime::membership",
"New pallet name is equal to the old prefix. No migration needs to be done.",
);
return 0
return Weight::zero()
}
let on_chain_storage_version = <P as GetStorageVersion>::on_chain_storage_version();
@@ -71,7 +71,7 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,
"Attempted to apply migration to v4 but failed because storage version is {:?}",
on_chain_storage_version,
);
0
Weight::zero()
}
}
+55 -55
View File
@@ -39,7 +39,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_membership.
@@ -61,11 +61,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn add_member(m: u32, ) -> Weight {
(15_318_000 as Weight)
Weight::from_ref_time(15_318_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((51_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(51_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -73,11 +73,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn remove_member(m: u32, ) -> Weight {
(18_005_000 as Weight)
Weight::from_ref_time(18_005_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((45_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(45_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -85,11 +85,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn swap_member(m: u32, ) -> Weight {
(18_029_000 as Weight)
Weight::from_ref_time(18_029_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -97,11 +97,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn reset_member(m: u32, ) -> Weight {
(18_105_000 as Weight)
Weight::from_ref_time(18_105_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((158_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -109,29 +109,29 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn change_key(m: u32, ) -> Weight {
(18_852_000 as Weight)
Weight::from_ref_time(18_852_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:0)
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn set_prime(m: u32, ) -> Weight {
(4_869_000 as Weight)
Weight::from_ref_time(4_869_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((28_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(28_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn clear_prime(m: u32, ) -> Weight {
(1_593_000 as Weight)
Weight::from_ref_time(1_593_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -142,11 +142,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn add_member(m: u32, ) -> Weight {
(15_318_000 as Weight)
Weight::from_ref_time(15_318_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((51_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(51_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -154,11 +154,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn remove_member(m: u32, ) -> Weight {
(18_005_000 as Weight)
Weight::from_ref_time(18_005_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((45_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(45_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -166,11 +166,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn swap_member(m: u32, ) -> Weight {
(18_029_000 as Weight)
Weight::from_ref_time(18_029_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -178,11 +178,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn reset_member(m: u32, ) -> Weight {
(18_105_000 as Weight)
Weight::from_ref_time(18_105_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((158_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -190,28 +190,28 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn change_key(m: u32, ) -> Weight {
(18_852_000 as Weight)
Weight::from_ref_time(18_852_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:0)
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn set_prime(m: u32, ) -> Weight {
(4_869_000 as Weight)
Weight::from_ref_time(4_869_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((28_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(28_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn clear_prime(m: u32, ) -> Weight {
(1_593_000 as Weight)
Weight::from_ref_time(1_593_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
}