Closed code423n4 closed 2 years ago
The amount of gauges will be kept to a minimum
I believe the finding to have validity, however:
poolCheckpoint
can still be called on a one to one basis (they are permissioneless operations)I will downgrade to QA
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