The Sablier protocol uses a 40-bit unsigned integer (uint40
) to store snapshot timestamps in its Stream struct, which tracks when stream states were last updated. This timestamp is crucial for calculating streaming debt and managing token flow rates. Each time a stream is modified (adjusted, paused, or withdrawn from), the current block.timestamp
is stored in this field, making it a fundamental component of the protocol's time-based accounting system.
The snapshot time resolution issue in Sablier revolves around using uint40
for storing snapshot timestamps:
A uint40
can store values up to 2^40 - 1 (approximately 1.1 trillion). For Unix timestamps, this means storage until around year 2034. After this, timestamp storage will overflow, causing timestamp-dependent calculations to break and potentially corrupting stream states.
The issue isn't apparent now but creates a protocol-wide expiration date which should be addressed for long-term protocol viability.
After the year 2034 (approximately), the uint40
snapshotTime will overflow, causing catastrophic failure in stream calculations. Any streams active during this overflow will have incorrect debt calculations, leading to wrong withdrawal amounts and potentially locked funds. This isn't just a stream-specific issue - it represents a protocol-wide failure point where all active streams would simultaneously malfunction when timestamps can no longer be stored accurately in the uint40 field, effectively creating a "time bomb" in the protocol's core functionality.
Using uint64
provides storage until year ~292 billion, effectively removing the timestamp overflow concern while only marginally increasing gas costs. The migration function allows upgrading existing streams' timestamps safely.
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.