Skip to content

Commit

Permalink
Add OpenGov to Darwinia (#1372)
Browse files Browse the repository at this point in the history
* Add OpenGov to Darwinia

* Add missing features
  • Loading branch information
aurexav authored Jan 3, 2024
1 parent 124a6ca commit 453b195
Show file tree
Hide file tree
Showing 35 changed files with 972 additions and 1,543 deletions.
12 changes: 8 additions & 4 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,7 @@ pallet-balances = { git = "https://github.com/parityt
pallet-collective = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-conviction-voting = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-democracy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-elections-phragmen = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-identity = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-membership = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
pallet-referenda = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.1.0", default-features = false }
Expand Down
4 changes: 0 additions & 4 deletions node/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,6 @@ pub fn genesis_config() -> ChainSpec {
democracy: Default::default(),
council: Default::default(),
technical_committee: Default::default(),
phragmen_election: Default::default(),
technical_membership: Default::default(),
treasury: Default::default(),

// XCM stuff.
Expand Down Expand Up @@ -332,8 +330,6 @@ fn testnet_genesis(
democracy: Default::default(),
council: Default::default(),
technical_committee: Default::default(),
phragmen_election: Default::default(),
technical_membership: Default::default(),
treasury: Default::default(),

// XCM stuff.
Expand Down
4 changes: 0 additions & 4 deletions node/src/chain_spec/pangoro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ pub fn genesis_config() -> ChainSpec {
democracy: Default::default(),
council: Default::default(),
technical_committee: Default::default(),
phragmen_election: Default::default(),
technical_membership: Default::default(),
treasury: Default::default(),

// Utility stuff.
Expand Down Expand Up @@ -328,8 +326,6 @@ fn testnet_genesis(
democracy: Default::default(),
council: Default::default(),
technical_committee: Default::default(),
phragmen_election: Default::default(),
technical_membership: Default::default(),
treasury: Default::default(),

// Utility stuff.
Expand Down
18 changes: 9 additions & 9 deletions runtime/crab/src/pallets/governance/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 5]
// Amount that must be placed on deposit before a decision can be made.
decision_deposit: DARWINIA_PROPOSAL_REQUIREMENT,
// Amount of time this must be submitted for before a decision can be made.
prepare_period: DAYS,
prepare_period: 2 * DAYS,
// Amount of time that a decision may take to be approved prior to cancellation.
decision_period: 7 * DAYS,
decision_period: 14 * DAYS,
// Amount of time that the approval criteria must hold before it can be approved.
confirm_period: 2 * DAYS,
confirm_period: 3 * DAYS,
// Minimum amount of time that an approved proposal must be in the dispatch queue.
min_enactment_period: DAYS,
// Minimum aye votes as percentage of overall conviction-weighted votes needed for
Expand All @@ -61,7 +61,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 5]
max_deciding: 100,
decision_deposit: DARWINIA_PROPOSAL_REQUIREMENT,
prepare_period: 10 * MINUTES,
decision_period: 7 * DAYS,
decision_period: 14 * DAYS,
confirm_period: 10 * MINUTES,
min_enactment_period: 30 * MINUTES,
min_approval: pallet_referenda::Curve::make_reciprocal(
Expand All @@ -86,9 +86,9 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 5]
name: "general_admin",
max_deciding: 10,
decision_deposit: DARWINIA_PROPOSAL_REQUIREMENT,
prepare_period: DAYS,
decision_period: 7 * DAYS,
confirm_period: 2 * DAYS,
prepare_period: 2 * DAYS,
decision_period: 14 * DAYS,
confirm_period: 3 * DAYS,
min_enactment_period: DAYS,
min_approval: pallet_referenda::Curve::make_reciprocal(
3,
Expand All @@ -115,7 +115,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 5]
max_deciding: 20,
decision_deposit: DARWINIA_PROPOSAL_REQUIREMENT,
prepare_period: HOURS,
decision_period: 7 * DAYS,
decision_period: 14 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 10 * MINUTES,
min_approval: pallet_referenda::Curve::make_reciprocal(
Expand All @@ -141,7 +141,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 5]
max_deciding: 100,
decision_deposit: DARWINIA_PROPOSAL_REQUIREMENT,
prepare_period: HOURS,
decision_period: 7 * DAYS,
decision_period: 14 * DAYS,
confirm_period: 3 * HOURS,
min_enactment_period: 10 * MINUTES,
min_approval: pallet_referenda::Curve::make_reciprocal(
Expand Down
22 changes: 14 additions & 8 deletions runtime/darwinia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ codec = { workspace = true, package = "parity-scale-codec" }
log = { workspace = true }
scale-info = { workspace = true }
static_assertions = { workspace = true }
strum = { workspace = true, features = ["derive"] }
# crates.io optional
array-bytes = { workspace = true, optional = true }

Expand Down Expand Up @@ -102,12 +103,12 @@ pallet-aura = { workspace = true }
pallet-authorship = { workspace = true }
pallet-balances = { workspace = true }
pallet-collective = { workspace = true }
pallet-conviction-voting = { workspace = true }
pallet-democracy = { workspace = true }
pallet-elections-phragmen = { workspace = true }
pallet-identity = { workspace = true }
pallet-membership = { workspace = true }
pallet-preimage = { workspace = true }
pallet-proxy = { workspace = true }
pallet-referenda = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-session = { workspace = true }
pallet-timestamp = { workspace = true }
Expand All @@ -116,6 +117,7 @@ pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
pallet-utility = { workspace = true }
pallet-vesting = { workspace = true }
pallet-whitelist = { workspace = true }
sp-api = { workspace = true }
sp-block-builder = { workspace = true }
sp-consensus-aura = { workspace = true }
Expand Down Expand Up @@ -151,6 +153,7 @@ std = [
"codec/std",
"log/std",
"scale-info/std",
"strum/std",

# cumulus
"cumulus-pallet-aura-ext/std",
Expand Down Expand Up @@ -235,12 +238,12 @@ std = [
"pallet-authorship/std",
"pallet-balances/std",
"pallet-collective/std",
"pallet-conviction-voting/std",
"pallet-democracy/std",
"pallet-elections-phragmen/std",
"pallet-identity/std",
"pallet-membership/std",
"pallet-preimage/std",
"pallet-proxy/std",
"pallet-referenda/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-timestamp/std",
Expand All @@ -249,6 +252,7 @@ std = [
"pallet-treasury/std",
"pallet-utility/std",
"pallet-vesting/std",
"pallet-whitelist/std",
"sp-api/std",
"sp-block-builder/std",
"sp-consensus-aura/std",
Expand Down Expand Up @@ -335,17 +339,18 @@ runtime-benchmarks = [
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-conviction-voting/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
"pallet-elections-phragmen/runtime-benchmarks",
"pallet-identity/runtime-benchmarks",
"pallet-membership/runtime-benchmarks",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-whitelist/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
# substrate optional
"frame-benchmarking/runtime-benchmarks",
Expand Down Expand Up @@ -403,19 +408,20 @@ try-runtime = [
"pallet-authorship/try-runtime",
"pallet-balances/try-runtime",
"pallet-collective/try-runtime",
"pallet-conviction-voting/try-runtime",
"pallet-democracy/try-runtime",
"pallet-elections-phragmen/try-runtime",
"pallet-identity/try-runtime",
"pallet-membership/try-runtime",
"pallet-preimage/try-runtime",
"pallet-proxy/try-runtime",
"pallet-referenda/try-runtime",
"pallet-scheduler/try-runtime",
"pallet-session/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-vesting/try-runtime",
"pallet-whitelist/try-runtime",
"sp-runtime/try-runtime",
# substrate optional
"frame-try-runtime/try-runtime",
Expand Down
12 changes: 7 additions & 5 deletions runtime/darwinia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,17 @@ frame_support::construct_runtime! {
EcdsaAuthority: darwinia_ecdsa_authority = 17,

// Governance stuff.
Democracy: pallet_democracy = 18,
// PhragmenElection: pallet_elections_phragmen = 21,
// TechnicalMembership: pallet_membership::<Instance1> = 22,
Council: pallet_collective::<Instance1> = 19,
TechnicalCommittee: pallet_collective::<Instance2> = 20,
PhragmenElection: pallet_elections_phragmen = 21,
TechnicalMembership: pallet_membership::<Instance1> = 22,
Treasury: pallet_treasury = 23,
// Tips: pallet_tips = 24,
Democracy: pallet_democracy = 18,
ConvictionVoting: pallet_conviction_voting = 48,
Referenda: pallet_referenda = 49,
Origins: custom_origins = 50,
Whitelist: pallet_whitelist = 51,

// Utility stuff.
// Sudo: pallet_sudo = 25,
Expand Down Expand Up @@ -194,9 +198,7 @@ frame_benchmarking::define_benchmarks! {
[pallet_collective, Council]
[pallet_collective, TechnicalCommittee]
[pallet_democracy, Democracy]
[pallet_elections_phragmen, PhragmenElection]
[pallet_identity, Identity]
[pallet_membership, TechnicalMembership]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
[pallet_scheduler, Scheduler]
Expand Down
12 changes: 2 additions & 10 deletions runtime/darwinia/src/pallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,8 @@ mod message_gadget;
mod ecdsa_authority;

// Governance stuff.
mod democracy;

mod collective;
pub use collective::*;

mod elections_phragmen;

mod membership;

mod treasury;
mod governance;
pub use governance::*;

// Utility stuff.
mod utility;
Expand Down
58 changes: 0 additions & 58 deletions runtime/darwinia/src/pallets/collective.rs

This file was deleted.

Loading

0 comments on commit 453b195

Please sign in to comment.