Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 1.89 KB

008.md

File metadata and controls

63 lines (42 loc) · 1.89 KB

Smooth Ultraviolet Turkey

Medium

Method currentValue() in OracleRelay ignores sequencer uptime check while accessing chainlink data feed

Summary

As per Chainlink docs, For the L2s it is important to check the sequencer uptime prior to fetching the price feed for any token. We should first access the sequencerUptimeFeed. If the sequencer is up then we should proceed with fetching the price feed. https://docs.chain.link/data-feeds/l2-sequencer-feeds

Root Cause

No prior validation before calling latestAnswer() method. https://github.com/sherlock-audit/2024-11-oku/blob/main/oku-custom-order-types/contracts/oracle/External/OracleRelay.sol#L19

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

If the sequencer goes down. The contract will stay operational leading to monetary loss.

Impact

If the sequencer is down the contract will fetch the stale prices. All the functionality dependant on prices will be impacted. The liquidations won't happen and people will be trading on stale prices until the sequencer comes up.

PoC

No response

Mitigation

First validate the sequencerUptimeFeed then proceed with fetching the feed data.

        (
            /*uint80 roundID*/,
            int256 answer,
            uint256 startedAt,
            /*uint256 updatedAt*/,
            /*uint80 answeredInRound*/
        ) = sequencerUptimeFeed.latestRoundData();

        // Answer == 0: Sequencer is up
        // Answer == 1: Sequencer is down
        bool isSequencerUp = answer == 0;
        if (!isSequencerUp) {
            revert SequencerDown();
        }

        // Make sure the grace period has passed after the
        // sequencer is back up.
        uint256 timeSinceUp = block.timestamp - startedAt;
        if (timeSinceUp <= GRACE_PERIOD_TIME) {
            revert GracePeriodNotOver();
        }