code-423n4 / 2022-01-livepeer-findings

0 stars 0 forks source link

Gas Optimization: `> 0` is less efficient than `!= 0` for uint #229

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

gzeon

Vulnerability details

Impact

> 0 is less gas efficient than != 0 for uint

Proof of Concept

$ grep -Rn -F "> 0" ./contracts/ ./contracts/L1/gateway/L1LPTGateway.sol:152: if (escrowBalance > 0) { ./contracts/L2/gateway/L2Migrator.sol:182: if (_params.fees > 0) { ./contracts/L2/gateway/L2Migrator.sol:296: if (_fees > 0) {

yondonfu commented 2 years ago

Duplicate of https://github.com/code-423n4/2022-01-livepeer-findings/issues/37