Skip to content

Commit

Permalink
Remove governance v1
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav committed Jan 5, 2024
1 parent 978dda2 commit 842fb98
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 160 deletions.
4 changes: 0 additions & 4 deletions node/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),

Expand Down Expand Up @@ -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(),

Expand Down
4 changes: 2 additions & 2 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ frame_support::construct_runtime! {
// Governance stuff.
// PhragmenElection: pallet_elections_phragmen = 21,
// TechnicalMembership: pallet_membership::<Instance1> = 22,
Council: pallet_collective::<Instance1> = 19,
// Council: pallet_collective::<Instance1> = 19,
TechnicalCommittee: pallet_collective::<Instance2> = 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,
Expand Down
20 changes: 3 additions & 17 deletions runtime/crab/src/pallets/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand All @@ -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<CouncilCollective> for Runtime {
type DefaultVote = pallet_collective::PrimeDefaultVote;
type MaxMembers = ConstU32<COLLECTIVE_MAX_MEMBERS>;
type MaxProposalWeight = MaxProposalWeight;
type MaxProposals = ConstU32<100>;
type MotionDuration = ConstU32<{ 3 * DAYS }>;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type SetMembersOrigin = RootOr<GeneralAdmin>;
type WeightInfo = weights::pallet_collective_council::WeightInfo<Self>;
}
impl pallet_collective::Config<TechnicalCollective> for Runtime {
type DefaultVote = pallet_collective::PrimeDefaultVote;
type MaxMembers = ConstU32<COLLECTIVE_MAX_MEMBERS>;
Expand Down Expand Up @@ -125,10 +111,10 @@ impl pallet_treasury::Config for Runtime {
type ProposalBond = ProposalBond;
type ProposalBondMaximum = ();
type ProposalBondMinimum = ConstU128<DARWINIA_PROPOSAL_REQUIREMENT>;
type RejectOrigin = RootOrAll<CouncilCollective>;
type RejectOrigin = RootOr<GeneralAdmin>;
type RuntimeEvent = RuntimeEvent;
type SpendFunds = ();
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
type SpendPeriod = ConstU32<{ 7 * DAYS }>;
type SpendPeriod = ConstU32<{ 14 * DAYS }>;
type WeightInfo = weights::pallet_treasury::WeightInfo<Self>;
}
55 changes: 0 additions & 55 deletions runtime/crab/src/pallets/governance/v1.rs

This file was deleted.

4 changes: 2 additions & 2 deletions runtime/crab/src/pallets/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CouncilCollective>;
type ForceOrigin = RootOr<GeneralAdmin>;
type MaxAdditionalFields = ConstU32<100>;
type MaxRegistrars = ConstU32<20>;
type MaxSubAccounts = ConstU32<100>;
type RegistrarOrigin = RootOrMoreThanHalf<CouncilCollective>;
type RegistrarOrigin = RootOr<GeneralAdmin>;
type RuntimeEvent = RuntimeEvent;
type Slashed = Treasury;
// 53 bytes on-chain.
Expand Down
3 changes: 1 addition & 2 deletions runtime/crab/src/pallets/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
),
ProxyType::Governance => matches!(
c,
RuntimeCall::Democracy(..)
| RuntimeCall::Council(..)
| RuntimeCall::Referenda(..)
| RuntimeCall::TechnicalCommittee(..)
| RuntimeCall::Treasury(..)
),
Expand Down
10 changes: 8 additions & 2 deletions runtime/crab/src/pallets/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ impl frame_support::traits::PrivilegeCmp<OriginCaller> 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,
Expand Down
2 changes: 1 addition & 1 deletion runtime/darwinia/src/pallets/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,6 @@ impl pallet_treasury::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type SpendFunds = ();
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
type SpendPeriod = ConstU32<{ 7 * DAYS }>;
type SpendPeriod = ConstU32<{ 28 * DAYS }>;
type WeightInfo = weights::pallet_treasury::WeightInfo<Self>;
}
4 changes: 2 additions & 2 deletions runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ frame_support::construct_runtime! {
// Governance stuff.
// PhragmenElection: pallet_elections_phragmen = 21,
// TechnicalMembership: pallet_membership::<Instance1> = 22,
Council: pallet_collective::<Instance1> = 19,
// Council: pallet_collective::<Instance1> = 19,
TechnicalCommittee: pallet_collective::<Instance2> = 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,
Expand Down
18 changes: 2 additions & 16 deletions runtime/pangolin/src/pallets/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;

Expand All @@ -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<CouncilCollective> for Runtime {
type DefaultVote = pallet_collective::PrimeDefaultVote;
type MaxMembers = ConstU32<COLLECTIVE_MAX_MEMBERS>;
type MaxProposalWeight = MaxProposalWeight;
type MaxProposals = ConstU32<100>;
type MotionDuration = Time1;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type SetMembersOrigin = RootOr<GeneralAdmin>;
type WeightInfo = weights::pallet_collective_council::WeightInfo<Self>;
}
impl pallet_collective::Config<TechnicalCollective> for Runtime {
type DefaultVote = pallet_collective::PrimeDefaultVote;
type MaxMembers = ConstU32<COLLECTIVE_MAX_MEMBERS>;
Expand Down Expand Up @@ -131,7 +117,7 @@ impl pallet_treasury::Config for Runtime {
type ProposalBond = ProposalBond;
type ProposalBondMaximum = ();
type ProposalBondMinimum = ConstU128<DARWINIA_PROPOSAL_REQUIREMENT>;
type RejectOrigin = RootOrAll<CouncilCollective>;
type RejectOrigin = RootOr<GeneralAdmin>;
type RuntimeEvent = RuntimeEvent;
type SpendFunds = ();
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
Expand Down
52 changes: 0 additions & 52 deletions runtime/pangolin/src/pallets/governance/v1.rs

This file was deleted.

4 changes: 2 additions & 2 deletions runtime/pangolin/src/pallets/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CouncilCollective>;
type ForceOrigin = RootOr<GeneralAdmin>;
type MaxAdditionalFields = ConstU32<100>;
type MaxRegistrars = ConstU32<20>;
type MaxSubAccounts = ConstU32<100>;
type RegistrarOrigin = RootOrMoreThanHalf<CouncilCollective>;
type RegistrarOrigin = RootOr<GeneralAdmin>;
type RuntimeEvent = RuntimeEvent;
type Slashed = Treasury;
// 53 bytes on-chain.
Expand Down
1 change: 0 additions & 1 deletion runtime/pangolin/src/pallets/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ impl frame_support::traits::InstanceFilter<RuntimeCall> for ProxyType {
c,
RuntimeCall::Referenda(..)
| RuntimeCall::ConvictionVoting(..)
| RuntimeCall::Council(..)
| RuntimeCall::TechnicalCommittee(..)
| RuntimeCall::Treasury(..)
),
Expand Down
10 changes: 8 additions & 2 deletions runtime/pangolin/src/pallets/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ impl frame_support::traits::PrivilegeCmp<OriginCaller> 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,
Expand Down

0 comments on commit 842fb98

Please sign in to comment.