Have OCW mined election once a week on Westend (#7248)

* disable signed phase on westend once a week

* use maybe signed phase

* current era is already u32
This commit is contained in:
Ankan
2023-05-22 22:04:12 +02:00
committed by GitHub
parent 220aa231bc
commit 23a737257d
+15 -1
View File
@@ -334,6 +334,20 @@ impl pallet_session::historical::Config for Runtime {
type FullIdentificationOf = pallet_staking::ExposureOf<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! { parameter_types! {
// phase durations. 1/4 of the last session for each. // phase durations. 1/4 of the last session for each.
pub SignedPhase: u32 = prod_or_fast!( pub SignedPhase: u32 = prod_or_fast!(
@@ -415,7 +429,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type EstimateCallFee = TransactionPayment; type EstimateCallFee = TransactionPayment;
type SignedPhase = SignedPhase; type SignedPhase = MaybeSignedPhase;
type UnsignedPhase = UnsignedPhase; type UnsignedPhase = UnsignedPhase;
type SignedMaxSubmissions = SignedMaxSubmissions; type SignedMaxSubmissions = SignedMaxSubmissions;
type SignedMaxRefunds = SignedMaxRefunds; type SignedMaxRefunds = SignedMaxRefunds;