hack3r-0m - loss of precision while diving `block.timestamp` due to runding towards 0
Closed this issue · 0 comments
sherlock-admin commented
hack3r-0m
medium
loss of precision while diving block.timestamp
due to runding towards 0
Summary
loss of precision while diving block.timestamp
due to runding towards 0
Vulnerability Detail
uint256 timeKey = block.timestamp / divisor;
if divisor > 1e9 then this value is always 0, if divisor > 1e8 then this value is always 1
Impact
such rounding can lead to loss of precision and incrementing same key slot again and again
Code Snippet
Tool used
Manual Review
Recommendation
add bounds for possible values of divisor or apply precision