Closed code423n4 closed 2 years ago
certora
cancelPromotion might fail unexpectedly. cancelPromotion 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.
A promotion cannot be canceled before it started.
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/101
Handle
certora
Vulnerability details
cancelPromotion might fail unexpectedly. cancelPromotion calls _getRemainingRewards which calls _getCurrentEpochId:
If block.timestamp < _promotion.startTimestamp, it will revert due to underflow.
Impact
A promotion cannot be canceled before it started.
Recommended Mitigation Steps
check in _getRemainingRewards if the promotion started yet, if it didn't then return the entire amount.