checkpointAllGauges may has gas explode error due to looping too many times #175
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Lines of code
https://github.com/code-423n4/2022-05-backd/blob/1136e0cdc8579614a33832fe2a21785d60aac19b/protocol/contracts/tokenomics/InflationManager.sol#L110-L125
Vulnerability details
Impact
If there are too many keeperGauges + stakerVaults + ammGauges
checkpointAllGauges functions may loop too mamy times which cause gas to be explode and always reverted.
Proof of Concept
If there are too many keeperGauges + stakerVaults + ammGauges, checkpointAllGauges functions may loop too mamy times which cause gas to be explode and always reverted.
This case happended to Pancakeswap as they have over hundreds farms. They cannot massUpdatePool and individual pools are required to be update independently.
Tools Used
Manual code scanning
Recommended Mitigation Steps
Split checkpointAllGauges into multiple checkpoint with start and end looping index
The text was updated successfully, but these errors were encountered: