A missing zero value check during contract deployment can lead to advanceEpoch() reverting due to a divide-by-zero issue.
There will be an error issue when calculating epochsPassedSinceLastAdvance since getEpochDuration() = 0 , making it not possible to advance epochs.
Tools Used
Manual review
Recommended Mitigation Steps
Add a require() check for zero value in the constructor.
Lines of code
https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L65 https://github.com/code-423n4/2022-06-infinity/blob/main/contracts/token/InfinityToken.sol#L47
Vulnerability details
Impact
A missing zero value check during contract deployment can lead to
advanceEpoch()
reverting due to a divide-by-zero issue. There will be an error issue when calculatingepochsPassedSinceLastAdvance
sincegetEpochDuration() = 0
, making it not possible to advance epochs.Tools Used
Manual review
Recommended Mitigation Steps
Add a require() check for zero value in the constructor.