From ad93c8d4fd2386060a54b337082a7748841380a4 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 24 Jun 2024 17:28:53 +0200 Subject: [PATCH 1/5] Add Fast Promotion Fellowship origin and tracks I-III Signed-off-by: Oliver Tale-Yazdi --- .../src/fellowship/origins.rs | 20 +++++ .../src/fellowship/tracks.rs | 78 ++++++++++++++++++- 2 files changed, 96 insertions(+), 2 deletions(-) diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs index 5ed2c19f79..51d2f82f9b 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs @@ -99,6 +99,16 @@ pub mod pallet_origins { /// Origin aggregated through weighted votes of those with rank 8 or above when voting on /// a month-long track; `Success` is 6. PromoteTo6Dan, + + /// Origin aggregated through weighted votes of those with rank 3 or above when voting on + /// a 7 day long track; `Success` is 1. + FastPromoteTo1Dan, + /// Origin aggregated through weighted votes of those with rank 4 or above when voting on + /// a 7 day long track; `Success` is 2. + FastPromoteTo2Dan, + /// Origin aggregated through weighted votes of those with rank 5 or above when voting on + /// a 7 day long track; `Success` is 3. + FastPromoteTo3Dan, } impl Origin { @@ -244,4 +254,14 @@ pub mod pallet_origins { PromoteTo6Dan = ranks::DAN_6, } } + + // Fellowship origin indicating weighted voting from at least the rank of `Success + 2` on + // a 7 day long track; needed for fast Fellowship promotion voting. + decl_ensure! { + pub type EnsureCanFastPromoteTo: EnsureOrigin { + FastPromoteTo1Dan = ranks::DAN_1, + FastPromoteTo2Dan = ranks::DAN_2, + FastPromoteTo3Dan = ranks::DAN_3, + } + } } diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs index f6ef2166a4..6c22ddb23c 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -56,6 +56,12 @@ pub mod constants { pub const PROMOTE_TO_4DAN: TrackId = 24; pub const PROMOTE_TO_5DAN: TrackId = 25; pub const PROMOTE_TO_6DAN: TrackId = 26; + + // Fast track promotions (7 days) used to fast-track promotions. This works out as the track ID + // minus 28. + pub const FAST_PROMOTE_TO_1DAN: TrackId = 31; + pub const FAST_PROMOTE_TO_2DAN: TrackId = 32; + pub const FAST_PROMOTE_TO_3DAN: TrackId = 33; } /// Convert the track ID (defined above) into the minimum rank (i.e. fellowship Dan grade) required @@ -71,6 +77,9 @@ impl Convert for MinRankOfClass { // A promotion vote; the track ID turns out to be 18 more than the minimum required // rank. promotion @ 21..=26 => promotion - 18, + // A fast promotion vote; the track ID turns out to be 28 more than the minimum required + // rank. + fast_promote @ 31..=33 => fast_promote - 28, _ => Rank::MAX, } } @@ -110,13 +119,32 @@ const PROMOTE_MIN_SUPPORT: pallet_referenda::Curve = pallet_referenda::Curve::Li ceil: Perbill::from_percent(100), }; +const FAST_PROMOTE_MAX_DECIDING: u32 = 10; +const FAST_PROMOTE_DECISION_DEPOSIT: Balance = 5 * DOLLARS; +const FAST_PROMOTE_PREPARE_PERIOD: BlockNumber = 0; +const FAST_PROMOTE_DECISION_PERIOD: BlockNumber = 7 * DAYS; +const FAST_PROMOTE_CONFIRM_PERIOD: BlockNumber = HOURS; +const FAST_PROMOTE_MIN_ENACTMENT_PERIOD: BlockNumber = 0; +const FAST_PROMOTE_MIN_APPROVAL: pallet_referenda::Curve = + pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(66), + ceil: Perbill::from_percent(100), + }; +const FAST_PROMOTE_MIN_SUPPORT: pallet_referenda::Curve = + pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), + }; + pub struct TracksInfo; impl pallet_referenda::TracksInfo for TracksInfo { type Id = TrackId; type RuntimeOrigin = ::PalletsOrigin; fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] { use constants as tracks; - static DATA: [(TrackId, pallet_referenda::TrackInfo); 21] = [ + static DATA: [(TrackId, pallet_referenda::TrackInfo); 24] = [ ( tracks::MEMBERS, pallet_referenda::TrackInfo { @@ -483,6 +511,48 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: PROMOTE_MIN_SUPPORT, }, ), + ( + tracks::FAST_PROMOTE_TO_1DAN, + pallet_referenda::TrackInfo { + name: "fast promote to I Dan", + max_deciding: FAST_PROMOTE_MAX_DECIDING, + decision_deposit: FAST_PROMOTE_DECISION_DEPOSIT, + prepare_period: FAST_PROMOTE_PREPARE_PERIOD, + decision_period: FAST_PROMOTE_DECISION_PERIOD, + confirm_period: FAST_PROMOTE_CONFIRM_PERIOD, + min_enactment_period: FAST_PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: FAST_PROMOTE_MIN_APPROVAL, + min_support: FAST_PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::FAST_PROMOTE_TO_2DAN, + pallet_referenda::TrackInfo { + name: "fast promote to II Dan", + max_deciding: FAST_PROMOTE_MAX_DECIDING, + decision_deposit: FAST_PROMOTE_DECISION_DEPOSIT, + prepare_period: FAST_PROMOTE_PREPARE_PERIOD, + decision_period: FAST_PROMOTE_DECISION_PERIOD, + confirm_period: FAST_PROMOTE_CONFIRM_PERIOD, + min_enactment_period: FAST_PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: FAST_PROMOTE_MIN_APPROVAL, + min_support: FAST_PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::FAST_PROMOTE_TO_3DAN, + pallet_referenda::TrackInfo { + name: "fast promote to III Dan", + max_deciding: FAST_PROMOTE_MAX_DECIDING, + decision_deposit: FAST_PROMOTE_DECISION_DEPOSIT, + prepare_period: FAST_PROMOTE_PREPARE_PERIOD, + decision_period: FAST_PROMOTE_DECISION_PERIOD, + confirm_period: FAST_PROMOTE_CONFIRM_PERIOD, + min_enactment_period: FAST_PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: FAST_PROMOTE_MIN_APPROVAL, + min_support: FAST_PROMOTE_MIN_SUPPORT, + }, + ), ]; &DATA[..] } @@ -525,7 +595,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { Ok(Origin::PromoteTo5Dan) => Ok(tracks::PROMOTE_TO_5DAN), Ok(Origin::PromoteTo6Dan) => Ok(tracks::PROMOTE_TO_6DAN), - _ => Err(()), + Ok(Origin::FastPromoteTo1Dan) => Ok(tracks::FAST_PROMOTE_TO_1DAN), + Ok(Origin::FastPromoteTo2Dan) => Ok(tracks::FAST_PROMOTE_TO_2DAN), + Ok(Origin::FastPromoteTo3Dan) => Ok(tracks::FAST_PROMOTE_TO_3DAN), + + Err(_) => Err(()), } } } From 3056e5ccdb1722eb9c9ad87fbaf6930ae68c30c8 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 24 Jun 2024 17:30:12 +0200 Subject: [PATCH 2/5] Changelog Signed-off-by: Oliver Tale-Yazdi --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba4394af42..f0766dda11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Changelog for the runtimes governed by the Polkadot Fellowship. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## Unreleased + +### Added + +- Fast promotion tracks and origins for the Fellowship ranks I-III [TODO] + ## [1.2.7] 14.06.2024 Note: This release only affects the following runtimes and is not a full system release: From c802da8c9d7d7496ba59129cb38b22967afd1e26 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Mon, 24 Jun 2024 17:32:49 +0200 Subject: [PATCH 3/5] Changelog Signed-off-by: Oliver Tale-Yazdi --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0766dda11..03c3301a12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added -- Fast promotion tracks and origins for the Fellowship ranks I-III [TODO] +- Fast promotion tracks and origins for the Fellowship ranks I-III ([polkadot-fellows/runtimes#356](https://github.com/polkadot-fellows/runtimes/pull/356)). ## [1.2.7] 14.06.2024 From 6716c7dbdfea223ead12ec15ecbbb663dcfe3bb4 Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Wed, 26 Jun 2024 14:57:46 +0200 Subject: [PATCH 4/5] Change decision period 7->30 days Signed-off-by: Oliver Tale-Yazdi --- .../collectives-polkadot/src/fellowship/origins.rs | 8 ++++---- .../collectives-polkadot/src/fellowship/tracks.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs index 51d2f82f9b..ed998422a0 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs @@ -101,13 +101,13 @@ pub mod pallet_origins { PromoteTo6Dan, /// Origin aggregated through weighted votes of those with rank 3 or above when voting on - /// a 7 day long track; `Success` is 1. + /// a 30 day long track; `Success` is 1. FastPromoteTo1Dan, /// Origin aggregated through weighted votes of those with rank 4 or above when voting on - /// a 7 day long track; `Success` is 2. + /// a 30 day long track; `Success` is 2. FastPromoteTo2Dan, /// Origin aggregated through weighted votes of those with rank 5 or above when voting on - /// a 7 day long track; `Success` is 3. + /// a 30 day long track; `Success` is 3. FastPromoteTo3Dan, } @@ -256,7 +256,7 @@ pub mod pallet_origins { } // Fellowship origin indicating weighted voting from at least the rank of `Success + 2` on - // a 7 day long track; needed for fast Fellowship promotion voting. + // a 30 day long track; needed for fast Fellowship promotion voting. decl_ensure! { pub type EnsureCanFastPromoteTo: EnsureOrigin { FastPromoteTo1Dan = ranks::DAN_1, diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs index 6c22ddb23c..320f97d647 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -57,7 +57,7 @@ pub mod constants { pub const PROMOTE_TO_5DAN: TrackId = 25; pub const PROMOTE_TO_6DAN: TrackId = 26; - // Fast track promotions (7 days) used to fast-track promotions. This works out as the track ID + // Fast track promotions (30 days) used to fast-track promotions. This works out as the track ID // minus 28. pub const FAST_PROMOTE_TO_1DAN: TrackId = 31; pub const FAST_PROMOTE_TO_2DAN: TrackId = 32; @@ -122,7 +122,7 @@ const PROMOTE_MIN_SUPPORT: pallet_referenda::Curve = pallet_referenda::Curve::Li const FAST_PROMOTE_MAX_DECIDING: u32 = 10; const FAST_PROMOTE_DECISION_DEPOSIT: Balance = 5 * DOLLARS; const FAST_PROMOTE_PREPARE_PERIOD: BlockNumber = 0; -const FAST_PROMOTE_DECISION_PERIOD: BlockNumber = 7 * DAYS; +const FAST_PROMOTE_DECISION_PERIOD: BlockNumber = 30 * DAYS; const FAST_PROMOTE_CONFIRM_PERIOD: BlockNumber = HOURS; const FAST_PROMOTE_MIN_ENACTMENT_PERIOD: BlockNumber = 0; const FAST_PROMOTE_MIN_APPROVAL: pallet_referenda::Curve = From e8fef1c504b65a8c775102b58adc97a19453687a Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 2 Aug 2024 16:29:05 +0200 Subject: [PATCH 5/5] Use EnsureCanFastPromote in the Fellowship Signed-off-by: Oliver Tale-Yazdi --- .../collectives/collectives-polkadot/src/fellowship/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs index 974e50dbf8..9f39e5ddfc 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -19,6 +19,7 @@ mod origins; mod tracks; use crate::{ + fellowship::origins::EnsureCanFastPromoteTo, impls::ToParentTreasury, weights, xcm_config::{AssetHubUsdt, LocationToAccountId, TreasurerBodyId}, @@ -33,7 +34,7 @@ use frame_support::{ }, PalletId, }; -use frame_system::{EnsureNever, EnsureRoot, EnsureRootWithSuccess, EnsureWithSuccess}; +use frame_system::{EnsureRoot, EnsureRootWithSuccess}; pub use origins::{ pallet_origins as pallet_fellowship_origins, Architects, EnsureCanPromoteTo, EnsureCanRetainAt, EnsureFellowship, Fellows, Masters, Members, ToVoice, @@ -206,8 +207,7 @@ impl pallet_core_fellowship::Config for Runtime { >, EnsureCanPromoteTo, >; - // TODO until https://github.com/polkadot-fellows/runtimes/pull/356/files - type FastPromoteOrigin = EnsureWithSuccess, AccountId, ConstU16<0>>; + type FastPromoteOrigin = EnsureCanFastPromoteTo; type EvidenceSize = ConstU32<65536>; type MaxRank = ConstU32<9>; }