Skip to content

Commit

Permalink
Fix: Changes on council and tracks params
Browse files Browse the repository at this point in the history
  • Loading branch information
Anny0nn committed May 20, 2024
1 parent 20051ae commit d9cbf46
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
11 changes: 7 additions & 4 deletions tinkernet/runtime/src/governance/councils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ use super::*;
pub type TinkerCouncil = pallet_collective::Instance1;

parameter_types! {
// TODO: Check value of this parameter
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block;
pub MaxMotionDuration: u32 = 3 * DAYS ;
pub MaxProposals: u32 = 20;
pub MaxMembers: u32 = 5;

}

impl pallet_collective::Config<TinkerCouncil> for Runtime {
Expand All @@ -15,11 +18,11 @@ impl pallet_collective::Config<TinkerCouncil> for Runtime {
type Proposal = RuntimeCall;
/// The maximum amount of time (in blocks) council members to vote on motions.
/// Motions may end in fewer blocks if enough votes are cast to determine the result.
type MotionDuration = ConstU32<{ 3 * DAYS }>;
type MotionDuration = MaxMotionDuration;
/// The maximum number of proposals that can be open in council at once.
type MaxProposals = ConstU32<20>;
type MaxProposals = MaxProposals;
/// The maximum number of council members.
type MaxMembers = ConstU32<7>;
type MaxMembers = MaxMembers;
type DefaultVote = pallet_collective::MoreThanMajorityThenPrimeDefaultVote;
type WeightInfo = pallet_collective::weights::SubstrateWeight<Runtime>;
type SetMembersOrigin = EitherOf<CouncilApproveOrigin, CouncilAdmin>;
Expand Down
16 changes: 8 additions & 8 deletions tinkernet/runtime/src/governance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use super::*;
use frame_support::{parameter_types, traits::EitherOf};

use frame_system::EnsureRootWithSuccess;
use polkadot_runtime_common::prod_or_fast;

mod origins;
pub use origins::{
Expand All @@ -18,7 +17,7 @@ pub use tracks::TracksInfo;
mod councils;

parameter_types! {
pub const VoteLockingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1);
pub const VoteLockingPeriod: BlockNumber = 7 * DAYS;
}

impl pallet_conviction_voting::Config for Runtime {
Expand All @@ -34,24 +33,24 @@ impl pallet_conviction_voting::Config for Runtime {

parameter_types! {
pub const AlarmInterval: BlockNumber = 1;
pub const SubmissionDeposit: Balance = 1 * UNIT;
pub const SubmissionDeposit: Balance = UNIT;
pub const UndecidingTimeout: BlockNumber = 14 * DAYS;
}

parameter_types! {
pub const MaxBalance: Balance = Balance::max_value();
}

pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;
pub type RootOrGeneralManagement = EitherOf<EnsureRoot<AccountId>, GeneralManagement>;

pub type AllCouncil = pallet_collective::EnsureProportionAtLeast<AccountId, TinkerCouncil, 1, 1>;
pub type CouncilMoreThanApprove =
pallet_collective::EnsureProportionMoreThan<AccountId, TinkerCouncil, 3, 5>;
pub type ConcilHalf = pallet_collective::EnsureProportionAtLeast<AccountId, TinkerCouncil, 1, 2>;
pub type CouncilThreeFifths =
pallet_collective::EnsureProportionAtLeast<AccountId, TinkerCouncil, 3, 5>;

pub type TreasurySpender = EitherOf<EnsureRootWithSuccess<AccountId, MaxBalance>, Spender>;
pub type RootOrGeneralManagement = EitherOf<EnsureRoot<AccountId>, GeneralManagement>;
pub type CouncilApproveOrigin = EitherOf<EnsureRoot<AccountId>, CouncilThreeFifths>;

pub type CouncilRejectOrigin = EitherOf<EnsureRoot<AccountId>, ConcilHalf>;

impl pallet_custom_origins::Config for Runtime {}
Expand All @@ -72,7 +71,8 @@ impl pallet_referenda::Config for Runtime {
type Scheduler = Scheduler;
type Currency = Balances;
type SubmitOrigin = frame_system::EnsureSigned<AccountId>;
type CancelOrigin = EitherOf<EitherOf<EnsureRoot<AccountId>, ReferendumCanceller>, AllCouncil>;
type CancelOrigin =
EitherOf<EitherOf<EnsureRoot<AccountId>, ReferendumCanceller>, CouncilMoreThanApprove>;
type KillOrigin = EitherOf<EitherOf<EnsureRoot<AccountId>, ReferendumKiller>, AllCouncil>;
type Slash = Treasury;
type Votes = pallet_conviction_voting::VotesOf<Runtime>;
Expand Down
4 changes: 2 additions & 2 deletions tinkernet/runtime/src/governance/tracks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 8]
pallet_referenda::TrackInfo {
name: "general_management",
max_deciding: 10,
decision_deposit: 20 * GRAND,
decision_deposit: 10 * GRAND,
#[cfg(not(feature = "on-chain-release-build"))]
prepare_period: 4 * MINUTES,
#[cfg(feature = "on-chain-release-build")]
Expand All @@ -114,7 +114,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo<Balance, BlockNumber>); 8]
pallet_referenda::TrackInfo {
name: "council_admin",
max_deciding: 10,
decision_deposit: 5 * GRAND,
decision_deposit: 10 * GRAND,
#[cfg(not(feature = "on-chain-release-build"))]
prepare_period: 4 * MINUTES,
#[cfg(feature = "on-chain-release-build")]
Expand Down

0 comments on commit d9cbf46

Please sign in to comment.