Closed code423n4 closed 2 years ago
certora
getRemainingRewards might fail unexpectedly. getRemainingRewards calls _getRemainingRewards which calls _getCurrentEpochId:
function _getCurrentEpochId(Promotion memory _promotion) internal view returns (uint256) { // elapsedTimestamp / epochDurationTimestamp return (block.timestamp - _promotion.startTimestamp) / _promotion.epochDuration; }
If block.timestamp < _promotion.startTimestamp, it will revert due to underflow.
any external call to getRemainingRewards will revert if the promotion is not started yet.
check in _getRemainingRewards if the promotion started yet, if it didn't then return the entire amount.
Duplicate of https://github.com/code-423n4/2021-12-pooltogether-findings/issues/102
Duplicate of #101
Handle
certora
Vulnerability details
getRemainingRewards might fail unexpectedly. getRemainingRewards calls _getRemainingRewards which calls _getCurrentEpochId:
If block.timestamp < _promotion.startTimestamp, it will revert due to underflow.
Impact
any external call to getRemainingRewards will revert if the promotion is not started yet.
Recommended Mitigation Steps
check in _getRemainingRewards if the promotion started yet, if it didn't then return the entire amount.