Unverified Commit 4c547668 authored by Keith Yeung's avatar Keith Yeung Committed by GitHub
Browse files

Add benchmarking for parachain runtime configuration pallet (#3862)



* Add benchmarking for parachain runtime configuration pallet

* cargo fmt

* Add WeightInfo trait

* Specify missing WeightInfo associated type in mocks

* Fix typo

* 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

* Fix compilation errors

* 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

* Condense the number of WeightInfo methods

* Fixes

* 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

* Make use of weights generated from kusama benchmarking

* Use a better dispatch function for weighing set_config_with_block_number

* 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=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
Co-authored-by: default avatarParity Bot <admin@parity.io>
parent e1069537
Pipeline #157888 canceled with stages
in 4 minutes and 26 seconds
...@@ -156,7 +156,9 @@ impl pallet_balances::Config for Test { ...@@ -156,7 +156,9 @@ impl pallet_balances::Config for Test {
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
} }
impl configuration::Config for Test {} impl configuration::Config for Test {
type WeightInfo = configuration::weights::WeightInfo<Test>;
}
impl shared::Config for Test {} impl shared::Config for Test {}
......
...@@ -213,7 +213,7 @@ pub mod pallet { ...@@ -213,7 +213,7 @@ pub mod pallet {
/// ///
/// ## Events /// ## Events
/// The `Registered` event is emitted in case of success. /// The `Registered` event is emitted in case of success.
#[pallet::weight(T::WeightInfo::register())] #[pallet::weight(<T as Config>::WeightInfo::register())]
pub fn register( pub fn register(
origin: OriginFor<T>, origin: OriginFor<T>,
id: ParaId, id: ParaId,
...@@ -231,7 +231,7 @@ pub mod pallet { ...@@ -231,7 +231,7 @@ pub mod pallet {
/// ///
/// The deposit taken can be specified for this registration. Any `ParaId` /// The deposit taken can be specified for this registration. Any `ParaId`
/// can be registered, including sub-1000 IDs which are System Parachains. /// can be registered, including sub-1000 IDs which are System Parachains.
#[pallet::weight(T::WeightInfo::force_register())] #[pallet::weight(<T as Config>::WeightInfo::force_register())]
pub fn force_register( pub fn force_register(
origin: OriginFor<T>, origin: OriginFor<T>,
who: T::AccountId, who: T::AccountId,
...@@ -247,7 +247,7 @@ pub mod pallet { ...@@ -247,7 +247,7 @@ pub mod pallet {
/// Deregister a Para Id, freeing all data and returning any deposit. /// Deregister a Para Id, freeing all data and returning any deposit.
/// ///
/// The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread. /// The caller must be Root, the `para` owner, or the `para` itself. The para must be a parathread.
#[pallet::weight(T::WeightInfo::deregister())] #[pallet::weight(<T as Config>::WeightInfo::deregister())]
pub fn deregister(origin: OriginFor<T>, id: ParaId) -> DispatchResult { pub fn deregister(origin: OriginFor<T>, id: ParaId) -> DispatchResult {
Self::ensure_root_para_or_owner(origin, id)?; Self::ensure_root_para_or_owner(origin, id)?;
Self::do_deregister(id) Self::do_deregister(id)
...@@ -264,7 +264,7 @@ pub mod pallet { ...@@ -264,7 +264,7 @@ pub mod pallet {
/// `ParaId` to be a long-term identifier of a notional "parachain". However, their /// `ParaId` to be a long-term identifier of a notional "parachain". However, their
/// scheduling info (i.e. whether they're a parathread or parachain), auction information /// scheduling info (i.e. whether they're a parathread or parachain), auction information
/// and the auction deposit are switched. /// and the auction deposit are switched.
#[pallet::weight(T::WeightInfo::swap())] #[pallet::weight(<T as Config>::WeightInfo::swap())]
pub fn swap(origin: OriginFor<T>, id: ParaId, other: ParaId) -> DispatchResult { pub fn swap(origin: OriginFor<T>, id: ParaId, other: ParaId) -> DispatchResult {
Self::ensure_root_para_or_owner(origin, id)?; Self::ensure_root_para_or_owner(origin, id)?;
...@@ -325,7 +325,7 @@ pub mod pallet { ...@@ -325,7 +325,7 @@ pub mod pallet {
/// ///
/// ## Events /// ## Events
/// The `Reserved` event is emitted in case of success, which provides the ID reserved for use. /// The `Reserved` event is emitted in case of success, which provides the ID reserved for use.
#[pallet::weight(T::WeightInfo::reserve())] #[pallet::weight(<T as Config>::WeightInfo::reserve())]
pub fn reserve(origin: OriginFor<T>) -> DispatchResult { pub fn reserve(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?; let who = ensure_signed(origin)?;
let id = NextFreeParaId::<T>::get().max(LOWEST_PUBLIC_ID); let id = NextFreeParaId::<T>::get().max(LOWEST_PUBLIC_ID);
...@@ -659,7 +659,9 @@ mod tests { ...@@ -659,7 +659,9 @@ mod tests {
type Event = Event; type Event = Event;
} }
impl configuration::Config for Test {} impl configuration::Config for Test {
type WeightInfo = configuration::weights::WeightInfo<Test>;
}
parameter_types! { parameter_types! {
pub const ParaDeposit: Balance = 10; pub const ParaDeposit: Balance = 10;
......
...@@ -1126,7 +1126,9 @@ impl pallet_proxy::Config for Runtime { ...@@ -1126,7 +1126,9 @@ impl pallet_proxy::Config for Runtime {
impl parachains_origin::Config for Runtime {} impl parachains_origin::Config for Runtime {}
impl parachains_configuration::Config for Runtime {} impl parachains_configuration::Config for Runtime {
type WeightInfo = weights::runtime_parachains_configuration::WeightInfo<Runtime>;
}
impl parachains_shared::Config for Runtime {} impl parachains_shared::Config for Runtime {}
...@@ -2000,6 +2002,7 @@ sp_api::impl_runtime_apis! { ...@@ -2000,6 +2002,7 @@ sp_api::impl_runtime_apis! {
list_benchmark!(list, extra, runtime_common::claims, Claims); list_benchmark!(list, extra, runtime_common::claims, Claims);
list_benchmark!(list, extra, runtime_common::slots, Slots); list_benchmark!(list, extra, runtime_common::slots, Slots);
list_benchmark!(list, extra, runtime_common::paras_registrar, Registrar); list_benchmark!(list, extra, runtime_common::paras_registrar, Registrar);
list_benchmark!(list, extra, runtime_parachains::configuration, Configuration);
// Substrate // Substrate
list_benchmark!(list, extra, pallet_bags_list, BagsList); list_benchmark!(list, extra, pallet_bags_list, BagsList);
list_benchmark!(list, extra, pallet_balances, Balances); list_benchmark!(list, extra, pallet_balances, Balances);
...@@ -2074,6 +2077,7 @@ sp_api::impl_runtime_apis! { ...@@ -2074,6 +2077,7 @@ sp_api::impl_runtime_apis! {
add_benchmark!(params, batches, runtime_common::claims, Claims); add_benchmark!(params, batches, runtime_common::claims, Claims);
add_benchmark!(params, batches, runtime_common::slots, Slots); add_benchmark!(params, batches, runtime_common::slots, Slots);
add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar); add_benchmark!(params, batches, runtime_common::paras_registrar, Registrar);
add_benchmark!(params, batches, runtime_parachains::configuration, Configuration);
// Substrate // Substrate
add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_balances, Balances);
add_benchmark!(params, batches, pallet_bags_list, BagsList); add_benchmark!(params, batches, pallet_bags_list, BagsList);
......
...@@ -44,3 +44,4 @@ pub mod runtime_common_claims; ...@@ -44,3 +44,4 @@ pub mod runtime_common_claims;
pub mod runtime_common_crowdloan; pub mod runtime_common_crowdloan;
pub mod runtime_common_paras_registrar; pub mod runtime_common_paras_registrar;
pub mod runtime_common_slots; pub mod runtime_common_slots;
pub mod runtime_parachains_configuration;
// Copyright 2017-2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! 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: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
// Executed Command:
// target/release/polkadot
// 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
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::Weight};
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 ActiveConfig (r:1 w:0)
fn set_config_with_block_number() -> Weight {
(12_378_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 ActiveConfig (r:1 w:0)
fn set_config_with_u32() -> Weight {
(12_384_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 ActiveConfig (r:1 w:0)
fn set_config_with_option_u32() -> Weight {
(12_746_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 ActiveConfig (r:1 w:0)
fn set_config_with_weight() -> Weight {
(12_563_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
// Storage: Benchmark Override (r:0 w:0)
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 ActiveConfig (r:1 w:0)
fn set_config_with_balance() -> Weight {
(12_644_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
}
}
...@@ -28,12 +28,12 @@ pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", ...@@ -28,12 +28,12 @@ pallet-authority-discovery = { git = "https://github.com/paritytech/substrate",
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false } pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true } frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
xcm = { package = "xcm", path = "../../xcm", default-features = false } xcm = { package = "xcm", path = "../../xcm", default-features = false }
xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false } xcm-executor = { package = "xcm-executor", path = "../../xcm/xcm-executor", default-features = false }
......
...@@ -26,6 +26,10 @@ use primitives::v1::{Balance, SessionIndex, MAX_CODE_SIZE, MAX_POV_SIZE}; ...@@ -26,6 +26,10 @@ use primitives::v1::{Balance, SessionIndex, MAX_CODE_SIZE, MAX_POV_SIZE};
use sp_runtime::traits::Zero; use sp_runtime::traits::Zero;
use sp_std::prelude::*; use sp_std::prelude::*;
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
pub mod weights;
pub use pallet::*; pub use pallet::*;
pub mod migration; pub mod migration;
...@@ -258,6 +262,15 @@ impl<BlockNumber: Zero> HostConfiguration<BlockNumber> { ...@@ -258,6 +262,15 @@ impl<BlockNumber: Zero> HostConfiguration<BlockNumber> {
} }
} }
pub trait WeightInfo {
fn set_config_with_block_number() -> Weight;
fn set_config_with_u32() -> Weight;
fn set_config_with_option_u32() -> Weight;
fn set_config_with_weight() -> Weight;
fn set_config_with_balance() -> Weight;
fn set_hrmp_open_request_ttl() -> Weight;
}
#[frame_support::pallet] #[frame_support::pallet]
pub mod pallet { pub mod pallet {
use super::*; use super::*;
...@@ -268,7 +281,10 @@ pub mod pallet { ...@@ -268,7 +281,10 @@ pub mod pallet {
pub struct Pallet<T>(_); pub struct Pallet<T>(_);
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config + shared::Config {} pub trait Config: frame_system::Config + shared::Config {
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
}
#[pallet::error] #[pallet::error]
pub enum Error<T> { pub enum Error<T> {
...@@ -310,7 +326,7 @@ pub mod pallet { ...@@ -310,7 +326,7 @@ pub mod pallet {
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// Set the validation upgrade frequency. /// Set the validation upgrade frequency.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_validation_upgrade_frequency( pub fn set_validation_upgrade_frequency(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -323,7 +339,7 @@ pub mod pallet { ...@@ -323,7 +339,7 @@ pub mod pallet {
} }
/// Set the validation upgrade delay. /// Set the validation upgrade delay.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_validation_upgrade_delay( pub fn set_validation_upgrade_delay(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -336,7 +352,7 @@ pub mod pallet { ...@@ -336,7 +352,7 @@ pub mod pallet {
} }
/// Set the acceptance period for an included candidate. /// Set the acceptance period for an included candidate.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_code_retention_period( pub fn set_code_retention_period(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -349,7 +365,7 @@ pub mod pallet { ...@@ -349,7 +365,7 @@ pub mod pallet {
} }
/// Set the max validation code size for incoming upgrades. /// Set the max validation code size for incoming upgrades.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_max_code_size(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_max_code_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
ensure!(new <= MAX_CODE_SIZE, Error::<T>::InvalidNewValue); ensure!(new <= MAX_CODE_SIZE, Error::<T>::InvalidNewValue);
...@@ -360,7 +376,7 @@ pub mod pallet { ...@@ -360,7 +376,7 @@ pub mod pallet {
} }
/// Set the max POV block size for incoming upgrades. /// Set the max POV block size for incoming upgrades.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_max_pov_size(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_max_pov_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
ensure!(new <= MAX_POV_SIZE, Error::<T>::InvalidNewValue); ensure!(new <= MAX_POV_SIZE, Error::<T>::InvalidNewValue);
...@@ -371,7 +387,7 @@ pub mod pallet { ...@@ -371,7 +387,7 @@ pub mod pallet {
} }
/// Set the max head data size for paras. /// Set the max head data size for paras.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_max_head_data_size(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_max_head_data_size(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -381,7 +397,7 @@ pub mod pallet { ...@@ -381,7 +397,7 @@ pub mod pallet {
} }
/// Set the number of parathread execution cores. /// Set the number of parathread execution cores.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_parathread_cores(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_parathread_cores(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -391,7 +407,7 @@ pub mod pallet { ...@@ -391,7 +407,7 @@ pub mod pallet {
} }
/// Set the number of retries for a particular parathread. /// Set the number of retries for a particular parathread.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_parathread_retries(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_parathread_retries(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -401,7 +417,7 @@ pub mod pallet { ...@@ -401,7 +417,7 @@ pub mod pallet {
} }
/// Set the parachain validator-group rotation frequency /// Set the parachain validator-group rotation frequency
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_group_rotation_frequency( pub fn set_group_rotation_frequency(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -417,7 +433,7 @@ pub mod pallet { ...@@ -417,7 +433,7 @@ pub mod pallet {
} }
/// Set the availability period for parachains. /// Set the availability period for parachains.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_chain_availability_period( pub fn set_chain_availability_period(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -433,7 +449,7 @@ pub mod pallet { ...@@ -433,7 +449,7 @@ pub mod pallet {
} }
/// Set the availability period for parathreads. /// Set the availability period for parathreads.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_thread_availability_period( pub fn set_thread_availability_period(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -449,7 +465,7 @@ pub mod pallet { ...@@ -449,7 +465,7 @@ pub mod pallet {
} }
/// Set the scheduling lookahead, in expected number of blocks at peak throughput. /// Set the scheduling lookahead, in expected number of blocks at peak throughput.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_scheduling_lookahead(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_scheduling_lookahead(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -459,7 +475,7 @@ pub mod pallet { ...@@ -459,7 +475,7 @@ pub mod pallet {
} }
/// Set the maximum number of validators to assign to any core. /// Set the maximum number of validators to assign to any core.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_option_u32())]
pub fn set_max_validators_per_core( pub fn set_max_validators_per_core(
origin: OriginFor<T>, origin: OriginFor<T>,
new: Option<u32>, new: Option<u32>,
...@@ -472,7 +488,7 @@ pub mod pallet { ...@@ -472,7 +488,7 @@ pub mod pallet {
} }
/// Set the maximum number of validators to use in parachain consensus. /// Set the maximum number of validators to use in parachain consensus.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_option_u32())]
pub fn set_max_validators(origin: OriginFor<T>, new: Option<u32>) -> DispatchResult { pub fn set_max_validators(origin: OriginFor<T>, new: Option<u32>) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -482,7 +498,7 @@ pub mod pallet { ...@@ -482,7 +498,7 @@ pub mod pallet {
} }
/// Set the dispute period, in number of sessions to keep for disputes. /// Set the dispute period, in number of sessions to keep for disputes.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_dispute_period(origin: OriginFor<T>, new: SessionIndex) -> DispatchResult { pub fn set_dispute_period(origin: OriginFor<T>, new: SessionIndex) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -492,7 +508,7 @@ pub mod pallet { ...@@ -492,7 +508,7 @@ pub mod pallet {
} }
/// Set the dispute post conclusion acceptance period. /// Set the dispute post conclusion acceptance period.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_dispute_post_conclusion_acceptance_period( pub fn set_dispute_post_conclusion_acceptance_period(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -506,7 +522,7 @@ pub mod pallet { ...@@ -506,7 +522,7 @@ pub mod pallet {
} }
/// Set the maximum number of dispute spam slots. /// Set the maximum number of dispute spam slots.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_dispute_max_spam_slots(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_dispute_max_spam_slots(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -516,7 +532,7 @@ pub mod pallet { ...@@ -516,7 +532,7 @@ pub mod pallet {
} }
/// Set the dispute conclusion by time out period. /// Set the dispute conclusion by time out period.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_block_number())]
pub fn set_dispute_conclusion_by_time_out_period( pub fn set_dispute_conclusion_by_time_out_period(
origin: OriginFor<T>, origin: OriginFor<T>,
new: T::BlockNumber, new: T::BlockNumber,
...@@ -530,7 +546,7 @@ pub mod pallet { ...@@ -530,7 +546,7 @@ pub mod pallet {
/// Set the no show slots, in number of number of consensus slots. /// Set the no show slots, in number of number of consensus slots.
/// Must be at least 1. /// Must be at least 1.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_no_show_slots(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_no_show_slots(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
...@@ -543,7 +559,7 @@ pub mod pallet { ...@@ -543,7 +559,7 @@ pub mod pallet {
} }
/// Set the total number of delay tranches. /// Set the total number of delay tranches.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_n_delay_tranches(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_n_delay_tranches(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(origin)?;
Self::update_config_member(|config| { Self::update_config_member(|config| {
...@@ -553,7 +569,7 @@ pub mod pallet { ...@@ -553,7 +569,7 @@ pub mod pallet {
} }
/// Set the zeroth delay tranche width. /// Set the zeroth delay tranche width.
#[pallet::weight((1_000, DispatchClass::Operational))] #[pallet::weight(T::WeightInfo::set_config_with_u32())]
pub fn set_zeroth_delay_tranche_width(origin: OriginFor<T>, new: u32) -> DispatchResult { pub fn set_zeroth_delay_tranche_width(origin: OriginFor<T>, new: u32) -> DispatchResult {
ensure_root(origin)?; ensure_root(or