Strict inequalities add a check of non equality which costs around 3 gas.
Proof of Concept
The following should use an inclusive inequality to save gas:
File: Cvx3CrvOracle.sol
55: function min(uint256 a, uint256 b) internal pure returns (uint256) {
56: return a < b ? a : b; //@audit-info <= is less expensive and would give the same result
57: }
Handle
Dravee
Vulnerability details
Impact
Strict inequalities add a check of non equality which costs around 3 gas.
Proof of Concept
The following should use an inclusive inequality to save gas:
Tools Used
VS Code
Recommended Mitigation Steps
Use
>=
or<=
instead of>
and<
when possible.