code-423n4 / 2021-12-pooltogether-findings

0 stars 0 forks source link

`_requirePromotionActive()` Remove redundant check can save gas #103

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

WatchPug

Vulnerability details

_requirePromotionActive() checks for _promotionEndTimestamp > 0, while the check also requires _promotionEndTimestamp >= block.timestamp, since block.timestamp must > 0, _promotionEndTimestamp > 0 is redundant.

Removing it will make the code simpler and save some gas.

https://github.com/pooltogether/v4-periphery/blob/0e94c54774a6fce29daf9cb23353208f80de63eb/contracts/TwabRewards.sol#L254-L257

require(
    _promotionEndTimestamp > 0 && _promotionEndTimestamp >= block.timestamp,
    "TwabRewards/promotion-not-active"
);
PierrickGT commented 2 years ago

Duplicate of https://github.com/code-423n4/2021-12-pooltogether-findings/issues/19