sherlock-audit / 2023-05-perennial-judging

12 stars 9 forks source link

tsvetanovv - Missing check for active L2 Sequencer #224

Closed sherlock-admin closed 1 year ago

sherlock-admin commented 1 year ago

tsvetanovv

medium

Missing check for active L2 Sequencer

Summary

In Q&A we see:

On what chains are the smart contracts going to be deployed?

  • Perennial is deployed on Ethereum and Arbitrum mainnets

You should always check for sequencer availability when using Chainlink's Arbitrum price feeds or another layer 2 chains.

Vulnerability Detail

Optimistic rollup protocols move all execution off the layer 1 (L1) Ethereum chain, complete execution on a layer 2 (L2) chain, and return the results of the L2 execution back to the L1. These protocols have a sequencer that executes and rolls up the L2 transactions by batching multiple transactions into a single transaction.

If a sequencer becomes unavailable, it is impossible to access read/write APIs that consumers are using and applications on the L2 network will be down for most users without interacting directly through the L1 optimistic rollup contracts. The L2 has not stopped, but it would be unfair to continue providing service on your applications when only a few users can use them.

Impact

If the Arbitrum Sequencer goes down, oracle data will not be kept up to date, and thus could become stale.

Code Snippet

https://github.com/sherlock-audit/2023-05-perennial/blob/main/perennial-mono/packages/perennial-oracle/contracts/ChainlinkFeedOracle.sol#L14 https://github.com/sherlock-audit/2023-05-perennial/blob/main/perennial-mono/packages/perennial-oracle/contracts/ChainlinkOracle.sol#L15

Tool used

Manual Review

Recommendation

Check this example -> https://docs.chain.link/data-feeds/l2-sequencer-feeds#example-code

Duplicate of #13