Normally, expiry is mutable by the pool sponsor until the first stake (expiryLocked latch), and riskWindowStart is sealed by _markRiskWindowStart which caps the value at expiry to prevent the risk window from opening past the pool deadline. The expiryLocked latch is designed to protect staker reliance on the deadline that feeds the k=2 bonus formula.
However, expiryLocked only latches on the first stake call. An unprivileged user can call pokeRiskWindow to seal riskWindowStart (capped at the current expiry) before any stake occurs. The sponsor can then call setExpiry with a lower value, creating a state where riskWindowStart > expiry. This breaks the invariant that _markRiskWindowStart's cap was designed to enforce.
Likelihood:
An unprivileged attacker calls pokeRiskWindow during the UNDER_ATTACK registry phase, sealing riskWindowStart = min(now, expiry) before any staker has deposited.
The sponsor subsequently lowers expiry via setExpiry (permitted because expiryLocked is still false — no stake has occurred). This is a legitimate sponsor action since the sponsor may not know a third party sealed the risk window.
Impact:
When claimExpired auto-resolves, _markRiskWindowEnd caps riskWindowEnd = min(now, newExpiry) < riskWindowStart. Then outcomeFlaggedAt = riskWindowEnd < riskWindowStart.
In _bonusShare, every staker's score becomes (riskWindowStart - T)^2 * stake — identical for all stakers, collapsing the k=2 time-weighting to a degenerate amount-weighted split. The bonus distribution mechanism is defeated.
The state riskWindowStart > expiry is semantically inconsistent: it implies the risk window opened after the pool expired, which should be impossible.
Latch expiryLocked when riskWindowStart is first sealed, not only on the first stake. Alternatively, add a check in setExpiry:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.