Enable changing executor params through governance (#6934)

* Add a pallet call to change executor params

* Use `OptionQuery`; Avoid runtime panic

* Move pending executor params to `configuration`

* Move `ExecutorParams` to `HostConfiguration` structure

* Add executor params to the v5 migration

* Add an `ExecutorParams` benchmark

* ".git/.scripts/commands/bench/bench.sh" runtime polkadot runtime_parachains::configuration

* Add to `WeightInfo`

* Add dummy weights to other networks

* ".git/.scripts/commands/bench/bench.sh" runtime kusama runtime_parachains::configuration

* ".git/.scripts/commands/bench/bench.sh" runtime rococo runtime_parachains::configuration

* ".git/.scripts/commands/bench/bench.sh" runtime westend runtime_parachains::configuration

* Use real weight

* Fix comment

---------

Co-authored-by: command-bot <>
This commit is contained in:
s0me0ne-unkn0wn
2023-04-14 13:21:12 +02:00
committed by GitHub
parent f0c507362d
commit 0211c4b2f7
11 changed files with 221 additions and 108 deletions
@@ -17,6 +17,7 @@
use crate::configuration::*;
use frame_benchmarking::{benchmarks, BenchmarkError, BenchmarkResult};
use frame_system::RawOrigin;
use primitives::{ExecutorParam, ExecutorParams, PvfExecTimeoutKind, PvfPrepTimeoutKind};
use sp_runtime::traits::One;
benchmarks! {
@@ -36,6 +37,18 @@ benchmarks! {
set_config_with_balance {}: set_hrmp_sender_deposit(RawOrigin::Root, 100_000_000_000)
set_config_with_executor_params {}: set_executor_params(RawOrigin::Root, ExecutorParams::from(&[
ExecutorParam::MaxMemoryPages(2080),
ExecutorParam::StackLogicalMax(65536),
ExecutorParam::StackNativeMax(256 * 1024 * 1024),
ExecutorParam::WasmExtBulkMemory,
ExecutorParam::PrecheckingMaxMemory(2 * 1024 * 1024 * 1024),
ExecutorParam::PvfPrepTimeout(PvfPrepTimeoutKind::Precheck, 60_000),
ExecutorParam::PvfPrepTimeout(PvfPrepTimeoutKind::Lenient, 360_000),
ExecutorParam::PvfExecTimeout(PvfExecTimeoutKind::Backing, 2_000),
ExecutorParam::PvfExecTimeout(PvfExecTimeoutKind::Approval, 12_000),
][..]))
impl_benchmark_test_suite!(
Pallet,
crate::mock::new_test_ext(Default::default()),
@@ -28,7 +28,9 @@ use sp_std::vec::Vec;
/// v1-v2: <https://github.com/paritytech/polkadot/pull/4420>
/// v2-v3: <https://github.com/paritytech/polkadot/pull/6091>
/// v3-v4: <https://github.com/paritytech/polkadot/pull/6345>
/// v4-v5: <https://github.com/paritytech/polkadot/pull/6937> + <https://github.com/paritytech/polkadot/pull/6961>
/// v4-v5: <https://github.com/paritytech/polkadot/pull/6937>
/// + <https://github.com/paritytech/polkadot/pull/6961>
/// + <https://github.com/paritytech/polkadot/pull/6934>
pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(5);
pub mod v5 {
@@ -230,6 +232,9 @@ minimum_validation_upgrade_delay : pre.minimum_validation_upgrade_delay,
// Default values are zeroes, thus it's ensured allowed ancestry never crosses the upgrade block.
async_backing_params : AsyncBackingParams { max_candidate_depth: 0, allowed_ancestry_len: 0 },
// Default executor parameters set is empty
executor_params : Default::default(),
}
};
@@ -268,6 +273,7 @@ async_backing_params : AsyncBackingParams { max_candidate_de
mod tests {
use super::*;
use crate::mock::{new_test_ext, Test};
use primitives::ExecutorParams;
#[test]
fn v4_deserialized_from_actual_data() {
@@ -391,6 +397,7 @@ mod tests {
// additional checks for async backing.
assert_eq!(v5.async_backing_params.allowed_ancestry_len, 0);
assert_eq!(v5.async_backing_params.max_candidate_depth, 0);
assert_eq!(v5.executor_params, ExecutorParams::new());
}
});
}
@@ -326,6 +326,7 @@ fn setting_pending_config_members() {
pvf_checking_enabled: true,
pvf_voting_ttl: 3,
minimum_validation_upgrade_delay: 20,
executor_params: Default::default(),
};
Configuration::set_validation_upgrade_cooldown(