Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Have OCW mined election once a week on Westend (#7248)
Browse files Browse the repository at this point in the history
* disable signed phase on westend once a week

* use maybe signed phase

* current era is already u32
  • Loading branch information
Ank4n authored May 22, 2023
1 parent cbd5330 commit dbe8b01
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,20 @@ impl pallet_session::historical::Config for Runtime {
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}

pub struct MaybeSignedPhase;

impl Get<u32> for MaybeSignedPhase {
fn get() -> u32 {
// 1 day = 4 eras -> 1 week = 28 eras. We want to disable signed phase once a week to test the fallback unsigned
// phase is able to compute elections on Westend.
if Staking::current_era().unwrap_or(1) % 28 == 0 {
0
} else {
SignedPhase::get()
}
}
}

parameter_types! {
// phase durations. 1/4 of the last session for each.
pub SignedPhase: u32 = prod_or_fast!(
Expand Down Expand Up @@ -415,7 +429,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type EstimateCallFee = TransactionPayment;
type SignedPhase = SignedPhase;
type SignedPhase = MaybeSignedPhase;
type UnsignedPhase = UnsignedPhase;
type SignedMaxSubmissions = SignedMaxSubmissions;
type SignedMaxRefunds = SignedMaxRefunds;
Expand Down

0 comments on commit dbe8b01

Please sign in to comment.