The SablierV2 contracts employ casting of block.timestamp to uint40, which can significantly reduce the lifespan of the contract due to the limited range of the uint40 type. This report identifies the specific instances where this casting occurs and provides recommendations to avoid potential future functionality issues.
The vulnerability is due to casting block.timestamp to uint40 in various parts of the SablierV2 contracts. The uint40 type can hold values up to (2^{40} - 1), which is significantly smaller than the range of uint256 used by block.timestamp. This casting can lead to overflow issues once the block timestamp exceeds the maximum value uint40 can hold, potentially causing incorrect behavior or failures.
The specific instances of this issue are as follows:
SablierV2LockupDynamic.sol
SablierV2LockupLinear.sol
SablierV2LockupTranched.sol
Casting block.timestamp to uint40 can lead to overflow issues once the block timestamp exceeds the maximum value that uint40 can hold. This can cause:
Incorrect time calculations and logic errors.
Potential failures in contract execution.
Reduced lifespan and reliability of the contract.
Manual code review
Remove Casting to uint40: Avoid casting block.timestamp to uint40 and use uint256 directly to store timestamps.
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.