Closed code423n4 closed 2 years ago
gzeon
> 0 is less gas efficient than != 0 for uint in require condition when optimizer is enabled Ref: https://twitter.com/GalloDaSballo/status/1485430908165443590
> 0
!= 0
$ grep -R -n -i "> 0" ./contracts/ ./contracts/LaunchEvent.sol:314: msg.value > 0, ./contracts/LaunchEvent.sol:355: require(_amount > 0, "LaunchEvent: invalid withdraw amount"); ./contracts/LaunchEvent.sol:390: require(wavaxReserve > 0, "LaunchEvent: no wavax balance"); ./contracts/LaunchEvent.sol:486: require(amount > 0, "LaunchEvent: caller has no incentive to claim"); ./contracts/LaunchEvent.sol:498: user.balance > 0, ./contracts/RocketJoeFactory.sol:119: _tokenAmount > 0,
Duplicate of #240
Handle
gzeon
Vulnerability details
Impact
> 0
is less gas efficient than!= 0
for uint in require condition when optimizer is enabled Ref: https://twitter.com/GalloDaSballo/status/1485430908165443590Proof of Concept
$ grep -R -n -i "> 0" ./contracts/ ./contracts/LaunchEvent.sol:314: msg.value > 0, ./contracts/LaunchEvent.sol:355: require(_amount > 0, "LaunchEvent: invalid withdraw amount"); ./contracts/LaunchEvent.sol:390: require(wavaxReserve > 0, "LaunchEvent: no wavax balance"); ./contracts/LaunchEvent.sol:486: require(amount > 0, "LaunchEvent: caller has no incentive to claim"); ./contracts/LaunchEvent.sol:498: user.balance > 0, ./contracts/RocketJoeFactory.sol:119: _tokenAmount > 0,