Closed sherlock-admin closed 1 year ago
hack3r-0m
medium
block.timestamp
loss of precision while diving block.timestamp due to runding towards 0
uint256 timeKey = block.timestamp / divisor;
if divisor > 1e9 then this value is always 0, if divisor > 1e8 then this value is always 1
such rounding can lead to loss of precision and incrementing same key slot again and again
https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/market/MarketUtils.sol#L542
Manual Review
add bounds for possible values of divisor or apply precision
hack3r-0m
medium
loss of precision while diving
block.timestamp
due to runding towards 0Summary
loss of precision while diving
block.timestamp
due to runding towards 0Vulnerability Detail
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
https://github.com/sherlock-audit/2023-02-gmx/blob/main/gmx-synthetics/contracts/market/MarketUtils.sol#L542
Tool used
Manual Review
Recommendation
add bounds for possible values of divisor or apply precision