Skip to content

Commit

Permalink
Merge pull request #709 from gregdhill/feat/set-collator-selection
Browse files Browse the repository at this point in the history
feat: add migration to set the parameters for collator-selection
  • Loading branch information
sander2 committed Sep 15, 2022
2 parents bd462ac + 42e7bb8 commit 75dc5f8
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions parachain/runtime/kintsugi/src/lib.rs
Expand Up @@ -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::<Runtime>::put(9);
collator_selection::CandidacyBond::<Runtime>::put(1000 * 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 =
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<ParentLocation, ExecutiveBody>>>;
Expand Down Expand Up @@ -1120,8 +1140,14 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signatu
/// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
/// Executive: handles dispatch to the various modules.
pub type Executive =
frame_executive::Executive<Runtime, Block, frame_system::ChainContext<Runtime>, Runtime, AllPalletsWithSystem, ()>;
pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
SetCollatorSelection,
>;

#[cfg(not(feature = "disable-runtime-api"))]
impl_runtime_apis! {
Expand Down

0 comments on commit 75dc5f8

Please sign in to comment.