DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Incorrect check can cause unexpected error

Summary

The stakeVested has an incorrect check which can cause an underflow error instead of the custom error

Vulnerability Details

function stakeVested(uint256 _streamID) external checkEpochRollover redeemPendingRewards {
//CHECK
if (!sablier.isStream(_streamID)) revert NotAStream();
if (sablier.isCold(_streamID)) revert NotAWarmStream();
// only allow authorized stream sender to stake cancelable stream
if (!authorizedSablierSenders[sablier.getSender(_streamID)]) {
revert StreamNotSupported();
}
if (address(sablier.getAsset(_streamID)) != address(fjordToken)) revert InvalidAsset();
uint128 depositedAmount = sablier.getDepositedAmount(_streamID);
uint128 withdrawnAmount = sablier.getWithdrawnAmount(_streamID);
uint128 refundedAmount = sablier.getRefundedAmount(_streamID);
>> if (depositedAmount - (withdrawnAmount + refundedAmount) <= 0) revert InvalidAmount();

Impact

Unexpected error in some rare cases

Tools used

Manual Review

Recommendations

Consider using another check:

- if (depositedAmount - (withdrawnAmount + refundedAmount) <= 0) revert InvalidAmount();
+ if (depositedAmount <= (withdrawnAmount + refundedAmount)) revert InvalidAmount();
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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