sherlock-audit / 2023-05-perennial-judging

12 stars 9 forks source link

MohammedRizwan - Missing check for active Arbitrum Sequencer #242

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

MohammedRizwan

medium

Missing check for active Arbitrum Sequencer

Summary

Chainlink recommends that all Optimistic L2 oracles consult the Sequencer Uptime Feed to ensure that the sequencer is live before trusting the data returned by the oracle. This check is is missing in ChainlinkAggregator.sol contract.

Vulnerability Detail

Since the smart contracts will also be deployed on Arbitrum. If the Arbitrum Sequencer goes down, oracle data will not be kept up to date, and thus could become stale. However, users are able to continue to interact with the protocol directly through the L1 optimistic rollup contract. You can review Chainlink docs on L2 Sequencer Uptime Feeds for more details on this.

As a result, users may be able to use the protocol while oracle feeds are stale. This could cause many problems, but as a simple example:

Impact

If the Arbitrum sequencer goes down, the protocol will allow users to continue to operate at the previous (stale) rates.

Code Snippet

https://github.com/equilibria-xyz/perennial-mono/blob/b06d5145db62a312dd88dfcafef0f8e2166c5e32/packages/perennial-oracle/contracts/types/ChainlinkAggregator.sol#L32-L36

Tool used

Manual Review

Recommendation

Use sequencer oracle to determine whether the sequencer is offline or not, and don't allow orders to be executed while the sequencer is offline.

Check the Chainlink Documentation for a full example: https://docs.chain.link/data-feeds/l2-sequencer-feeds#example-code

Also check the queue system here: https://docs.chain.link/data-feeds/l2-sequencer-feeds/

Duplicate of #13