code-423n4 / 2021-10-slingshot-findings

0 stars 0 forks source link

`> 0` can be replaced with ` != 0` for gas optimisation #35

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

0x0x0x

Vulnerability details

Impact

!= 0 is a cheaper operation compared to > 0, when dealing with uint.

Occurences

contracts/Slingshot.sol:74:        require(finalAmountMin > 0, "Slingshot: finalAmountMin cannot be zero");
contracts/Slingshot.sol:75:        require(trades.length > 0, "Slingshot: trades cannot be empty");
contracts/module/IUniswapModule.sol:28:        require(path.length > 0, "UniswapModule: path length must be >0");

Tools Used

grep