Submitted by hickuphh3
The fee growth mechanism, and by extension, secondsPerLiquidity mechanism of Uniswap V3 has the ability to underflow. It is therefore a necessity for the math to (ironically) be unsafe / unchecked.
Assume the following scenario and initial conditions:
We therefore have negative feeGrowthInside.
This behaviour is actually acceptable, because the important thing about this mechanism is the relative values to each other, not the absolute values themselves.
rangeFeeGrowth() and rangeSecondsInside() has to be unchecked. In addition, the subtraction of feeGrowthInside values should also be unchecked in _updatePosition() and ConcentratedLiquidityPosition#collect().
The same also applies for the subtraction of pool.rangeSecondsInside and stake.secondsInsideLast in claimReward() and getReward() of the ConcentratedLiquidityPoolManager contract.
sarangparikh22 (Sushi) disputed:
alcueca (judge) commented:
sarangparikh22 (Sushi) confirmed:
