code-423n4 / 2021-12-maple-findings

0 stars 0 forks source link

"> 0" is less efficient than "!= 0" for unsigned integers #24

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

ye0lde

Vulnerability details

Impact

Gas savings

Proof of Concept

"> 0" is used in the following location(s):

https://github.com/maple-labs/debt-locker/blob/81f55907db7b23d27e839b9f9f73282184ed4744/contracts/DebtLocker.sol#L312

Tools Used

Visual Studio Code, Remix

Recommended Mitigation Steps

Change "> 0" to "!=0" for small gas savings.

deluca-mike commented 2 years ago

Good catch.

pauliax commented 2 years ago

Valid optimization.