https://github.com/Cyfrin/2024-10-sablier/blob/8a2eac7a916080f2022527408b004578b21c51d0/src/SablierFlow.sol#L367
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.
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.
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.
Manual Review
Include a check in the _restart
function to ensure ratePerSecond > 0
.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.