From 35b11d44dfd666472ec53092078d6deee13c7a23 Mon Sep 17 00:00:00 2001 From: Gregory Hill Date: Thu, 1 Sep 2022 12:36:40 +0100 Subject: [PATCH] feat: add migration to set the parameters for collator-selection Signed-off-by: Gregory Hill --- parachain/runtime/kintsugi/src/lib.rs | 30 +++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/parachain/runtime/kintsugi/src/lib.rs b/parachain/runtime/kintsugi/src/lib.rs index a7f5d2a1a5..ffee6b00c4 100644 --- a/parachain/runtime/kintsugi/src/lib.rs +++ b/parachain/runtime/kintsugi/src/lib.rs @@ -263,6 +263,26 @@ parameter_types! { pub const ExecutiveBody: BodyId = BodyId::Executive; } +// Set the initial parameters for CollatorSelection. +pub struct SetCollatorSelection; +impl frame_support::traits::OnRuntimeUpgrade for SetCollatorSelection { + fn on_runtime_upgrade() -> frame_support::weights::Weight { + collator_selection::DesiredCandidates::::put(9); + collator_selection::CandidacyBond::::put(100 * KINT.one()); + RocksDbWeight::get().writes(2) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result<(), &'static str> { + Ok(()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade() -> Result<(), &'static str> { + Ok(()) + } +} + /// We allow root and the Relay Chain council to execute privileged collator selection operations. pub type CollatorSelectionUpdateOrigin = EnsureOneOf, EnsureXcm>>; @@ -1115,8 +1135,14 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Executive: handles dispatch to the various modules. -pub type Executive = - frame_executive::Executive, Runtime, AllPalletsWithSystem, ()>; +pub type Executive = frame_executive::Executive< + Runtime, + Block, + frame_system::ChainContext, + Runtime, + AllPalletsWithSystem, + SetCollatorSelection, +>; #[cfg(not(feature = "disable-runtime-api"))] impl_runtime_apis! {