Companion for Weight v1.5 Follow Up (#5949)

* updates

* remove new

* fix up some stuff

* fix cargo files

* fix

* fix template

* update lockfile for {"substrate"}

* Update block_weights.rs

* remove unused

* remove unused

Co-authored-by: parity-processbot <>
This commit is contained in:
Shawn Tabrizi
2022-09-01 20:00:51 +01:00
committed by GitHub
parent 75d49dfeb4
commit e28bf2e476
128 changed files with 969 additions and 968 deletions
@@ -44,22 +44,22 @@ impl<T: frame_system::Config> WeightInfo<T> {
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
Weight::from_ref_time({{underscore benchmark.base_weight}} as RefTimeWeight)
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
.saturating_add(Weight::from_ref_time({{underscore cw.slope}} as RefTimeWeight).saturating_mul({{cw.name}} as RefTimeWeight))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as RefTimeWeight))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as RefTimeWeight).saturating_mul({{cr.name}} as RefTimeWeight)))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as RefTimeWeight))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as RefTimeWeight).saturating_mul({{cw.name}} as RefTimeWeight)))
{{/each}}
}
{{/each}}
+2 -2
View File
@@ -404,7 +404,7 @@ pub mod pallet {
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_initialize(_n: BlockNumberFor<T>) -> Weight {
let mut weight_used = Weight::new();
let mut weight_used = Weight::zero();
if let Some(migration) = CurrentMigration::<T>::get() {
// Consume 10% of block at most
let max_weight = T::BlockWeights::get().max_block / 10;
@@ -886,7 +886,7 @@ pub mod pallet {
mut stage: VersionMigrationStage,
weight_cutoff: Weight,
) -> (Weight, Option<VersionMigrationStage>) {
let mut weight_used = Weight::new();
let mut weight_used = Weight::zero();
// TODO: Correct weights for the components of this:
let todo_sv_migrate_weight: Weight = T::DbWeight::get().reads_writes(1, 1);
@@ -97,8 +97,8 @@ impl pallet_balances::Config for Runtime {
}
parameter_types! {
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.scalar_div(4);
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.scalar_div(4);
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
}
parameter_types! {
@@ -19,7 +19,6 @@
use frame_support::{
construct_runtime, parameter_types,
traits::{Everything, Nothing},
weights::Weight,
};
use sp_core::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32};
@@ -162,7 +161,7 @@ impl pallet_xcm::Config for Runtime {
}
parameter_types! {
pub const FirstMessageFactorPercent: Weight = Weight::from_ref_time(100);
pub const FirstMessageFactorPercent: u64 = 100;
}
impl ump::Config for Runtime {
@@ -97,8 +97,8 @@ impl pallet_balances::Config for Runtime {
}
parameter_types! {
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.scalar_div(4);
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.scalar_div(4);
pub const ReservedXcmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
pub const ReservedDmpWeight: Weight = WEIGHT_PER_SECOND.saturating_div(4);
}
parameter_types! {
@@ -19,7 +19,6 @@
use frame_support::{
construct_runtime, parameter_types,
traits::{Everything, Nothing},
weights::Weight,
};
use sp_core::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32};
@@ -162,7 +161,7 @@ impl pallet_xcm::Config for Runtime {
}
parameter_types! {
pub const FirstMessageFactorPercent: Weight = Weight::from_ref_time(100);
pub const FirstMessageFactorPercent: u64 = 100;
}
impl ump::Config for Runtime {