Skip to content

Commit

Permalink
Release 5.3.1 (with modified OpenGov Support Curves) (#366)
Browse files Browse the repository at this point in the history
## Description
<!-- Describe what change this PR is implementing -->

## Types of Changes
Please select the branch type you are merging and fill in the relevant
template.
<!--- Check the following box with an x if the following applies: -->
- [ ] Hotfix
- [ ] Release
- [ ] Fix or Feature

## Fix or Feature
<!--- Check the following box with an x if the following applies: -->

### Types of Changes
<!--- What types of changes does your code introduce? -->
- [ ] Tech Debt (Code improvements)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Dependency upgrade (A change in substrate or any 3rd party crate
version)

### Migrations and Hooks
<!--- Check the following box with an x if the following applies: -->
- [ ] This change requires a runtime migration.
- [ ] Modifies `on_initialize`
- [ ] Modifies `on_finalize`

### Checklist for Fix or Feature
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [ ] Change has been tested locally.
- [ ] Change adds / updates tests if applicable.
- [ ] Changelog doc updated.
- [ ] `spec_version` has been incremented.
- [ ] `network-relayer`'s
[events](https://github.com/Cerebellum-Network/network-relayer/blob/dev-cere/shared/substrate/events.go)
have been updated according to the blockchain events if applicable.
- [ ] All CI checks have been passed successfully

## Checklist for Hotfix
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [ ] Changelog has been updated.
- [ ] Crate version has been updated.
- [ ] `spec_version` has been incremented.
- [ ] Transaction version has been updated if required.
- [ ] Pull Request to `dev` has been created.
- [ ] Pull Request to `staging` has been created.
- [ ] `network-relayer`'s
[events](https://github.com/Cerebellum-Network/network-relayer/blob/dev-cere/shared/substrate/events.go)
have been updated according to the blockchain events if applicable.
- [ ] All CI checks have been passed successfully

## Checklist for Release
<!--- All boxes need to be checked. Follow this checklist before
requiring PR review -->
- [ ] Change has been deployed to Devnet.
- [ ] Change has been tested in Devnet.
- [ ] Change has been deployed to Qanet.
- [ ] Change has been tested in Qanet.
- [ ] Change has been deployed to Testnet.
- [ ] Change has been tested in Testnet.
- [ ] Changelog has been updated.
- [ ] Crate version has been updated.
- [ ] Spec version has been updated.
- [ ] Transaction version has been updated if required.
- [ ] All CI checks have been passed successfully

---------

Co-authored-by: rakanalh <[email protected]>
Co-authored-by: Maksim Ramanenkau <[email protected]>
Co-authored-by: Ayush Mishra <[email protected]>
Co-authored-by: Pavel <[email protected]>
  • Loading branch information
5 people authored Jun 21, 2024
1 parent 61aafb1 commit 736216a
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 106 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- [C,D] `WhitelistOrigin` is set to the Technical Committee Collective Body
- [C,D] The _Support Curve_ in OpenGov Tracks is made more strict

## [5.3.0]

Expand Down
3 changes: 0 additions & 3 deletions runtime/cere-dev/src/governance/origins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub mod pallet_custom_origins {
/// Origin for spending up to $10,000,000 DOT from the treasury as well as generally
/// administering it.
Treasurer,
/// Origin for managing the composition of the fellowship.
FellowshipAdmin,
/// Origin for managing the registrar.
GeneralAdmin,
/// Origin able to cancel referenda.
Expand Down Expand Up @@ -77,7 +75,6 @@ pub mod pallet_custom_origins {
decl_unit_ensures!(
StakingAdmin,
Treasurer,
FellowshipAdmin,
GeneralAdmin,
ReferendumCanceller,
ReferendumKiller,
Expand Down
77 changes: 36 additions & 41 deletions runtime/cere-dev/src/governance/tracks.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,59 @@
//! Track configurations for governance.
use pallet_referenda::Curve;

use super::*;

const fn percent(x: i32) -> sp_arithmetic::FixedI64 {
sp_arithmetic::FixedI64::from_rational(x as u128, 100)
}
use pallet_referenda::Curve;

const fn percent_perbill(x: Perbill) -> sp_arithmetic::FixedI64 {
sp_arithmetic::FixedI64::from_perbill(x)
}

const APP_ROOT: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
const SUP_ROOT: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
const SUP_ROOT: Curve = Curve::make_linear(28, 28, percent(20), percent(50));
const APP_STAKING_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
const SUP_STAKING_ADMIN: Curve =
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
Curve::make_reciprocal(12, 28, percent(11), percent(10), percent(50));
const APP_TREASURER: Curve = Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
const SUP_TREASURER: Curve = Curve::make_linear(28, 28, percent(0), percent(50));
const APP_FELLOWSHIP_ADMIN: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
const SUP_FELLOWSHIP_ADMIN: Curve =
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
const SUP_TREASURER: Curve = Curve::make_linear(28, 28, percent(10), percent(50));
const APP_GENERAL_ADMIN: Curve =
Curve::make_reciprocal(4, 28, percent(80), percent(50), percent(100));
const SUP_GENERAL_ADMIN: Curve =
Curve::make_reciprocal(7, 28, percent(10), percent(0), percent(50));
Curve::make_reciprocal(7, 28, percent(20), percent(10), percent(50));
const APP_REFERENDUM_CANCELLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
const SUP_REFERENDUM_CANCELLER: Curve =
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
Curve::make_reciprocal(12, 28, percent(11), percent(10), percent(50));
const APP_REFERENDUM_KILLER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
const SUP_REFERENDUM_KILLER: Curve =
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
Curve::make_reciprocal(12, 28, percent(11), percent(10), percent(50));
const APP_SMALL_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
const SUP_SMALL_TIPPER: Curve = Curve::make_reciprocal(1, 28, percent(4), percent(0), percent(50));
const SUP_SMALL_TIPPER: Curve =
Curve::make_reciprocal(1, 28, percent(14), percent(10), percent(50));
const APP_BIG_TIPPER: Curve = Curve::make_linear(10, 28, percent(50), percent(100));
const SUP_BIG_TIPPER: Curve = Curve::make_reciprocal(8, 28, percent(1), percent(0), percent(50));
const SUP_BIG_TIPPER: Curve = Curve::make_reciprocal(8, 28, percent(11), percent(10), percent(50));
const APP_SMALL_SPENDER: Curve = Curve::make_linear(17, 28, percent(50), percent(100));
const SUP_SMALL_SPENDER: Curve =
Curve::make_reciprocal(12, 28, percent(1), percent(0), percent(50));
Curve::make_reciprocal(12, 28, percent(11), percent(10), percent(50));
const APP_MEDIUM_SPENDER: Curve = Curve::make_linear(23, 28, percent(50), percent(100));
const SUP_MEDIUM_SPENDER: Curve =
Curve::make_reciprocal(16, 28, percent(1), percent(0), percent(50));
Curve::make_reciprocal(16, 28, percent(11), percent(10), percent(50));
const APP_BIG_SPENDER: Curve = Curve::make_linear(28, 28, percent(50), percent(100));
const SUP_BIG_SPENDER: Curve = Curve::make_reciprocal(20, 28, percent(1), percent(0), percent(50));
const SUP_BIG_SPENDER: Curve =
Curve::make_reciprocal(20, 28, percent(11), percent(10), percent(50));
const APP_WHITELISTED_CALLER: Curve =
Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
const SUP_WHITELISTED_CALLER: Curve =
Curve::make_reciprocal(1, 28, percent(20), percent(5), percent(50));
const SUP_WHITELISTED_CALLER: Curve = Curve::make_reciprocal(
1,
28,
percent_perbill(Perbill::from_parts(1_000_000)), // 0.1 %
percent_perbill(Perbill::from_parts(250_000)), // 0.025 %
percent(50),
);

const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13] = [
const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 12] = [
(
0,
pallet_referenda::TrackInfo {
Expand Down Expand Up @@ -77,7 +87,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
pallet_referenda::TrackInfo {
name: "staking_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
decision_deposit: 10 * GRAND,
prepare_period: 2 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
Expand All @@ -91,7 +101,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
pallet_referenda::TrackInfo {
name: "treasurer",
max_deciding: 10,
decision_deposit: GRAND,
decision_deposit: 10 * GRAND,
prepare_period: 2 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
Expand All @@ -100,26 +110,12 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
min_support: SUP_TREASURER,
},
),
(
13,
pallet_referenda::TrackInfo {
name: "fellowship_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
prepare_period: 2 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 10 * MINUTES,
min_approval: APP_FELLOWSHIP_ADMIN,
min_support: SUP_FELLOWSHIP_ADMIN,
},
),
(
14,
pallet_referenda::TrackInfo {
name: "general_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
decision_deposit: 10 * GRAND,
prepare_period: 2 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
Expand Down Expand Up @@ -161,7 +157,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
pallet_referenda::TrackInfo {
name: "small_tipper",
max_deciding: 200,
decision_deposit: DOLLARS,
decision_deposit: 10 * GRAND,
prepare_period: MINUTES,
decision_period: 7 * DAYS,
confirm_period: 10 * MINUTES,
Expand All @@ -175,7 +171,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
pallet_referenda::TrackInfo {
name: "big_tipper",
max_deciding: 100,
decision_deposit: 10 * DOLLARS,
decision_deposit: 10 * GRAND,
prepare_period: 10 * MINUTES,
decision_period: 7 * DAYS,
confirm_period: HOURS,
Expand All @@ -189,7 +185,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
pallet_referenda::TrackInfo {
name: "small_spender",
max_deciding: 50,
decision_deposit: 100 * DOLLARS,
decision_deposit: 10 * GRAND,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 12 * HOURS,
Expand All @@ -203,7 +199,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
pallet_referenda::TrackInfo {
name: "medium_spender",
max_deciding: 50,
decision_deposit: 200 * DOLLARS,
decision_deposit: 10 * GRAND,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 24 * HOURS,
Expand All @@ -217,7 +213,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 13
pallet_referenda::TrackInfo {
name: "big_spender",
max_deciding: 50,
decision_deposit: 400 * DOLLARS,
decision_deposit: 10 * GRAND,
prepare_period: 4 * HOURS,
decision_period: 28 * DAYS,
confirm_period: 48 * HOURS,
Expand Down Expand Up @@ -247,7 +243,6 @@ impl pallet_referenda::TracksInfo<Balance, BlockNumber> for TracksInfo {
// General admin
origins::Origin::StakingAdmin => Ok(10),
origins::Origin::Treasurer => Ok(11),
origins::Origin::FellowshipAdmin => Ok(13),
origins::Origin::GeneralAdmin => Ok(14),
// Referendum admins
origins::Origin::ReferendumCanceller => Ok(20),
Expand Down
2 changes: 1 addition & 1 deletion runtime/cere-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 53100,
spec_version: 53102,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 17,
Expand Down
3 changes: 0 additions & 3 deletions runtime/cere/src/governance/origins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ pub mod pallet_custom_origins {
/// Origin for spending up to $10,000,000 DOT from the treasury as well as generally
/// administering it.
Treasurer,
/// Origin for managing the composition of the fellowship.
FellowshipAdmin,
/// Origin for managing the registrar.
GeneralAdmin,
/// Origin able to cancel referenda.
Expand Down Expand Up @@ -76,7 +74,6 @@ pub mod pallet_custom_origins {
decl_unit_ensures!(
StakingAdmin,
Treasurer,
FellowshipAdmin,
GeneralAdmin,
ReferendumCanceller,
ReferendumKiller,
Expand Down
Loading

0 comments on commit 736216a

Please sign in to comment.