Collectives runtime: alliance pallet upgrade introducing new retirement notice feature (#1573)

* support retirement notice feature

* [ci] Apply cargo-fmt

* use primitive const

* update lockfile for {"substrate", "polkadot"}

Co-authored-by: paritytech-ci <paritytech-ci@parity.io>
Co-authored-by: parity-processbot <>
This commit is contained in:
Muharem Ismailov
2022-08-29 23:39:27 +02:00
committed by GitHub
parent f0fbb51019
commit 73e5531664
2 changed files with 373 additions and 349 deletions
+361 -347
View File
File diff suppressed because it is too large Load Diff
@@ -423,9 +423,10 @@ impl pallet_collator_selection::Config for Runtime {
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Runtime>;
}
parameter_types! {
pub const AllianceMotionDuration: BlockNumber = 5 * DAYS;
pub const ALLIANCE_MOTION_DURATION: BlockNumber = 5 * DAYS;
parameter_types! {
pub const AllianceMotionDuration: BlockNumber = ALLIANCE_MOTION_DURATION;
}
pub const ALLIANCE_MAX_PROPOSALS: u32 = 100;
pub const ALLIANCE_MAX_MEMBERS: u32 = 100;
@@ -451,6 +452,9 @@ parameter_types! {
// account used to temporarily deposit slashed imbalance before teleporting
pub SlashedImbalanceAccId: AccountId = constants::account::SLASHED_IMBALANCE_ACC_ID.into();
pub RelayTreasuryAccId: AccountId = constants::account::RELAY_TREASURY_PALL_ID.into_account_truncating();
// The number of blocks a member must wait between giving a retirement notice and retiring.
// Supposed to be greater than time required to `kick_member` with alliance motion.
pub const AllianceRetirementPeriod: BlockNumber = (90 * DAYS) + ALLIANCE_MOTION_DURATION;
}
impl pallet_alliance::Config for Runtime {
@@ -463,6 +467,7 @@ impl pallet_alliance::Config for Runtime {
type Slashed = ToParentTreasury<RelayTreasuryAccId, SlashedImbalanceAccId, Runtime>;
type InitializeMembers = AllianceMotion;
type MembershipChanged = AllianceMotion;
type RetirementPeriod = AllianceRetirementPeriod;
type IdentityVerifier = (); // Don't block accounts on identity criteria
type ProposalProvider = AllianceProposalProvider<Runtime, AllianceCollective>;
type MaxProposals = ConstU32<ALLIANCE_MAX_MEMBERS>;
@@ -549,8 +554,13 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
Migrations,
>;
// All migrations executed on runtime upgrade as a nested tuple of types implementing `OnRuntimeUpgrade`.
// Included migrations must be idempotent.
type Migrations = (pallet_alliance::migration::Migration<Runtime>,);
#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
extern crate frame_benchmarking;