Closed code423n4 closed 2 years ago
0x0x0x
!= 0 is a cheaper operation compared to > 0, when dealing with uint.
!= 0
> 0
uint
./basket/contracts/singleJoinExit/EthSingleTokenJoin.sol:23: require(msg.value > 0, "No native token passed"); ./basket/contracts/singleJoinExit/EthSingleTokenJoin.sol:33: if (remainingIntermediateBalance > 0) { ./basket/contracts/singleJoinExit/EthSingleTokenJoinV2.sol:23: require(msg.value > 0, "No native token passed"); ./basket/contracts/singleJoinExit/EthSingleTokenJoinV2.sol:33: if (remainingIntermediateBalance > 0) { ./basket/contracts/singleJoinExit/SingleTokenJoin.sol:65: if (remainingIntermediateBalance > 0) { ./basket/contracts/singleJoinExit/SingleTokenJoinV2.sol:75: if (remainingIntermediateBalance > 0) { ./basket/contracts/test/MockPangolinRouter.sol:39: if (amountOutMin > 0) ./basket/contracts/test/MockPangolinRouter.sol:55: uint256 amountIn = amountInMax > 0
This has been tested before in Remix, there are no actual gas savings from using the recommended change despite the optimiser being enabled or disabled.
Handle
0x0x0x
Vulnerability details
Impact
!= 0
is a cheaper operation compared to> 0
, when dealing withuint
.Occurrences