Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Governance v2 (Kusama only) (#5205)
Browse files Browse the repository at this point in the history
* First bits

* Create new origins

* Repot governance configs

* Tests for treasury spends

* Integrate treasury spend threshold origins

* Bump deps

* Add whitelist, configure treasury spend origins

* Add governance curves

* Enable curve's ceil to be configured

* Make compile

* Rest of new governance params

* Build fixes

* Fixes

* Fix warning

* Use new EnsureOrigin::try_successful_origin

* Some repotting

* Add files

* Ready for initial review

* Fixes

* Formatting

* Bump

* rename

* Derive MEL for Origin enum

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add benchmarks

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_conviction_voting

* Update Cargo.lock

* Update runtime/kusama/src/governance/origins.rs

Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>

* allow root to demote and promote, fixing benchmarks

* fix whitelist origin benchmarks

* typo

* cargo update -p sp-io

* add second referenda instance to benchmarks

* allow root to act as a 9th dan in track

* feature flag it

* cargo update -p sp-io

* fix merge

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_referenda

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_conviction_voting

* allow root to create auction

* Update mod.rs

* more origin fixes

* root isnt needed actually

* cargo update -p sp-io

* allow root to cancel slash

* initial stuff

* make copy data from kusama

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_referenda

* Update Cargo.lock

* commit new weight files

* more files

* use weight files

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_referenda

* Update Cargo.lock

* Update to latest master

* Formatting

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_ranked_collective

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_conviction_voting

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_conviction_voting

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_whitelist

* Rename Origin -> RuntimeOrigin

This was done in Substrate and is now needed here as well.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* cargo update -p sp-io

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Tech Committee can promote to VI Dan

* Update runtime/kusama/src/governance/mod.rs

Co-authored-by: Amar Singh <asinghchrony@protonmail.com>

* Formatting

* Update runtime/kusama/src/governance/fellowship.rs

Co-authored-by: Amar Singh <asinghchrony@protonmail.com>

* Fixes

* Avoid updating extraneous deps

* Fix broken stuff

* ".git/.scripts/bench-bot.sh" runtime kusama-dev pallet_referenda

* Update runtime/kusama/src/governance/fellowship.rs

* Reorder EitherOf origins

Zero logic change to make the benchmarking work.
It uses the first successful origin which can only promote to rank 6.
By swapping the order we use Root which can always promote.

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Revert param change and update doc

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Co-authored-by: Xiliang Chen <xlchen1291@gmail.com>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Amar Singh <asinghchrony@protonmail.com>
  • Loading branch information
6 people authored and bredamatt committed Oct 4, 2022
1 parent e6f8662 commit 1c80469
Show file tree
Hide file tree
Showing 20 changed files with 1,946 additions and 66 deletions.
72 changes: 72 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions runtime/kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ pallet-transaction-payment = { git = "https://github.com/paritytech/substrate",
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-nomination-pools-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-conviction-voting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand All @@ -63,7 +64,9 @@ pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", bra
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-ranked-collective = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-referenda = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-society = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand All @@ -77,6 +80,7 @@ pallet-tips = { git = "https://github.com/paritytech/substrate", branch = "maste
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-vesting = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-whitelist = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false }
pallet-xcm-benchmarks = { path = "../../xcm/pallet-xcm-benchmarks", default-features = false, optional = true }
frame-election-provider-support = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
Expand Down Expand Up @@ -142,6 +146,7 @@ std = [
"pallet-transaction-payment/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-collective/std",
"pallet-conviction-voting/std",
"pallet-elections-phragmen/std",
"pallet-election-provider-multi-phase/std",
"pallet-fast-unstake/std",
Expand All @@ -158,7 +163,9 @@ std = [
"pallet-offences/std",
"pallet-preimage/std",
"pallet-proxy/std",
"pallet-ranked-collective/std",
"pallet-recovery/std",
"pallet-referenda/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-society/std",
Expand All @@ -169,6 +176,7 @@ std = [
"pallet-treasury/std",
"pallet-utility/std",
"pallet-vesting/std",
"pallet-whitelist/std",
"pallet-babe/std",
"pallet-xcm/std",
"sp-mmr-primitives/std",
Expand Down Expand Up @@ -204,6 +212,7 @@ runtime-benchmarks = [
"pallet-bounties/runtime-benchmarks",
"pallet-child-bounties/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-conviction-voting/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
"pallet-elections-phragmen/runtime-benchmarks",
"pallet-election-provider-multi-phase/runtime-benchmarks",
Expand All @@ -220,6 +229,8 @@ runtime-benchmarks = [
"pallet-nomination-pools-benchmarking/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-ranked-collective/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-society/runtime-benchmarks",
"pallet-recovery/runtime-benchmarks",
Expand All @@ -231,6 +242,7 @@ runtime-benchmarks = [
"pallet-vesting/runtime-benchmarks",
"pallet-offences-benchmarking/runtime-benchmarks",
"pallet-session-benchmarking/runtime-benchmarks",
"pallet-whitelist/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"hex-literal",
Expand All @@ -252,6 +264,7 @@ try-runtime = [
"pallet-child-bounties/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-collective/try-runtime",
"pallet-conviction-voting/try-runtime",
"pallet-elections-phragmen/try-runtime",
"pallet-election-provider-multi-phase/try-runtime",
"pallet-fast-unstake/try-runtime",
Expand All @@ -267,7 +280,9 @@ try-runtime = [
"pallet-offences/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
"pallet-ranked-collective/try-runtime",
"pallet-recovery/try-runtime",
"pallet-referenda/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-society/try-runtime",
Expand All @@ -277,6 +292,7 @@ try-runtime = [
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-vesting/try-runtime",
"pallet-whitelist/try-runtime",
"pallet-babe/try-runtime",
"pallet-xcm/try-runtime",
"runtime-common/try-runtime",
Expand Down
3 changes: 2 additions & 1 deletion runtime/kusama/constants/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ pub mod currency {

pub const UNITS: Balance = 1_000_000_000_000;
pub const CENTS: Balance = UNITS / 30_000;
pub const GRAND: Balance = CENTS * 100_000;
pub const QUID: Balance = CENTS * 100;
pub const GRAND: Balance = QUID * 1_000;
pub const MILLICENTS: Balance = CENTS / 1_000;

pub const fn deposit(items: u32, bytes: u32) -> Balance {
Expand Down
Loading

0 comments on commit 1c80469

Please sign in to comment.