Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion: Accept Kusama StakingAdmin origin #1865

Merged
merged 12 commits into from
Dec 22, 2022
30 changes: 22 additions & 8 deletions parachains/runtimes/assets/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ use xcm_config::{KsmLocation, XcmConfig};
pub use sp_runtime::BuildStorage;

// Polkadot imports
use pallet_xcm::{EnsureXcm, IsMajorityOfBody};
use pallet_xcm::{EnsureXcm, IsMajorityOfBody, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use xcm::latest::BodyId;
use xcm_executor::XcmExecutor;

use kusama_runtime_constants::xcm::body::{FELLOWS_INDEX, STAKING_ADMIN_INDEX};
joepetrowski marked this conversation as resolved.
Show resolved Hide resolved

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

impl_opaque_keys! {
Expand Down Expand Up @@ -458,16 +460,21 @@ impl parachain_info::Config for Runtime {}

impl cumulus_pallet_aura_ext::Config for Runtime {}

parameter_types! {
// Fellows pluralistic body.
pub const FellowsBodyId: BodyId = BodyId::Index(FELLOWS_INDEX);
}

impl cumulus_pallet_xcmp_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem;
type VersionWrapper = PolkadotXcm;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>,
>;
type ControllerOrigin = EnsureXcm<(
IsMajorityOfBody<KsmLocation, ExecutiveBody>,
joepetrowski marked this conversation as resolved.
Show resolved Hide resolved
IsVoiceOfBody<KsmLocation, FellowsBodyId>,
)>;
type ControllerOriginConverter = xcm_config::XcmOriginToTransactDispatchOrigin;
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Runtime>;
}
Expand Down Expand Up @@ -510,11 +517,18 @@ parameter_types! {
pub const MinCandidates: u32 = 5;
pub const SessionLength: BlockNumber = 6 * HOURS;
pub const MaxInvulnerables: u32 = 100;
// StakingAdmin pluralistic body.
pub const StakingAdminBodyId: BodyId = BodyId::Index(STAKING_ADMIN_INDEX);
}

/// We allow root and the Relay Chain council to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin =
EitherOfDiverse<EnsureRoot<AccountId>, EnsureXcm<IsMajorityOfBody<KsmLocation, ExecutiveBody>>>;
/// We allow root, the Relay Chain council and the StakingAdmin to execute privileged collator selection operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>,
EnsureXcm<(
IsMajorityOfBody<KsmLocation, ExecutiveBody>,
IsVoiceOfBody<KsmLocation, StakingAdminBodyId>,
)>,
>;

impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
Expand Down