Flow

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

incorrect calculation in covered balance hence wrong withdrawal amount

Summary

It is stated that if the stream balance is less than or equal to total debt , the function should return the stream balance . However , the condition check only compares if the balance is strictly less than the total debt. When the balance equals the total debt , this ommission results in the returning of the total debt instead of the balance , which can lead to unexpected outcomes in calculaions.

Vulnerability Details

this issue is localise to the _covered debt function , which is use to determine the amount of covere debt. It affects downstream functions like Maxwithdrawals calculations which rely on this functions output.When the balance is equal to the total debt , the balance is not returned which shoul be the maxwithdarwal amount.
https://github.com/Cyfrin/2024-10-sablier/blob/main/src/SablierFlow.sol#L467C4-L470C10

Impact

Inaccurate output of total debt calculation : when the balance is exactly equal to the total debt , the function does not return the balance as it is supposed to resulting to unexpected calculations.

test case:

  1. Initialize the stream with a specific balance

  2. make the total debt accumulate to exactly equal to the streams balance

  3. call the _coveredDebtOf function and it returns totalDebt instead of balance.

Tools Used

manual review

Recommendations

update the condition to include equality check

if (balance <= totalDebt) {
return balance;
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

[INVALID]`_coveredDebtOf` discrepancy between condition and comment `balance < totalDebt`

Support

FAQs

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