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

Gas Optimizations #4

Closed
code423n4 opened this issue Jun 8, 2022 · 1 comment
Closed

Gas Optimizations #4

code423n4 opened this issue Jun 8, 2022 · 1 comment
Labels
bug Something isn't working G (Gas Optimization) invalid This doesn't seem right

Comments

@code423n4
Copy link
Contributor

Usage of non-equal operator against zero consumes more gas

The contract : https://github.com/code-423n4/2022-06-connext/blob/main/contracts/contracts/core/connext/helpers/LPToken.sol at line 35
checks if the amount isn't 0 " require(amount != 0, "LPToken: cannot mint 0");
" , this likely consumes more gas while it can do the same work by making the higher-than operator

Consider using :

require(amount>0, "LPToken: cannot mint 0");

instead of

require(amount != 0, "LPToken: cannot mint 0");
@code423n4 code423n4 added bug Something isn't working G (Gas Optimization) labels Jun 8, 2022
code423n4 added a commit that referenced this issue Jun 8, 2022
This was referenced Jun 19, 2022
@liu-zhipeng
Copy link
Collaborator

Invalid
See #274

@liu-zhipeng liu-zhipeng added the invalid This doesn't seem right label Jul 4, 2022
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) invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants