From edd9c4f2cd4449bef0ddc076bb8a6f33c4ee2359 Mon Sep 17 00:00:00 2001 From: PraetorP Date: Fri, 14 Jul 2023 11:34:27 +0700 Subject: [PATCH 1/2] feat(kusama-runtime): impl new types Impl of added associated types for the new logic of `pallet-ranked-collective` --- runtime/kusama/src/governance/fellowship.rs | 24 ++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/runtime/kusama/src/governance/fellowship.rs b/runtime/kusama/src/governance/fellowship.rs index 8837c19e0eb1..c5a3216ef08b 100644 --- a/runtime/kusama/src/governance/fellowship.rs +++ b/runtime/kusama/src/governance/fellowship.rs @@ -23,7 +23,7 @@ use frame_support::traits::{MapSuccess, TryMapSuccess}; use sp_arithmetic::traits::CheckedSub; use sp_runtime::{ morph_types, - traits::{ConstU16, Replace, TypedGet}, + traits::{ConstU16, Replace, ReplaceWithDefaultFor, TypedGet}, }; use super::*; @@ -330,6 +330,28 @@ morph_types! { impl pallet_ranked_collective::Config for Runtime { type WeightInfo = weights::pallet_ranked_collective::WeightInfo; type RuntimeEvent = RuntimeEvent; + // Adding is by any of: + // - Root. + // - the FellowshipAdmin origin. + // - a Fellowship origin. + type AddOrigin = EitherOf< + frame_system::EnsureRootWithSuccess>, + EitherOf< + MapSuccess>, + TryMapSuccess>, + >, + >; + // Removing is by any of: + // - Root can remove arbitrarily. + // - the FellowshipAdmin origin (i.e. token holder referendum); + // - a vote by the rank two above the current rank. + type RemoveOrigin = EitherOf< + frame_system::EnsureRootWithSuccess>, + EitherOf< + MapSuccess>>, + TryMapSuccess>>, + >, + >; // Promotion is by any of: // - Root can demote arbitrarily. // - the FellowshipAdmin origin (i.e. token holder referendum); From e96eb783fa02d940c1a95ee7a8dd02e09cbb083e Mon Sep 17 00:00:00 2001 From: PraetorP Date: Fri, 14 Jul 2023 15:51:32 +0700 Subject: [PATCH 2/2] refactor(kusama): types --- runtime/kusama/src/governance/fellowship.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/runtime/kusama/src/governance/fellowship.rs b/runtime/kusama/src/governance/fellowship.rs index c5a3216ef08b..53fc95cbba56 100644 --- a/runtime/kusama/src/governance/fellowship.rs +++ b/runtime/kusama/src/governance/fellowship.rs @@ -334,24 +334,12 @@ impl pallet_ranked_collective::Config for Runtime // - Root. // - the FellowshipAdmin origin. // - a Fellowship origin. - type AddOrigin = EitherOf< - frame_system::EnsureRootWithSuccess>, - EitherOf< - MapSuccess>, - TryMapSuccess>, - >, - >; + type AddOrigin = MapSuccess>; // Removing is by any of: // - Root can remove arbitrarily. // - the FellowshipAdmin origin (i.e. token holder referendum); // - a vote by the rank two above the current rank. - type RemoveOrigin = EitherOf< - frame_system::EnsureRootWithSuccess>, - EitherOf< - MapSuccess>>, - TryMapSuccess>>, - >, - >; + type RemoveOrigin = Self::DemoteOrigin; // Promotion is by any of: // - Root can demote arbitrarily. // - the FellowshipAdmin origin (i.e. token holder referendum);