Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use != 0 instead of > 0 #21

Open
code423n4 opened this issue Jan 27, 2022 · 2 comments
Open

Use != 0 instead of > 0 #21

code423n4 opened this issue Jan 27, 2022 · 2 comments
Labels
bug Something isn't working G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons

Comments

@code423n4
Copy link
Contributor

Handle

mics

Vulnerability details

Using != 0 is slightly cheaper than > 0.
see code-423n4/2021-12-maple-findings#75 for similar issue.

    OpenLevV1.sol, 454: change 'buyAmount > 0' to 'buyAmount != 0'
    OpenLevV1Lib.sol, 112: change 'marginLimit > 0' to 'marginLimit != 0'
    OpenLevV1.sol, 424: change 'balance > 0' to 'balance != 0'
    UniV2Dex.sol, 207: change 'reserveIn > 0' to 'reserveIn != 0'
    ControllerV1.sol, 342: change 'supplyAmount > 0' to 'supplyAmount != 0'
    UniV3Dex.sol, 165: change 'amount0Delta > 0' to 'amount0Delta != 0'
    OpenLevV1Lib.sol, 276: change 'totalShare > 0' to 'totalShare != 0'
    XOLE.sol, 266: change '_value > 0' to '_value != 0'
    ControllerV1.sol, 363: change 'borrowAmount > 0' to 'borrowAmount != 0'
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Jan 27, 2022
code423n4 added a commit that referenced this issue Jan 27, 2022
@ColaM12 ColaM12 added disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons labels Jan 27, 2022
@ColaM12
Copy link
Collaborator

ColaM12 commented Jan 27, 2022

Goode point, but not a bug.

@ColaM12 ColaM12 closed this as completed Jan 27, 2022
@ColaM12 ColaM12 removed the disagree with severity Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments) label Jan 27, 2022
@ColaM12 ColaM12 reopened this Jan 27, 2022
@0xleastwood
Copy link
Collaborator

Only an issue because the comparison is made in a conditional statement. Typically this will not save gas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working G (Gas Optimization) sponsor acknowledged Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Projects
None yet
Development

No branches or pull requests

3 participants