Flow

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

Missing Validation for Non-Zero `ratePerSecond` in `restart` Function

Github

  • https://github.com/Cyfrin/2024-10-sablier/blob/8a2eac7a916080f2022527408b004578b21c51d0/src/SablierFlow.sol#L367

Summary

In the SablierFlow contract, the restart function is intended to restart a paused stream with a new streaming rate specified by the ratePerSecond parameter. The interface documentation specifies that ratePerSecond must be greater than zero. However, this condition is not enforced in the function flow, allowing streams to be restarted with a ratePerSecond of zero. This discrepancy could lead to unintended contract behavior and logical issues with other functions that assume a positive streaming rate.

Vulnerability Details

The flow lacks a check to confirm that ratePerSecond > 0. As a result, users may call the restart function with a zero rate, which is contradictory to the intended behavior outlined in the interface documentation.

Flow Breakdown

  • restart Function: Calls _restart without any validation of ratePerSecond being greater than zero.

  • _restart Function: Checks only that the stream is paused, then calls _adjustRatePerSecond.

  • _adjustRatePerSecond Function: Checks if newRatePerSecond differs from the current rate, but it does not validate that the newRatePerSecond is greater than zero.

Restarting a stream with a zero ratePerSecond may cause issues for functions that assume a positive rate. Other parts of the contract may have expectations for ratePerSecond to be non-zero, leading to discrepancies in debt calculations, balance updates, or other contract states.

It also effect the whole flow of restartAndDeposit. If ratePerSecond is zero, the stream appears active but no tokens are streamed. When _deposit is called in restartAndDeposit, it adds funds to the stream balance, creating a misleading situation where funds are locked but never streamed.

Impact

Allowing a stream to restart with a zero rate may cause logical errors and unexpected behaviors, especially for functions that interact with the stream’s debt and rate of accumulation. For example:

  • Users may deposit funds that are then effectively locked in the contract without being streamed.

  • Other functions like restartAndDeposit assuming a positive rate for debt accumulation may encounter logical issues or errors.

  • A zero-rate stream is active but effectively stagnant, which might cause confusion for users and other contract functions depending on accurate streaming status.

Tools Used

Manual Review

Recommendations

Include a check in the _restart function to ensure ratePerSecond > 0.

Updates

Lead Judging Commences

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

Appeal created

0xbeastboy Submitter
9 months ago
inallhonesty Lead Judge
9 months ago
inallhonesty Lead Judge 9 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.