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
+3 -3
View File
@@ -26,7 +26,7 @@ use sp_std::{marker::PhantomData, prelude::*};
/// Wrapper for all migrations of this pallet, based on `StorageVersion`.
pub fn migrate<T: Config>() -> Weight {
let version = StorageVersion::get::<Pallet<T>>();
let mut weight = Weight::new();
let mut weight = Weight::zero();
if version < 4 {
weight = weight.saturating_add(v4::migrate::<T>());
@@ -127,7 +127,7 @@ mod v5 {
type DeletionQueue<T: Config> = StorageValue<Pallet<T>, Vec<DeletedContract>>;
pub fn migrate<T: Config>() -> Weight {
let mut weight = Weight::new();
let mut weight = Weight::zero();
<ContractInfoOf<T>>::translate(|_key, old: OldContractInfo<T>| {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
@@ -216,7 +216,7 @@ mod v6 {
type OwnerInfoOf<T: Config> = StorageMap<Pallet<T>, Identity, CodeHash<T>, OwnerInfo<T>>;
pub fn migrate<T: Config>() -> Weight {
let mut weight = Weight::new();
let mut weight = Weight::zero();
<ContractInfoOf<T>>::translate(|_key, old: OldContractInfo<T>| {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
+1 -2
View File
@@ -230,8 +230,7 @@ where
let weight_per_key = (T::WeightInfo::on_initialize_per_trie_key(1) -
T::WeightInfo::on_initialize_per_trie_key(0))
.ref_time();
let decoding_weight =
weight_per_queue_item.scalar_saturating_mul(queue_len as RefTimeWeight);
let decoding_weight = weight_per_queue_item.saturating_mul(queue_len as RefTimeWeight);
// `weight_per_key` being zero makes no sense and would constitute a failure to
// benchmark properly. We opt for not removing any keys at all in this case.
+1 -1
View File
@@ -264,7 +264,7 @@ impl RegisteredChainExtension<Test> for TempStorageExtension {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(2 * WEIGHT_PER_SECOND);
frame_system::limits::BlockWeights::simple_max(2u64 * WEIGHT_PER_SECOND);
pub static ExistentialDeposit: u64 = 1;
}
impl frame_system::Config for Test {
@@ -223,7 +223,7 @@ impl<T: Config> Token<T> for CodeToken {
Load(len) => {
let computation = T::WeightInfo::call_with_code_per_byte(len)
.saturating_sub(T::WeightInfo::call_with_code_per_byte(0));
let bandwidth = T::ContractAccessWeight::get().scalar_saturating_mul(len as u64);
let bandwidth = T::ContractAccessWeight::get().saturating_mul(len as u64);
computation.max(bandwidth)
},
};
File diff suppressed because it is too large Load Diff