-
Notifications
You must be signed in to change notification settings - Fork 0
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
&& operator can use more gas #128
Comments
While two seperate require checks result in about 14 gas saved on if (units == uint256(0)) revert LockResultsInNoUnits(); |
In release candidate contracts, |
resolved & confirmed |
Handle
rfa
Vulnerability details
Impact
more expensive gas usage
Proof of Concept
instead of using operator && on single require check (XDEFIDistribution.sol line 255). using double require check can save more gas:
require(amount_ != uint256(0) && amount_ <= MAX_TOTAL_XDEFI_SUPPLY, "INVALID_AMOUNT");
Tools Used
Recommended Mitigation Steps
require(amount_ != uint256(0), "INVALID_AMOUNT" );
require(amount_ <= MAX_TOTAL_XDEFI_SUPPLY, "INVALID_AMOUNT");
The text was updated successfully, but these errors were encountered: