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

0 stars 0 forks source link

"> 0" is less efficient than "!= 0" for unsigned integers #135

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

ye0lde

Vulnerability details

Impact

Gas savings

Proof of Concept

"> 0" is used in the following locations: https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L239 https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L255 https://github.com/pooltogether/v4-periphery/blob/b520faea26bcf60371012f6cb246aa149abd3c7d/contracts/TwabRewards.sol#L319

Tools Used

Visual Studio Code, Remix

Recommended Mitigation Steps

Change "> 0" to "!=0" for small gas savings.

PierrickGT commented 2 years ago

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