During sequencer downtime, price feeds (e.g., Chainlink oracles) may not update. After the sequencer resumes, stale price data from before the downtime could be used, leading to incorrect price validations (e.g., undercollateralized positions, inaccurate swaps).
https://github.com/CodeHawks-Contests/2025-02-gamma/blob/e5b98627a4c965e203dbb616a5f43ec194e7631a/contracts/KeeperProxy.sol#L155
https://github.com/CodeHawks-Contests/2025-02-gamma/blob/e5b98627a4c965e203dbb616a5f43ec194e7631a/contracts/KeeperProxy.sol#L188
Flaws:
Missing Post-Downtime Feed Check: The _check function validates feed freshness against maxTimeWindow but does not ensure updates occurred after sequencer restart.
Stale Data Risk: Feeds updated before/during downtime might be used post-recovery, even if maxTimeWindow is large.
Example Scenario:
Sequencer Downtime: The L2 sequencer is offline for 2 hours.
Price Feed Staleness: Chainlink oracles cannot update during downtime.
Sequencer Resumes: After 1 hour (grace period), the protocol resumes operations.
Stale Data Used: Price feeds still reflect pre-downtime values, causing faulty liquidations or trades.
Trades execute with stale prices during downtime.
Manual Review
Validate Price Feed Updates Post-Sequencer Restart: Add checks to ensure price feeds were updated after the sequencer resumed operations.
After Fixes:
Post-Restart Feed Check:
_checkFeedUpdatedAfter ensures the price feed’s updatedAt timestamp is after the sequencer’s sequencerRestartTime.
Rejects stale data from before/during downtime.
Grace Period Enforcement:
Maintains the existing grace period to avoid using data immediately after sequencer restart.
Comprehensive Coverage:
Applies to all relevant tokens (index, long, short) in the market.
Verification
Test Case 1 (Sequencer Restart + Feed Updated):
Sequencer restarts at t=1000.
Price feed updates at t=1100.
Result: Validation passes ✅.
Test Case 2 (Feed Not Updated Post-Restart):
Sequencer restarts at t=1000.
Feed last updated at t=900 (pre-downtime).
Result: Reverts with "Price feed not updated post-sequencer restart" ❌.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.