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 #51
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
G (Gas Optimization)
invalid
This doesn't seem right
Comments
Closed
Custom errors (Duplicated) |
1. cache .length into local variable to avoid looking up every for-loop iteration (Duplicated)Duplicated of #2 at For loop optimizaion 2. using ++i consumes 5 less gas than i++ (same applies to --i) (Duplicated)Duplicated of #2 at For loop optimizaion 3. using unchecked keyword for counter i unchecked{ ++i; } consumes 49 less gas each iteration (same applies to --i) (Duplicated)Duplicated of #2 at For loop optimizaion 4. don't initialize uint256 i = 0; instead use the default value uint256 i; (Duplicated)Duplicated of #2 at For loop optimizaion |
Splitting && conditions into several require statements saves gas. (duplicate) |
Replacing "_msgSender()" to "msg.sender" will save gas (Disputed)msgSender() should be used for intermediate, library-like contracts. Already surfaced in previous audits. |
Appears to be a double submit by the warden with #52. Invalidating this one, keeping 52 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
G (Gas Optimization)
invalid
This doesn't seem right
Impact
Consider using optimized for-loop and apply the following optimizations:
Affected code:
Proof of Concept
Tools Used
Recommended Mitigation Steps
Impact
Replacing "_msgSender()" to "msg.sender" will save gas.
Affected code:
Proof of Concept
Tools Used
Recommended Mitigation Steps
Impact
Splitting && conditions into several require statements saves gas.
Affected code:
Proof of Concept
Tools Used
Recommended Mitigation Steps
Impact
As per 0.8.4 solidity version it supports new custom errors.
Custom errors are reducing 38 gas if condition is met and 22 gas otherwise.
Also reduces contract size and deployment costs.
Affected code:
Proof of Concept
Tools Used
Recommended Mitigation Steps
The text was updated successfully, but these errors were encountered: