Sablier

Sablier
DeFiFoundry
53,440 USDC
View results
Submission Details
Severity: medium
Invalid

Reusing the `_withdrawableAmountOf(StreamID)` function is redundant

Summary

Re-checking the amount in the SablierV2Lockup.sol contract, in the withdrawMax and withdraw functions.

Vulnerability Details

In the SablierV2Lockup.sol::withdrawMax function, the amount argument is passed through a call to the _withdrawableAmountOf(StreamID) function.
Next, the function SablierV2Lockup.sol::withdraw() is called, in which the passed amount is checked:

// Check: the withdraw amount is not greater than the withdrawable amount.
uint128 withdrawableAmount = _withdrawableAmountOf(streamId);
if (amount > withdrawableAmount) {
revert Errors.SablierV2Lockup_Overdraw(streamId, amount, withdrawableAmount);
}

There is no point in this check, since amount and withdrawableAmount will always be equal.

Impact

The logic of the contract is violated, while excessive gas consumption occurs during the operation of the smart contract.

Tools Used

Manual analysis

Recommendations

To refactor the code

Updates

Lead Judging Commences

inallhonesty Lead Judge over 1 year ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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