Closed sherlock-admin closed 2 years ago
nalus
high
Since _duration's upper limit maxLockDuration is uint256, casting it to uint(64) can result in overflow and saving the wrong duration in depositsOf.
Overflow can cause the wrong duration to be saved in the storage and consequentially wrong balance.
https://github.com/Merit-Circle/merit-liquidity-mining/blob/ce5feaae19126079d309ac8dd9a81372648437f1/contracts/TimeLockPool.sol#L102
https://github.com/Merit-Circle/merit-liquidity-mining/blob/ce5feaae19126079d309ac8dd9a81372648437f1/contracts/TimeLockPool.sol#L182
VS code and me
Add a condition which checks that uint64(block.timestamp) + duration <= type(uint64).max
Duplicate of #66
nalus
high
Duration overflow
Summary
Since _duration's upper limit maxLockDuration is uint256, casting it to uint(64) can result in overflow and saving the wrong duration in depositsOf.
Impact
Overflow can cause the wrong duration to be saved in the storage and consequentially wrong balance.
Code Snippet
https://github.com/Merit-Circle/merit-liquidity-mining/blob/ce5feaae19126079d309ac8dd9a81372648437f1/contracts/TimeLockPool.sol#L102
https://github.com/Merit-Circle/merit-liquidity-mining/blob/ce5feaae19126079d309ac8dd9a81372648437f1/contracts/TimeLockPool.sol#L182
Tool used
VS code and me
Recommendation
Add a condition which checks that uint64(block.timestamp) + duration <= type(uint64).max
Duplicate of #66