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
@@ -27,9 +27,7 @@ use frame_support::{
pallet_prelude::*,
traits::{OneSessionHandler, ValidatorSet, ValidatorSetWithIdentification},
};
use primitives::{
AssignmentId, AuthorityDiscoveryId, ExecutorParam, ExecutorParams, SessionIndex, SessionInfo,
};
use primitives::{AssignmentId, AuthorityDiscoveryId, ExecutorParams, SessionIndex, SessionInfo};
use sp_std::vec::Vec;
pub use pallet::*;
@@ -39,10 +37,6 @@ pub mod migration;
#[cfg(test)]
mod tests;
// The order of parameters should be deterministic, that is, one should not reorder them when
// changing the array contents to avoid creating excessive pressure to PVF execution subsys.
const EXECUTOR_PARAMS: [ExecutorParam; 0] = [];
/// A type for representing the validator account id in a session.
pub type AccountId<T> = <<T as Config>::ValidatorSet as ValidatorSet<
<T as frame_system::Config>::AccountId,
@@ -196,10 +190,8 @@ impl<T: Config> Pallet<T> {
dispute_period,
};
Sessions::<T>::insert(&new_session_index, &new_session_info);
SessionExecutorParams::<T>::insert(
&new_session_index,
ExecutorParams::from(&EXECUTOR_PARAMS[..]),
);
SessionExecutorParams::<T>::insert(&new_session_index, config.executor_params);
}
/// Called by the initializer to initialize the session info pallet.