The createWithTimestamps function allows for the creation of a tranched stream with user-specified timestamps. However, there is no mechanism in place to prevent users from inputting timestamps from the past. This could lead to immediate vesting of tranches that are intended to be vested in the future, allowing recipients to withdraw all the vested funds at once, contrary to the sender's intentions.
A sender creates a stream with multiple tranches, each with a timestamp meant to represent future vesting dates. However, by setting one or more tranche timestamps to a date in the past, the recipient can immediately access the funds associated with those tranches upon stream creation.
This issue could result in the sender's funds being released earlier than intended, potentially leading to financial loss or disputes. It also undermines the protocol's purpose of providing a secure time-release payment mechanism.
Manual review
To prevent users from inputting past timestamps, we can add validation checks in the createWithTimestamps function. These checks ensure that all provided timestamps are in the future relative to the current block timestamp.
Here is a modified createWithTimestamps function
The changes are:
The line require(params.tranches[i].timestamp > block.timestamp, "Tranche timestamp must be in the future"); ensures that each tranche's timestamp is in the future relative to the current block timestamp.
This check is inside a loop that iterates over all tranches to ensure that every single tranche timestamp is validated.
The line if (i > 0) { require(params.tranches[i].timestamp > params.tranches[i - 1].timestamp, "Tranches are not ordered"); } ensures that the tranches are in chronological order, preventing any past timestamps relative to each other.
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.