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:
contracts\managers\SherlockProtocolManager.sol:801: if (_secondsOfCoverageLeft(_protocol) < MIN_SECONDS_LEFT) revert InsufficientBalance(_protocol);
contracts\SherClaim.sol:42: if (_claimableAt < block.timestamp + CLAIM_PERIOD_SANITY_BOTTOM) revert InvalidState();
contracts\SherClaim.sol:43: if (_claimableAt > block.timestamp + CLAIM_PERIOD_SANITY_CEILING) revert InvalidState();
contracts\Sherlock.sol:438: if (lockupEnd_[_id] > block.timestamp) revert InvalidConditions();
Tools Used
VS Code
Recommended Mitigation Steps
Use >= or <= instead of > and < when possible. Here, it's on time comparisons. As the averable block time in Ethereum is 14 seconds: the gas cost gain from this optimization might be worth the slim difference
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. Here, it's on time comparisons. As the averable block time in Ethereum is 14 seconds: the gas cost gain from this optimization might be worth the slim difference