Timing assumptions on Ethereum do not directly translate to L2s.
Block Numbers: On L2s like Arbitrum and Optimism, multiple L2 blocks can exist within a single Ethereum block. Therefore, block.number
can return the same value across different L2 blocks, leading to potential inaccuracies.
Block Timestamps: L2s also have their own rules for block.timestamp
. For example, on Arbitrum, the sequencer sets the timestamp. If the sequencer fails to post batches to Ethereum in a timely manner, it can adjust timestamps within set boundaries (currently up to 24 hours earlier or 1 hour later than the current time) to prevent chain reorganization.
Beanstalk relies heavily on block.number
and block.timestamp
to perform the sunrise
call. For example:
Calculating whether sunrise can be called:
Calculating the Bean rewards for calling sunrise:
Calculating pod demand based on the sowTime
Calculating morning temperature delta
Given the scenario above, Beanstalk will be susceptible to many issues related to block.number
and block.timestamp
. Among them:
Sunrise will issue the incorrect amount of Beans when called(due to block.number / block.timestamp not being reflecting the current ones).
When sequencers set a block.timestamp
that is delayed, meaning that the current timestamp is + 1 hour since the last season, but sequencer block.timestamp
is only +5min, sunrise
will be temporarily facing DoS until the sequencer time is adjusted.
Calculation of temperature/sow/demand for pods will also be affected(as they also rely on block.timestamp
).
Manual Review
Avoid utilizing block.number
and block.timestamp
directly. For Arbitrum for example, the block number and timestamp from Arbitrum blocks can be directly fetched through ArbSys
.
References:
https://detectors.auditbase.com/blocknumber-variation-on-l2-solidity
https://docs.arbitrum.io/build-decentralized-apps/arbitrum-vs-ethereum/block-numbers-and-time#block-numbers-arbitrum-vs-ethereum
MulticallV2 for Arbitrum - https://arbiscan.io/address/0x7eCfBaa8742fDf5756DAC92fbc8b90a19b8815bF#code
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.