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
@@ -574,7 +574,7 @@ pub mod pallet {
// NOTE: the non-database part of the weight for `should_end_session(n)` is
// included as weight for empty block, the database part is expected to be in
// cache.
0
Weight::zero()
}
}
}
+2 -2
View File
@@ -47,7 +47,7 @@ pub fn migrate<T: pallet_session_historical::Config, P: GetStorageVersion + Pall
target: "runtime::session_historical",
"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();
@@ -82,7 +82,7 @@ pub fn migrate<T: pallet_session_historical::Config, P: GetStorageVersion + Pall
"Attempted to apply migration to v1 but failed because storage version is {:?}",
on_chain_storage_version,
);
0
Weight::zero()
}
}
+1 -1
View File
@@ -239,7 +239,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
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));
}
impl frame_system::Config for Test {
+13 -13
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_session.
@@ -55,17 +55,17 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Session NextKeys (r:1 w:1)
// Storage: Session KeyOwner (r:4 w:4)
fn set_keys() -> Weight {
(48_484_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(48_484_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Session NextKeys (r:1 w:1)
// Storage: Session KeyOwner (r:0 w:4)
fn purge_keys() -> Weight {
(38_003_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(38_003_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
}
@@ -75,16 +75,16 @@ impl WeightInfo for () {
// Storage: Session NextKeys (r:1 w:1)
// Storage: Session KeyOwner (r:4 w:4)
fn set_keys() -> Weight {
(48_484_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(48_484_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Staking Ledger (r:1 w:0)
// Storage: Session NextKeys (r:1 w:1)
// Storage: Session KeyOwner (r:0 w:4)
fn purge_keys() -> Weight {
(38_003_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(38_003_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
}