code-423n4 / 2021-11-badgerzaps-findings

0 stars 0 forks source link

For `uint` use ` != 0` instead of ` > 0` #18

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

0x0x0x

Vulnerability details

Impact

It is cheaper to use != 0 than > 0 for uint256.

Occurences

SettToRenIbbtcZap.sol#L266
IbbtcVaultZap.sol#L150
IbbtcVaultZap.sol#L163
DepositZapibBTC.vy#L283
DepositZapibBTC.vy#L296

Tools Used

Manual analysis

GalloDaSballo commented 2 years ago

Factually correct

MugeR01 commented 10 months ago

I would like to correct this fact, as per Ethereum Yellow Paper, its more gas efficient to use !=0 than >0 since the prior uses more opcodes to compute as compared to the latter.