TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: low
Invalid

`getPriorVotes` function on Arbitrum might get incorrect data

GitHub

https://github.com/Cyfrin/2024-07-templegold/blob/6c3980a0486c01114d0ef1281df188b6c01991e6/protocol/contracts/templegold/TempleGoldStaking.sol#L213

Summary

On Arbitrum, the block.number returns the most recently synced L1 block number, which is updated roughly once per minute. This synchronization lag means that block.number on Arbitrum can be outdated compared to the actual L1 block number.

Impact

Using block.number on Arbitrum to determine the prior votes might not reflect the most recent changes on the L1 chain due to the synchronization delay. This can lead to inaccuracies when querying recent blocks. Functions that rely on the current block number to provide accurate data (such as historical votes) may return incorrect or outdated information, potentially causing misinformation and unreliable contract behavior.

Recommendation

Use block.timestamp rather than block.number to mitigate the synchronization lag issue. This ensures that time-based calculations remain accurate, despite the block number synchronization delay. Alternatively, fetch the L1 block number directly or implement a buffer to ensure accurate vote calculations.

Updates

Lead Judging Commences

inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.