Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

Not Expired Swap Request Can Be Refunded

Summary

In StabilityBranch::refundSwap a swap request with deadline equal to block.timestamp (not expired) can be refunded.

Vulnerability Details

In StabilityBranch::refundSwap a swap request with deadline equal to block.timestamp (not expired) can be refunded. This is due to the given check:

if (deadlineCache > block.timestamp) {
revert Errors.RequestNotExpired(msg.sender, requestId);
}

If deadlineCache is equal to block.timestamp the call will not revert. This is an issue because at a deadline equal to block.timestamp a request can be fulfilled as it is not expired. This breaks the invariant of the refundSwap function.

Impact

This breaks the invariant of the refundSwap function and leads to a confusing workflow for swap requests.

Tools Used

Manual Review

Recommendations

Change the given check in the following way:

-if (deadlineCache > block.timestamp) {
+if (deadlineCache >= block.timestamp) {
revert Errors.RequestNotExpired(msg.sender, requestId);
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.