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

integrate openGov #2635

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ async-trait = { version = "0.1.71" }
coins-bip32 = { version = "0.7.0" }
coins-bip39 = { version = "0.7.0" }
k256 = { version = "0.11.5", default-features = false }
strum = { version = "0.24", default-features = false, features = [ "derive" ] }
strum_macros = { version = "0.24" }
lazy_static = { version = "1.4.0" }

# Dependencies are split into 2 groups: wasm and client.
# - "wasm" dependencies requires to be no_std compatible, which often requires
Expand Down Expand Up @@ -276,6 +279,9 @@ pallet-treasury = { version = "24.0.0", default-features = false }
pallet-utility = { version = "25.0.0", default-features = false }
pallet-vesting = { version = "25.0.0", default-features = false }
pallet-xcm = { version = "4.0.0", default-features = false }
pallet-conviction-voting = { version = "25.0.0", default-features = false }
pallet-referenda = { version = "25.0.0", default-features = false }
pallet-whitelist = { version = "24.0.0", default-features = false }
parachain-info = { package = "staging-parachain-info", version = "0.4.0", default-features = false }
polkadot-core-primitives = { version = "4.0.0", default-features = false }
polkadot-parachain-primitives = { version = "3.0.0", default-features = false }
Expand Down
16 changes: 16 additions & 0 deletions runtime/acala/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ scale-info = { workspace = true }
serde_json = { workspace = true, features = ["alloc"] }
hex = { workspace = true }
hex-literal = { workspace = true }
strum = { workspace = true }
strum_macros = { workspace = true }
lazy_static = { workspace = true }

# substrate
frame-executive = { workspace = true }
Expand All @@ -39,6 +42,9 @@ pallet-transaction-payment-rpc-runtime-api = { workspace = true }
pallet-treasury = { workspace = true }
pallet-utility = { workspace = true }
pallet-preimage = { workspace = true }
pallet-conviction-voting = { workspace = true }
pallet-referenda = { workspace = true }
pallet-whitelist = { workspace = true }
sp-api = { workspace = true }
sp-application-crypto = { workspace = true }
sp-block-builder = { workspace = true }
Expand Down Expand Up @@ -150,6 +156,7 @@ std = [
"hex/std",
"scale-info/std",
"serde_json/std",
"strum/std",

"frame-benchmarking/std",
"frame-executive/std",
Expand Down Expand Up @@ -193,6 +200,9 @@ std = [
"sp-transaction-pool/std",
"sp-version/std",
"substrate-wasm-builder",
"pallet-conviction-voting/std",
"pallet-referenda/std",
"pallet-whitelist/std",

"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
Expand Down Expand Up @@ -289,6 +299,9 @@ runtime-benchmarks = [
"pallet-utility/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"pallet-conviction-voting/runtime-benchmarks",
"pallet-referenda/runtime-benchmarks",
"pallet-whitelist/runtime-benchmarks",

"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
Expand Down Expand Up @@ -351,6 +364,9 @@ try-runtime = [
"pallet-treasury/try-runtime",
"pallet-utility/try-runtime",
"pallet-bags-list/try-runtime",
"pallet-conviction-voting/try-runtime",
"pallet-referenda/try-runtime",
"pallet-whitelist/try-runtime",

"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
Expand Down
144 changes: 144 additions & 0 deletions runtime/acala/src/governance/councils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
// This file is part of Acala.

// Copyright (C) 2020-2023 Acala Foundation.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

//! Councils for Gov1 and Gov2

use super::*;

parameter_types! {
pub const GeneralCouncilMotionDuration: BlockNumber = 3 * DAYS;
pub const CouncilDefaultMaxProposals: u32 = 20;
pub const CouncilDefaultMaxMembers: u32 = 30;
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block;
}

impl pallet_collective::Config<GeneralCouncilInstance> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = GeneralCouncilMotionDuration;
type MaxProposals = CouncilDefaultMaxProposals;
type MaxMembers = CouncilDefaultMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<AccountId>;
type WeightInfo = ();
type MaxProposalWeight = MaxProposalWeight;
}

impl pallet_membership::Config<GeneralCouncilMembershipInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrThreeFourthsGeneralCouncil;
type RemoveOrigin = EnsureRootOrThreeFourthsGeneralCouncil;
type SwapOrigin = EnsureRootOrThreeFourthsGeneralCouncil;
type ResetOrigin = EnsureRootOrThreeFourthsGeneralCouncil;
type PrimeOrigin = EnsureRootOrThreeFourthsGeneralCouncil;
type MembershipInitialized = GeneralCouncil;
type MembershipChanged = GeneralCouncil;
type MaxMembers = CouncilDefaultMaxMembers;
type WeightInfo = ();
}

parameter_types! {
pub const FinancialCouncilMotionDuration: BlockNumber = 3 * DAYS;
}

impl pallet_collective::Config<FinancialCouncilInstance> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = FinancialCouncilMotionDuration;
type MaxProposals = CouncilDefaultMaxProposals;
type MaxMembers = CouncilDefaultMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<AccountId>;
type WeightInfo = ();
type MaxProposalWeight = MaxProposalWeight;
}

impl pallet_membership::Config<FinancialCouncilMembershipInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type MembershipInitialized = FinancialCouncil;
type MembershipChanged = FinancialCouncil;
type MaxMembers = CouncilDefaultMaxMembers;
type WeightInfo = ();
}

parameter_types! {
pub const HomaCouncilMotionDuration: BlockNumber = 3 * DAYS;
}

impl pallet_collective::Config<HomaCouncilInstance> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = HomaCouncilMotionDuration;
type MaxProposals = CouncilDefaultMaxProposals;
type MaxMembers = CouncilDefaultMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<AccountId>;
type WeightInfo = ();
type MaxProposalWeight = MaxProposalWeight;
}

impl pallet_membership::Config<HomaCouncilMembershipInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type MembershipInitialized = HomaCouncil;
type MembershipChanged = HomaCouncil;
type MaxMembers = CouncilDefaultMaxMembers;
type WeightInfo = ();
}

parameter_types! {
pub const TechnicalCommitteeMotionDuration: BlockNumber = 3 * DAYS;
}

impl pallet_collective::Config<TechnicalCommitteeInstance> for Runtime {
type RuntimeOrigin = RuntimeOrigin;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type MotionDuration = TechnicalCommitteeMotionDuration;
type MaxProposals = CouncilDefaultMaxProposals;
type MaxMembers = CouncilDefaultMaxMembers;
type DefaultVote = pallet_collective::PrimeDefaultVote;
type SetMembersOrigin = EnsureRoot<AccountId>;
type WeightInfo = ();
type MaxProposalWeight = MaxProposalWeight;
}

impl pallet_membership::Config<TechnicalCommitteeMembershipInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type AddOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type RemoveOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type SwapOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type ResetOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type PrimeOrigin = EnsureRootOrTwoThirdsGeneralCouncil;
type MembershipInitialized = TechnicalCommittee;
type MembershipChanged = TechnicalCommittee;
type MaxMembers = CouncilDefaultMaxMembers;
type WeightInfo = ();
}
Loading