Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast Fellowship Promote Tracks #356

Merged
merged 7 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([polkadot-fellows/runtimes#356](https://github.com/polkadot-fellows/runtimes/pull/356)).

## [1.2.7] 14.06.2024

Note: This release only affects the following runtimes and is not a full system release:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<Success = Rank> {
FastPromoteTo1Dan = ranks::DAN_1,
FastPromoteTo2Dan = ranks::DAN_2,
FastPromoteTo3Dan = ranks::DAN_3,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -71,6 +77,9 @@ impl Convert<TrackId, Rank> 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,
}
}
Expand Down Expand Up @@ -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;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunno if this is too short? The origin is already "faster" since it can bypass the promotion period.
On the other hand, with the high turnout it will rather error on the side of rejecting so maybe its fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main issue is having to wait for years to get to a correct level.

If this can bypass the promotion min period, I don't see the need to have it faster than the "normal" 30 days, I don't expect members to find 30 days too slow..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main issue is having to wait for years to get to a correct level.

Yeah that needs to be fixed by making a call in Core Fellowship that will respect this origin.

Dunno if this is too short?

I think it is OK, could also go in the middle with something like 14 days.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No strong opinions, so changed to 30 days after internal discussion.

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<Balance, BlockNumber> for TracksInfo {
type Id = TrackId;
type RuntimeOrigin = <RuntimeOrigin as frame_support::traits::OriginTrait>::PalletsOrigin;
fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo<Balance, BlockNumber>)] {
use constants as tracks;
static DATA: [(TrackId, pallet_referenda::TrackInfo<Balance, BlockNumber>); 21] = [
static DATA: [(TrackId, pallet_referenda::TrackInfo<Balance, BlockNumber>); 24] = [
(
tracks::MEMBERS,
pallet_referenda::TrackInfo {
Expand Down Expand Up @@ -483,6 +511,48 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> 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[..]
}
Expand Down Expand Up @@ -525,7 +595,11 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> 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(()),
}
}
}
Expand Down
Loading