mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 21:01:02 +00:00
Add fast-runtime Cargo Feature for Quick Test Runs (#4332)
* add fast-runtime feature for reduced session times * make democracy periods fast on fast-runtime * propagate fast-runtime feature through cargo.toml files * add fast motion and term durations to Kusama * Update runtime/westend/Cargo.toml Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * set session time to 2 minutes to avoid block production issues * formatting * update Substrate * set democracy fast periods back to 1min * set launch period and enactment period to 1 block in fast-runtime * remove unnecessary westend period configs * add prod_or_test macro to allow specifying prod, test and env values for parameter types * move prod_or_test macro into common module and use it consistently * rename macro to prod_or_fast * cargo +nightly fmt * bump impl_versions * newline Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * add note that env variable is evaluated at compile time * newline Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * newline Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * cargo fmt * impl_version: 0 * impl_version: 0 * use prod_or_fast macro for LeasePeriod and LeaseOffset * use prod_or_fast macro in WND and ROC constants Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Giles Cope <gilescope@gmail.com>
This commit is contained in:
@@ -33,8 +33,8 @@ use primitives::{
|
||||
v2::SessionInfo,
|
||||
};
|
||||
use runtime_common::{
|
||||
auctions, claims, crowdloan, impls::DealWithFees, paras_registrar, slots, BlockHashCount,
|
||||
BlockLength, BlockWeights, CurrencyToVote, OffchainSolutionLengthLimit,
|
||||
auctions, claims, crowdloan, impls::DealWithFees, paras_registrar, prod_or_fast, slots,
|
||||
BlockHashCount, BlockLength, BlockWeights, CurrencyToVote, OffchainSolutionLengthLimit,
|
||||
OffchainSolutionWeightLimit, RocksDbWeight, SlowAdjustingFeeUpdate,
|
||||
};
|
||||
use sp_core::u32_trait::{_1, _2, _3, _5};
|
||||
@@ -249,9 +249,13 @@ impl pallet_preimage::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const EpochDuration: u64 = EPOCH_DURATION_IN_SLOTS as u64;
|
||||
pub EpochDuration: u64 = prod_or_fast!(
|
||||
EPOCH_DURATION_IN_SLOTS as u64,
|
||||
2 * MINUTES as u64,
|
||||
"KSM_EPOCH_DURATION"
|
||||
);
|
||||
pub const ExpectedBlockTime: Moment = MILLISECS_PER_BLOCK;
|
||||
pub const ReportLongevity: u64 =
|
||||
pub ReportLongevity: u64 =
|
||||
BondingDuration::get() as u64 * SessionsPerEra::get() as u64 * EpochDuration::get();
|
||||
}
|
||||
|
||||
@@ -385,8 +389,17 @@ impl pallet_session::historical::Config for Runtime {
|
||||
|
||||
parameter_types! {
|
||||
// phase durations. 1/4 of the last session for each.
|
||||
pub const SignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;
|
||||
pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_SLOTS / 4;
|
||||
// in testing: 1min or half of the session for each
|
||||
pub SignedPhase: u32 = prod_or_fast!(
|
||||
EPOCH_DURATION_IN_SLOTS / 4,
|
||||
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2),
|
||||
"KSM_SIGNED_PHASE"
|
||||
);
|
||||
pub UnsignedPhase: u32 = prod_or_fast!(
|
||||
EPOCH_DURATION_IN_SLOTS / 4,
|
||||
(1 * MINUTES).min(EpochDuration::get().saturated_into::<u32>() / 2),
|
||||
"KSM_UNSIGNED_PHASE"
|
||||
);
|
||||
|
||||
// signed config
|
||||
pub const SignedMaxSubmissions: u32 = 16;
|
||||
@@ -572,12 +585,12 @@ impl pallet_staking::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const LaunchPeriod: BlockNumber = 7 * DAYS;
|
||||
pub const VotingPeriod: BlockNumber = 7 * DAYS;
|
||||
pub const FastTrackVotingPeriod: BlockNumber = 3 * HOURS;
|
||||
pub LaunchPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1, "KSM_LAUNCH_PERIOD");
|
||||
pub VotingPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_VOTING_PERIOD");
|
||||
pub FastTrackVotingPeriod: BlockNumber = prod_or_fast!(3 * HOURS, 1 * MINUTES, "KSM_FAST_TRACK_VOTING_PERIOD");
|
||||
pub const MinimumDeposit: Balance = 100 * CENTS;
|
||||
pub const EnactmentPeriod: BlockNumber = 8 * DAYS;
|
||||
pub const CooloffPeriod: BlockNumber = 7 * DAYS;
|
||||
pub EnactmentPeriod: BlockNumber = prod_or_fast!(8 * DAYS, 1, "KSM_ENACTMENT_PERIOD");
|
||||
pub CooloffPeriod: BlockNumber = prod_or_fast!(7 * DAYS, 1 * MINUTES, "KSM_COOLOFF_PERIOD");
|
||||
pub const InstantAllowed: bool = true;
|
||||
pub const MaxVotes: u32 = 100;
|
||||
pub const MaxProposals: u32 = 100;
|
||||
@@ -637,7 +650,7 @@ impl pallet_democracy::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const CouncilMotionDuration: BlockNumber = 3 * DAYS;
|
||||
pub CouncilMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION");
|
||||
pub const CouncilMaxProposals: u32 = 100;
|
||||
pub const CouncilMaxMembers: u32 = 100;
|
||||
}
|
||||
@@ -661,7 +674,7 @@ parameter_types! {
|
||||
// additional data per vote is 32 bytes (account id).
|
||||
pub const VotingBondFactor: Balance = deposit(0, 32);
|
||||
/// Daily council elections
|
||||
pub const TermDuration: BlockNumber = 24 * HOURS;
|
||||
pub TermDuration: BlockNumber = prod_or_fast!(24 * HOURS, 2 * MINUTES, "KSM_TERM_DURATION");
|
||||
pub const DesiredMembers: u32 = 19;
|
||||
pub const DesiredRunnersUp: u32 = 19;
|
||||
pub const PhragmenElectionPalletId: LockIdentifier = *b"phrelect";
|
||||
@@ -689,7 +702,7 @@ impl pallet_elections_phragmen::Config for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const TechnicalMotionDuration: BlockNumber = 3 * DAYS;
|
||||
pub TechnicalMotionDuration: BlockNumber = prod_or_fast!(3 * DAYS, 2 * MINUTES, "KSM_MOTION_DURATION");
|
||||
pub const TechnicalMaxProposals: u32 = 100;
|
||||
pub const TechnicalMaxMembers: u32 = 100;
|
||||
}
|
||||
@@ -1252,7 +1265,7 @@ impl paras_registrar::Config for Runtime {
|
||||
|
||||
parameter_types! {
|
||||
// 6 weeks
|
||||
pub const LeasePeriod: BlockNumber = 6 * WEEKS;
|
||||
pub LeasePeriod: BlockNumber = prod_or_fast!(6 * WEEKS, 6 * WEEKS, "KSM_LEASE_PERIOD");
|
||||
}
|
||||
|
||||
impl slots::Config for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user