parachains: Fix configuration module (#4540)

* parachains: Fix configuration module

Closes #4529
Closes #4533

I figured that trying to avoid updates does not really worth it to keep.
This is because we seem to not update the configuration often and when
we do we approach this carefully. Thus possibility of a redundant update
is really negligable. At the same time, if such a redundant update does
happen then the effects of that are really small: just some wasted
storage interactions.

On the other hand, making it work was a little bit annoying. With the
proper fix for the pending updates this would be even more annoying
since now we would have to add combinatorically more cases to test this.

So I figured that I will just scrap that and simplify the code.

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_configuration.rs

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=polkadot-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/polkadot/src/weights/runtime_parachains_configuration.rs

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::configuration --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_configuration.rs

* review fixes

Co-authored-by: Parity Bot <admin@parity.io>
This commit is contained in:
Sergei Shulepov
2021-12-21 14:28:56 +01:00
committed by GitHub
parent 478ac9589b
commit 5a3ee43cda
5 changed files with 444 additions and 178 deletions
@@ -16,7 +16,7 @@
//! Autogenerated weights for `runtime_parachains::configuration`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-09-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-12-16, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
// Executed Command:
@@ -33,7 +33,6 @@
// --header=./file_header.txt
// --output=./runtime/kusama/src/weights/runtime_parachains_configuration.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
@@ -44,35 +43,35 @@ use sp_std::marker::PhantomData;
/// Weight functions for `runtime_parachains::configuration`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for WeightInfo<T> {
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
// Storage: Configuration PendingConfig (r:1 w:1)
// Storage: Configuration PendingConfigs (r:1 w:1)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
fn set_config_with_block_number() -> Weight {
(12_378_000 as Weight)
(8_240_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
// Storage: Configuration PendingConfig (r:1 w:1)
// Storage: Configuration PendingConfigs (r:1 w:1)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
fn set_config_with_u32() -> Weight {
(12_384_000 as Weight)
(8_123_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
// Storage: Configuration PendingConfig (r:1 w:1)
// Storage: Configuration PendingConfigs (r:1 w:1)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
fn set_config_with_option_u32() -> Weight {
(12_746_000 as Weight)
(8_547_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
// Storage: Configuration PendingConfig (r:1 w:1)
// Storage: Configuration PendingConfigs (r:1 w:1)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
fn set_config_with_weight() -> Weight {
(12_563_000 as Weight)
(8_379_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
@@ -80,11 +79,11 @@ impl<T: frame_system::Config> runtime_parachains::configuration::WeightInfo for
fn set_hrmp_open_request_ttl() -> Weight {
(2_000_000_000_000 as Weight)
}
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
// Storage: Configuration PendingConfig (r:1 w:1)
// Storage: Configuration PendingConfigs (r:1 w:1)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
fn set_config_with_balance() -> Weight {
(12_644_000 as Weight)
(8_400_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}