Skip to content

Commit

Permalink
Merge pull request #761 from freeverseio/feature/technical-committee
Browse files Browse the repository at this point in the history
Add Technical Commitee to Runtime
  • Loading branch information
asiniscalchi committed Sep 5, 2024
2 parents 56f83dc + 86796d3 commit 50e3dd4
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 40 deletions.
54 changes: 54 additions & 0 deletions runtime/laos/src/configs/collective.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
use crate::{weights, AccountId, BlockNumber, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin};
use frame_support::{pallet_prelude::Weight, parameter_types, traits::EitherOfDiverse};
use frame_system::EnsureRoot;
use laos_primitives::RuntimeBlockWeights;
#[cfg(not(feature = "fast-mode"))]
use parachains_common::DAYS;
#[cfg(feature = "fast-mode")]
use parachains_common::MINUTES;
use sp_runtime::Perbill;

#[cfg(feature = "fast-mode")]
pub const MOTION_DURATION: BlockNumber = 5 * MINUTES;
#[cfg(not(feature = "fast-mode"))]
pub const MOTION_DURATION: BlockNumber = 7 * DAYS;

parameter_types! {
pub const MotionDuration: BlockNumber = MOTION_DURATION;
pub const MaxProposals: u32 = 7;
pub const MaxMembers: u32 = 20;
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block;
}

pub type CouncilMajority =
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>;

pub type CouncilCollective = pallet_collective::Instance1;
impl pallet_collective::Config<CouncilCollective> for Runtime {
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
type MaxMembers = MaxMembers;
type MaxProposalWeight = MaxProposalWeight;
type MaxProposals = MaxProposals;
type MotionDuration = MotionDuration;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type SetMembersOrigin = EnsureRoot<AccountId>;
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
}

#[allow(dead_code)] // TODO remove me when integrating https://github.com/freeverseio/laos/pull/759
pub type TechnicalCommittee = pallet_collective::Instance2;
impl pallet_collective::Config<TechnicalCommittee> for Runtime {
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
type MaxMembers = MaxMembers;
type MaxProposalWeight = MaxProposalWeight;
type MaxProposals = MaxProposals;
type MotionDuration = MotionDuration;
type Proposal = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
// the root or a turnout of 50%+1 of the council can select the technical committee
type SetMembersOrigin = EitherOfDiverse<EnsureRoot<AccountId>, CouncilMajority>;
type WeightInfo = weights::pallet_collective::WeightInfo<Runtime>;
}
36 changes: 0 additions & 36 deletions runtime/laos/src/configs/collective_council.rs

This file was deleted.

2 changes: 1 addition & 1 deletion runtime/laos/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mod authorship;
mod balances;
mod base_fee;
mod benchmark;
mod collective_council;
mod collective;
mod cumulus_parachain_system;
mod cumulus_xcmp_queue;
mod election_phragmen;
Expand Down
4 changes: 1 addition & 3 deletions runtime/laos/src/configs/treasury.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::collective_council::CouncilCollective;
use super::collective::CouncilMajority;
use crate::{
currency::UNIT, weights, AccountId, Balance, Balances, BlockNumber, Permill, Runtime,
RuntimeEvent, Treasury,
Expand Down Expand Up @@ -34,8 +34,6 @@ parameter_types! {
pub TreasuryAccount: AccountId = Treasury::account_id();
}

type CouncilMajority =
pallet_collective::EnsureProportionMoreThan<AccountId, CouncilCollective, 1, 2>;
type ApproveOrigin = EitherOfDiverse<EnsureRoot<AccountId>, CouncilMajority>;
type RejectOrigin = EitherOfDiverse<EnsureRoot<AccountId>, CouncilMajority>;

Expand Down
1 change: 1 addition & 0 deletions runtime/laos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ construct_runtime!(
Treasury: pallet_treasury = 41,
Elections: pallet_elections_phragmen = 42,
Preimage: pallet_preimage = 43,
TechnicalCommittee: pallet_collective::<Instance2> = 44,

// Frontier
Ethereum: pallet_ethereum = 50,
Expand Down

0 comments on commit 50e3dd4

Please sign in to comment.