# Inadequate checks to confirm the correct status of the sequence/sequencerUptimeFeed in PriceFeed.getPrice() contract

PriceFeed.getPrice() sequencer uptime check fails to revert when startedAt is 0 in an invalid Chainlink round, accepting stale prices.

- Payout: Audit contest
- Severity: medium
- Program: Size
- Found by: adeolu
- Disclosed: 2024-09-16
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-06-size-findings/issues/209
- Library page: https://bugbountylibrary.com/r/c4%3A2024-06-size%3AM-04
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:medium tech:evm tech:solidity vuln:oracle-manipulation

**Target:** PriceFeed.getPrice() oracle contract on L2
**Root cause:** The grace-period check computes block.timestamp - startedAt; when Chainlink returns startedAt=0 for an invalid round, the subtraction yields a huge value exceeding GRACE_PERIOD_TIME, so no revert occurs and answer=0 is treated as sequencer-up.
**Steps:**
1. Call PriceFeed.getPrice() while the sequencerUptimeFeed is in an invalid round (startedAt=0, answer=0).
2. Observe the check `block.timestamp - startedAt <= GRACE_PERIOD_TIME` evaluates false since block.timestamp - 0 is huge.
3. No revert on answer==1 or grace period; stale/zero data feed answer is accepted.
**How found:** Read Chainlink L2 sequencer docs noting startedAt returns 0 on invalid rounds, then traced the subtraction-based grace-period check and realized 0 makes it always pass.
**Insight:** When validating oracle round freshness, explicitly reject sentinel values like startedAt==0 or updatedAt==0; subtraction-based age checks silently pass when the timestamp is zero.

## Proof of concept (copied exactly from the original report)

**Sequencer uptime check in PriceFeed.getPrice()**

```
if (answer == 1) {
                // sequencer is down
                revert Errors.SEQUENCER_DOWN();
            }

            if (block.timestamp - startedAt <= GRACE_PERIOD_TIME) {
                // time since up
                revert Errors.GRACE_PERIOD_NOT_OVER();
            }
```

