Skip to content

Commit

Permalink
On-chain parameters for ClusterGov (#418)
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
- [x] 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? -->
- [x] 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 -->
- [x] 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 -->
- [ ] 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 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
  • Loading branch information
yahortsaryk authored Aug 13, 2024
1 parent 4d1801f commit ee19798
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
- name: Check Build
run: |
cargo build --release --features try-runtime
- name: Check Try-Runtime
run: |
try-runtime --runtime ./target/release/wbuild/cere-runtime/cere_runtime.compact.compressed.wasm \
on-runtime-upgrade --disable-idempotency-checks live --uri wss://archive.mainnet.cere.network:443
# - name: Check Try-Runtime
# run: |
# try-runtime --runtime ./target/release/wbuild/cere-runtime/cere_runtime.compact.compressed.wasm \
# on-runtime-upgrade --disable-idempotency-checks live --uri wss://archive.qanet.cere.network:443
- name: Run dev chain
run: |
timeout --preserve-status 30s ./target/release/cere --dev
Expand Down
12 changes: 6 additions & 6 deletions runtime/cere-dev/src/governance/tracks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 14
pallet_referenda::TrackInfo {
name: "cluster_protocol_activator",
max_deciding: 50,
decision_deposit: DOLLARS, // todo: define value for Devnet
prepare_period: 0, // todo: define value for Devnet
decision_deposit: DOLLARS,
prepare_period: 0,
decision_period: 2 * MINUTES,
confirm_period: MINUTES,
min_enactment_period: 0, // todo: define value for Devnet
min_enactment_period: 0,
min_approval: APP_CLUSTER_PROTOCOL_ACTIVATOR,
min_support: SUP_CLUSTER_PROTOCOL_ACTIVATOR,
},
Expand All @@ -193,11 +193,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 14
pallet_referenda::TrackInfo {
name: "cluster_protocol_updater",
max_deciding: 50,
decision_deposit: DOLLARS, // todo: define value for Devnet
prepare_period: 0, // todo: define value for Devnet
decision_deposit: DOLLARS,
prepare_period: 0,
decision_period: 2 * MINUTES,
confirm_period: MINUTES,
min_enactment_period: 0, // todo: define value for Devnet
min_enactment_period: 0,
min_approval: APP_CLUSTER_PROTOCOL_UPDATER,
min_support: SUP_CLUSTER_PROTOCOL_UPDATER,
},
Expand Down
6 changes: 3 additions & 3 deletions runtime/cere-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,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: 54004,
spec_version: 54005,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 18,
Expand Down Expand Up @@ -1110,8 +1110,8 @@ impl pallet_nomination_pools::Config for Runtime {
}

parameter_types! {
pub const ClusterBondingAmount: Balance = DOLLARS;
pub const ClusterUnboningDelay: BlockNumber = MINUTES;
pub const ClusterBondingAmount: Balance = 100 * GRAND;
pub const ClusterUnboningDelay: BlockNumber = 28 * DAYS;
}

impl pallet_ddc_staking::Config for Runtime {
Expand Down
16 changes: 8 additions & 8 deletions runtime/cere/src/governance/tracks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 14
pallet_referenda::TrackInfo {
name: "cluster_protocol_activator",
max_deciding: 50,
decision_deposit: 5 * GRAND, // todo: define value for Mainnet/Testnet/Qanet
prepare_period: 2 * HOURS, // todo: define value for Mainnet/Testnet/Qanet
decision_deposit: 10 * GRAND,
prepare_period: 30 * MINUTES,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 10 * MINUTES, // todo: define value for Mainnet/Testnet/Qanet
confirm_period: 10 * MINUTES,
min_enactment_period: 10 * MINUTES,
min_approval: APP_CLUSTER_PROTOCOL_ACTIVATOR,
min_support: SUP_CLUSTER_PROTOCOL_ACTIVATOR,
},
Expand All @@ -193,11 +193,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 14
pallet_referenda::TrackInfo {
name: "cluster_protocol_updater",
max_deciding: 50,
decision_deposit: 5 * GRAND, // todo: define value for Mainnet/Testnet/Qanet
prepare_period: 2 * HOURS, // todo: define value for Mainnet/Testnet/Qanet
decision_deposit: 10 * GRAND,
prepare_period: 30 * MINUTES,
decision_period: 28 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 10 * MINUTES, // todo: define value for Mainnet/Testnet/Qanet
confirm_period: 10 * MINUTES,
min_enactment_period: 10 * MINUTES,
min_approval: APP_CLUSTER_PROTOCOL_UPDATER,
min_support: SUP_CLUSTER_PROTOCOL_UPDATER,
},
Expand Down
6 changes: 3 additions & 3 deletions runtime/cere/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,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: 54004,
spec_version: 54005,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 18,
Expand Down Expand Up @@ -1171,8 +1171,8 @@ impl pallet_ddc_payouts::Config for Runtime {
}

parameter_types! {
pub const ClusterBondingAmount: Balance = DOLLARS;
pub const ClusterUnboningDelay: BlockNumber = MINUTES;
pub const ClusterBondingAmount: Balance = 100 * GRAND;
pub const ClusterUnboningDelay: BlockNumber = 28 * DAYS;
}

impl pallet_ddc_staking::Config for Runtime {
Expand Down
23 changes: 16 additions & 7 deletions runtime/common/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,23 @@ pub mod tracks {
percent(50),
);
pub const APP_CLUSTER_PROTOCOL_ACTIVATOR: Curve =
Curve::make_linear(10, 28, percent(0), percent(10));
pub const SUP_CLUSTER_PROTOCOL_ACTIVATOR: Curve =
Curve::make_reciprocal(1, 28, percent(4), percent(0), percent(10));

Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
pub const SUP_CLUSTER_PROTOCOL_ACTIVATOR: Curve = Curve::make_reciprocal(
1,
28,
percent_perbill(Perbill::from_parts(100_000)), // 0.01 %
percent_perbill(Perbill::from_parts(25_000)), // 0.0025 %
percent(50),
);
pub const APP_CLUSTER_PROTOCOL_UPDATER: Curve =
Curve::make_linear(10, 28, percent(0), percent(10));
pub const SUP_CLUSTER_PROTOCOL_UPDATER: Curve =
Curve::make_reciprocal(1, 28, percent(4), percent(0), percent(10));
Curve::make_reciprocal(16, 28 * 24, percent(96), percent(50), percent(100));
pub const SUP_CLUSTER_PROTOCOL_UPDATER: Curve = Curve::make_reciprocal(
1,
28,
percent_perbill(Perbill::from_parts(100_000)), // 0.01 %
percent_perbill(Perbill::from_parts(25_000)), // 0.0025 %
percent(50),
);

// Root track
pub const ROOT_TRACK_ID: u16 = 0;
Expand Down

0 comments on commit ee19798

Please sign in to comment.