Skip to content

Commit

Permalink
using prof_or_fast macro
Browse files Browse the repository at this point in the history
  • Loading branch information
asiniscalchi committed Sep 5, 2024
1 parent 50e3dd4 commit 1cda25f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 37 deletions.
13 changes: 3 additions & 10 deletions runtime/laos/src/configs/collective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@ use crate::{weights, AccountId, BlockNumber, Runtime, RuntimeCall, RuntimeEvent,
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 parachains_common::{DAYS, MINUTES};
use polkadot_runtime_common::prod_or_fast;
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 MotionDuration: BlockNumber = prod_or_fast!(7 * DAYS, 5 * MINUTES);
pub const MaxProposals: u32 = 7;
pub const MaxMembers: u32 = 20;
pub MaxProposalWeight: Weight = Perbill::from_percent(50) * RuntimeBlockWeights::get().max_block;
Expand Down
21 changes: 4 additions & 17 deletions runtime/laos/src/configs/election_phragmen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,13 @@ use crate::{
Treasury,
};
use frame_support::{parameter_types, traits::LockIdentifier};
#[cfg(not(feature = "fast-mode"))]
use parachains_common::DAYS;
#[cfg(feature = "fast-mode")]
use parachains_common::MINUTES;
use polkadot_runtime_common::CurrencyToVote;

#[cfg(feature = "fast-mode")]
pub const TERM_DURATION: BlockNumber = 10 * MINUTES;
#[cfg(not(feature = "fast-mode"))]
pub const TERM_DURATION: BlockNumber = 28 * DAYS;

#[cfg(feature = "fast-mode")]
pub const ELECTION_VOTING_LOCK_DURATION: BlockNumber = 10 * MINUTES;
#[cfg(not(feature = "fast-mode"))]
pub const ELECTION_VOTING_LOCK_DURATION: BlockNumber = 28 * DAYS;
use parachains_common::{DAYS, MINUTES};
use polkadot_runtime_common::{prod_or_fast, CurrencyToVote};

parameter_types! {
pub const CandidacyBond: Balance = 1000 * UNIT;
pub TermDuration: BlockNumber = TERM_DURATION;
pub VotingLockPeriod: BlockNumber = ELECTION_VOTING_LOCK_DURATION;
pub TermDuration: BlockNumber = prod_or_fast!(28 * DAYS, 10 * MINUTES);
pub VotingLockPeriod: BlockNumber = prod_or_fast!(28 * DAYS, 10 * MINUTES);
pub const DesiredMembers: u32 = 7;
pub const DesiredRunnersUp: u32 = 20;
pub const MaxCandidates: u32 = 30;
Expand Down
13 changes: 3 additions & 10 deletions runtime/laos/src/configs/treasury.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,15 @@ use frame_support::{
PalletId,
};
use frame_system::EnsureRoot;
#[cfg(not(feature = "fast-mode"))]
use parachains_common::DAYS;
#[cfg(feature = "fast-mode")]
use parachains_common::MINUTES;
use parachains_common::{DAYS, MINUTES};
use polkadot_runtime_common::prod_or_fast;
use sp_runtime::traits::IdentityLookup;

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

parameter_types! {
pub const Burn: Permill = Permill::zero();
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: Balance = 100 * UNIT;
pub const SpendPeriod: BlockNumber = TREASURY_SPENDING_PERIOD;
pub const SpendPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 5 * MINUTES);
pub const MaxApprovals: u32 = 100;
pub const TreasuryId: PalletId = PalletId(*b"py/trsry");
pub const PayoutPeriod: BlockNumber = 5;
Expand Down

0 comments on commit 1cda25f

Please sign in to comment.