From 842fb988f9825551777114ffafbaa46caef43045 Mon Sep 17 00:00:00 2001 From: Xavier Lau Date: Fri, 5 Jan 2024 11:40:06 +0800 Subject: [PATCH] Remove governance v1 --- node/src/chain_spec/crab.rs | 4 -- runtime/crab/src/lib.rs | 4 +- runtime/crab/src/pallets/governance.rs | 20 +------ runtime/crab/src/pallets/governance/v1.rs | 55 ------------------- runtime/crab/src/pallets/identity.rs | 4 +- runtime/crab/src/pallets/proxy.rs | 3 +- runtime/crab/src/pallets/scheduler.rs | 10 +++- runtime/darwinia/src/pallets/governance.rs | 2 +- runtime/pangolin/src/lib.rs | 4 +- runtime/pangolin/src/pallets/governance.rs | 18 +----- runtime/pangolin/src/pallets/governance/v1.rs | 52 ------------------ runtime/pangolin/src/pallets/identity.rs | 4 +- runtime/pangolin/src/pallets/proxy.rs | 1 - runtime/pangolin/src/pallets/scheduler.rs | 10 +++- 14 files changed, 31 insertions(+), 160 deletions(-) delete mode 100644 runtime/crab/src/pallets/governance/v1.rs delete mode 100644 runtime/pangolin/src/pallets/governance/v1.rs diff --git a/node/src/chain_spec/crab.rs b/node/src/chain_spec/crab.rs index e9c78b2ae..9391fa132 100644 --- a/node/src/chain_spec/crab.rs +++ b/node/src/chain_spec/crab.rs @@ -222,8 +222,6 @@ pub fn genesis_config() -> ChainSpec { aura_ext: Default::default(), // Governance stuff. - democracy: Default::default(), - council: Default::default(), technical_committee: Default::default(), treasury: Default::default(), @@ -327,8 +325,6 @@ fn testnet_genesis( aura_ext: Default::default(), // Governance stuff. - democracy: Default::default(), - council: Default::default(), technical_committee: Default::default(), treasury: Default::default(), diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index 927d37438..0269bcc20 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -135,11 +135,11 @@ frame_support::construct_runtime! { // Governance stuff. // PhragmenElection: pallet_elections_phragmen = 21, // TechnicalMembership: pallet_membership:: = 22, - Council: pallet_collective:: = 19, + // Council: pallet_collective:: = 19, TechnicalCommittee: pallet_collective:: = 20, Treasury: pallet_treasury = 23, // Tips: pallet_tips = 24, - Democracy: pallet_democracy = 18, + // Democracy: pallet_democracy = 18, ConvictionVoting: pallet_conviction_voting = 44, Referenda: pallet_referenda = 45, Origins: custom_origins = 46, diff --git a/runtime/crab/src/pallets/governance.rs b/runtime/crab/src/pallets/governance.rs index 445e2d297..3d885472c 100644 --- a/runtime/crab/src/pallets/governance.rs +++ b/runtime/crab/src/pallets/governance.rs @@ -23,9 +23,7 @@ pub use origin::{custom_origins, GeneralAdmin}; mod track; use track::*; -mod v1; - -pub use pallet_collective::{Instance1 as CouncilCollective, Instance2 as TechnicalCollective}; +pub use pallet_collective::Instance2 as TechnicalCollective; pub(super) use crate::*; @@ -40,18 +38,6 @@ frame_support::parameter_types! { pub MaxProposalWeight: frame_support::weights::Weight = sp_runtime::Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; } -impl pallet_collective::Config for Runtime { - type DefaultVote = pallet_collective::PrimeDefaultVote; - type MaxMembers = ConstU32; - type MaxProposalWeight = MaxProposalWeight; - type MaxProposals = ConstU32<100>; - type MotionDuration = ConstU32<{ 3 * DAYS }>; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type SetMembersOrigin = RootOr; - type WeightInfo = weights::pallet_collective_council::WeightInfo; -} impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; type MaxMembers = ConstU32; @@ -125,10 +111,10 @@ impl pallet_treasury::Config for Runtime { type ProposalBond = ProposalBond; type ProposalBondMaximum = (); type ProposalBondMinimum = ConstU128; - type RejectOrigin = RootOrAll; + type RejectOrigin = RootOr; type RuntimeEvent = RuntimeEvent; type SpendFunds = (); type SpendOrigin = frame_support::traits::NeverEnsureOrigin; - type SpendPeriod = ConstU32<{ 7 * DAYS }>; + type SpendPeriod = ConstU32<{ 14 * DAYS }>; type WeightInfo = weights::pallet_treasury::WeightInfo; } diff --git a/runtime/crab/src/pallets/governance/v1.rs b/runtime/crab/src/pallets/governance/v1.rs deleted file mode 100644 index 78f83972c..000000000 --- a/runtime/crab/src/pallets/governance/v1.rs +++ /dev/null @@ -1,55 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia 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. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use super::*; - -const ENACTMENT_PERIOD: u32 = 28 * DAYS; - -impl pallet_democracy::Config for Runtime { - type BlacklistOrigin = RootOrAtLeastTwoThird; - type CancelProposalOrigin = RootOrAtLeastTwoThird; - type CancellationOrigin = RootOrAtLeastTwoThird; - type CooloffPeriod = ConstU32<{ 7 * DAYS }>; - type Currency = Balances; - type EnactmentPeriod = ConstU32; - // There are no plans to use this yet. - type ExternalDefaultOrigin = Root; - type ExternalMajorityOrigin = RootOrAtLeastHalf; - type ExternalOrigin = RootOrAtLeastHalf; - type FastTrackOrigin = RootOrAtLeastTwoThird; - type FastTrackVotingPeriod = ConstU32<{ 3 * HOURS }>; - type InstantAllowed = ConstBool; - type InstantOrigin = RootOrAll; - type LaunchPeriod = ConstU32<{ 28 * DAYS }>; - type MaxBlacklisted = ConstU32<100>; - type MaxDeposits = ConstU32<100>; - type MaxProposals = ConstU32<100>; - type MaxVotes = ConstU32<100>; - type MinimumDeposit = ConstU128; - type PalletsOrigin = OriginCaller; - type Preimages = Preimage; - type RuntimeEvent = RuntimeEvent; - type Scheduler = Scheduler; - type Slash = Treasury; - type SubmitOrigin = frame_system::EnsureSigned; - type VetoOrigin = pallet_collective::EnsureMember; - type VoteLockingPeriod = ConstU32; - type VotingPeriod = ConstU32<{ 28 * DAYS }>; - type WeightInfo = weights::pallet_democracy::WeightInfo; -} diff --git a/runtime/crab/src/pallets/identity.rs b/runtime/crab/src/pallets/identity.rs index 1fcedcd89..b204eb9a9 100644 --- a/runtime/crab/src/pallets/identity.rs +++ b/runtime/crab/src/pallets/identity.rs @@ -26,11 +26,11 @@ impl pallet_identity::Config for Runtime { type Currency = Balances; // 66 bytes on-chain. type FieldDeposit = ConstU128<{ darwinia_deposit(0, 66) }>; - type ForceOrigin = RootOrMoreThanHalf; + type ForceOrigin = RootOr; type MaxAdditionalFields = ConstU32<100>; type MaxRegistrars = ConstU32<20>; type MaxSubAccounts = ConstU32<100>; - type RegistrarOrigin = RootOrMoreThanHalf; + type RegistrarOrigin = RootOr; type RuntimeEvent = RuntimeEvent; type Slashed = Treasury; // 53 bytes on-chain. diff --git a/runtime/crab/src/pallets/proxy.rs b/runtime/crab/src/pallets/proxy.rs index 550fca8eb..91d9d2231 100644 --- a/runtime/crab/src/pallets/proxy.rs +++ b/runtime/crab/src/pallets/proxy.rs @@ -75,8 +75,7 @@ impl frame_support::traits::InstanceFilter for ProxyType { ), ProxyType::Governance => matches!( c, - RuntimeCall::Democracy(..) - | RuntimeCall::Council(..) + | RuntimeCall::Referenda(..) | RuntimeCall::TechnicalCommittee(..) | RuntimeCall::Treasury(..) ), diff --git a/runtime/crab/src/pallets/scheduler.rs b/runtime/crab/src/pallets/scheduler.rs index 868dfd6d6..c6147a7d0 100644 --- a/runtime/crab/src/pallets/scheduler.rs +++ b/runtime/crab/src/pallets/scheduler.rs @@ -33,8 +33,14 @@ impl frame_support::traits::PrivilegeCmp for OriginPrivilegeCmp { Some(core::cmp::Ordering::Greater), // Check which one has more yes votes. ( - OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), - OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + OriginCaller::TechnicalCommittee(pallet_collective::RawOrigin::Members( + l_yes_votes, + l_count, + )), + OriginCaller::TechnicalCommittee(pallet_collective::RawOrigin::Members( + r_yes_votes, + r_count, + )), ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), // For every other origin we don't care, as they are not used for `ScheduleOrigin`. _ => None, diff --git a/runtime/darwinia/src/pallets/governance.rs b/runtime/darwinia/src/pallets/governance.rs index b02652ec9..1e91ac5b6 100644 --- a/runtime/darwinia/src/pallets/governance.rs +++ b/runtime/darwinia/src/pallets/governance.rs @@ -132,6 +132,6 @@ impl pallet_treasury::Config for Runtime { type RuntimeEvent = RuntimeEvent; type SpendFunds = (); type SpendOrigin = frame_support::traits::NeverEnsureOrigin; - type SpendPeriod = ConstU32<{ 7 * DAYS }>; + type SpendPeriod = ConstU32<{ 28 * DAYS }>; type WeightInfo = weights::pallet_treasury::WeightInfo; } diff --git a/runtime/pangolin/src/lib.rs b/runtime/pangolin/src/lib.rs index 6d2ad2aa2..684b93e41 100644 --- a/runtime/pangolin/src/lib.rs +++ b/runtime/pangolin/src/lib.rs @@ -136,11 +136,11 @@ frame_support::construct_runtime! { // Governance stuff. // PhragmenElection: pallet_elections_phragmen = 21, // TechnicalMembership: pallet_membership:: = 22, - Council: pallet_collective:: = 19, + // Council: pallet_collective:: = 19, TechnicalCommittee: pallet_collective:: = 20, Treasury: pallet_treasury = 23, // Tips: pallet_tips = 24, - Democracy: pallet_democracy = 18, + // Democracy: pallet_democracy = 18, ConvictionVoting: pallet_conviction_voting = 48, Referenda: pallet_referenda = 49, Origins: custom_origins = 50, diff --git a/runtime/pangolin/src/pallets/governance.rs b/runtime/pangolin/src/pallets/governance.rs index d4eda075b..d679bbcfd 100644 --- a/runtime/pangolin/src/pallets/governance.rs +++ b/runtime/pangolin/src/pallets/governance.rs @@ -23,9 +23,7 @@ pub use origin::{custom_origins, GeneralAdmin}; mod track; use track::*; -mod v1; - -pub use pallet_collective::{Instance1 as CouncilCollective, Instance2 as TechnicalCollective}; +pub use pallet_collective::Instance2 as TechnicalCollective; pub(super) use crate::*; @@ -46,18 +44,6 @@ frame_support::parameter_types! { pub MaxProposalWeight: frame_support::weights::Weight = sp_runtime::Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block; } -impl pallet_collective::Config for Runtime { - type DefaultVote = pallet_collective::PrimeDefaultVote; - type MaxMembers = ConstU32; - type MaxProposalWeight = MaxProposalWeight; - type MaxProposals = ConstU32<100>; - type MotionDuration = Time1; - type Proposal = RuntimeCall; - type RuntimeEvent = RuntimeEvent; - type RuntimeOrigin = RuntimeOrigin; - type SetMembersOrigin = RootOr; - type WeightInfo = weights::pallet_collective_council::WeightInfo; -} impl pallet_collective::Config for Runtime { type DefaultVote = pallet_collective::PrimeDefaultVote; type MaxMembers = ConstU32; @@ -131,7 +117,7 @@ impl pallet_treasury::Config for Runtime { type ProposalBond = ProposalBond; type ProposalBondMaximum = (); type ProposalBondMinimum = ConstU128; - type RejectOrigin = RootOrAll; + type RejectOrigin = RootOr; type RuntimeEvent = RuntimeEvent; type SpendFunds = (); type SpendOrigin = frame_support::traits::NeverEnsureOrigin; diff --git a/runtime/pangolin/src/pallets/governance/v1.rs b/runtime/pangolin/src/pallets/governance/v1.rs deleted file mode 100644 index 478e5b4ed..000000000 --- a/runtime/pangolin/src/pallets/governance/v1.rs +++ /dev/null @@ -1,52 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) 2018-2023 Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia 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. -// -// Darwinia 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 Darwinia. If not, see . - -// darwinia -use super::*; - -impl pallet_democracy::Config for Runtime { - type BlacklistOrigin = Root; - type CancelProposalOrigin = RootOrAtLeastTwoThird; - type CancellationOrigin = RootOrAtLeastTwoThird; - type CooloffPeriod = Time1; - type Currency = Balances; - type EnactmentPeriod = Time1; - type ExternalDefaultOrigin = RootOrAll; - type ExternalMajorityOrigin = RootOrAtLeastHalf; - type ExternalOrigin = RootOrAtLeastHalf; - type FastTrackOrigin = RootOrAtLeastTwoThird; - type FastTrackVotingPeriod = Time1; - type InstantAllowed = ConstBool; - type InstantOrigin = RootOrAll; - type LaunchPeriod = Time1; - type MaxBlacklisted = ConstU32<100>; - type MaxDeposits = ConstU32<100>; - type MaxProposals = ConstU32<100>; - type MaxVotes = ConstU32<100>; - type MinimumDeposit = ConstU128; - type PalletsOrigin = OriginCaller; - type Preimages = Preimage; - type RuntimeEvent = RuntimeEvent; - type Scheduler = Scheduler; - type Slash = Treasury; - type SubmitOrigin = frame_system::EnsureSigned; - type VetoOrigin = pallet_collective::EnsureMember; - type VoteLockingPeriod = Time1; - type VotingPeriod = Time1; - type WeightInfo = weights::pallet_democracy::WeightInfo; -} diff --git a/runtime/pangolin/src/pallets/identity.rs b/runtime/pangolin/src/pallets/identity.rs index 1fcedcd89..b204eb9a9 100644 --- a/runtime/pangolin/src/pallets/identity.rs +++ b/runtime/pangolin/src/pallets/identity.rs @@ -26,11 +26,11 @@ impl pallet_identity::Config for Runtime { type Currency = Balances; // 66 bytes on-chain. type FieldDeposit = ConstU128<{ darwinia_deposit(0, 66) }>; - type ForceOrigin = RootOrMoreThanHalf; + type ForceOrigin = RootOr; type MaxAdditionalFields = ConstU32<100>; type MaxRegistrars = ConstU32<20>; type MaxSubAccounts = ConstU32<100>; - type RegistrarOrigin = RootOrMoreThanHalf; + type RegistrarOrigin = RootOr; type RuntimeEvent = RuntimeEvent; type Slashed = Treasury; // 53 bytes on-chain. diff --git a/runtime/pangolin/src/pallets/proxy.rs b/runtime/pangolin/src/pallets/proxy.rs index 6a79348bb..ad4dbd693 100644 --- a/runtime/pangolin/src/pallets/proxy.rs +++ b/runtime/pangolin/src/pallets/proxy.rs @@ -67,7 +67,6 @@ impl frame_support::traits::InstanceFilter for ProxyType { c, RuntimeCall::Referenda(..) | RuntimeCall::ConvictionVoting(..) - | RuntimeCall::Council(..) | RuntimeCall::TechnicalCommittee(..) | RuntimeCall::Treasury(..) ), diff --git a/runtime/pangolin/src/pallets/scheduler.rs b/runtime/pangolin/src/pallets/scheduler.rs index 551ec257b..fb950bd12 100644 --- a/runtime/pangolin/src/pallets/scheduler.rs +++ b/runtime/pangolin/src/pallets/scheduler.rs @@ -33,8 +33,14 @@ impl frame_support::traits::PrivilegeCmp for OriginPrivilegeCmp { Some(core::cmp::Ordering::Greater), // Check which one has more yes votes. ( - OriginCaller::Council(pallet_collective::RawOrigin::Members(l_yes_votes, l_count)), - OriginCaller::Council(pallet_collective::RawOrigin::Members(r_yes_votes, r_count)), + OriginCaller::TechnicalCommittee(pallet_collective::RawOrigin::Members( + l_yes_votes, + l_count, + )), + OriginCaller::TechnicalCommittee(pallet_collective::RawOrigin::Members( + r_yes_votes, + r_count, + )), ) => Some((l_yes_votes * r_count).cmp(&(r_yes_votes * l_count))), // For every other origin we don't care, as they are not used for `ScheduleOrigin`. _ => None,