Weight v1.5 Follow Ups (#12155)

* update api

* update

* remove unused

* remove `one` api

* fix unused

* fmt

* add saturating accrue

* remove `Weight::new()`

* use some macros

* div makes no sense

* Update weight_v2.rs

* missed some

* more patch

* fixes

* more fixes

* more fix

* more fix

* Update frame/support/src/weights/weight_v2.rs

* not needed

* fix weight file
This commit is contained in:
Shawn Tabrizi
2022-09-01 18:48:03 +01:00
committed by GitHub
parent 6be21e0397
commit 1df4561676
80 changed files with 965 additions and 960 deletions
@@ -842,7 +842,7 @@ pub mod pallet {
let items = items as u64;
<T as frame_system::Config>::DbWeight::get()
.reads_writes(1, 1)
.scalar_saturating_mul(items)
.saturating_mul(items)
// we assume that the read/write per-byte weight is the same for child and top tree.
.saturating_add(T::WeightInfo::process_top_key(size))
}
@@ -1246,7 +1246,7 @@ mod mock {
pub(crate) fn run_to_block(n: u32) -> (H256, Weight) {
let mut root = Default::default();
let mut weight_sum = Weight::new();
let mut weight_sum = Weight::zero();
log::trace!(target: LOG_TARGET, "running from {:?} to {:?}", System::block_number(), n);
while System::block_number() < n {
System::set_block_number(System::block_number() + 1);
@@ -1622,7 +1622,7 @@ pub(crate) mod remote_tests {
n: <Runtime as frame_system::Config>::BlockNumber,
) -> (H256, Weight) {
let mut root = Default::default();
let mut weight_sum = Weight::new();
let mut weight_sum = Weight::zero();
while System::<Runtime>::block_number() < n {
System::<Runtime>::set_block_number(System::<Runtime>::block_number() + One::one());
System::<Runtime>::on_initialize(System::<Runtime>::block_number());
@@ -90,7 +90,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn process_top_key(v: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).saturating_mul(v as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
@@ -132,7 +132,7 @@ impl WeightInfo for () {
fn process_top_key(v: u32, ) -> Weight {
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 0
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).saturating_mul(v as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}