Submitted by Satyam_Sharma
Accrued liquidity can be lost and never be recovered for a given tick period due to not incrementing
tickTrackingIndex, which sets the tick end timestamp to nextweek and will start accruing liquidity for next tick period.
LiquidityMining.accrueConcentratedPositionTimeWeightedLiquidity sets tickActiveEnd = nextWeek and doesnt increment tickTrackingIndex, which makes current tick period to end by setting tickActiveEnd = nextWeek and moves to next tick period without incrementing tickTrackingIndex. When tick is no longer active that is tickTracking.exitTimestamp < nextWeek, it means tickTracking.exitTimestamp should be strictly less than the nextWeek to set tickActiveEnd = tickTracking.exitTimestamp and then calculate dt based on the tickActiveStart and tickActiveEnd values.
Now the issue here, is with the if statement; if (tickTracking.exitTimestamp < nextWeek) calculates dt if
exitTimestamp is strictly lesser than the nextWeek. Suppose there is a condition in which user exitTimestamp = nextWeek i.e.; user exits the concentrated liquidity position with some X poolIdx with the nextWeek timestamp. Meaning when the nextWeek is about to end, the user triggers an exit and as soon as the exit triggers, this if statement will revert and tickTrackingIndex will not be incremented for that user or poolId. tickTrackingIndexAccruedUpTo_[poolIdx][posKey][i] and therefore, the accrued concentrated liquidity might be lost for a given tick period and will never be recovered due to setting tickActiveEnd = nextWeek in the else statement; which will declare the tick end and move to the next tick period to accrued liquidity .
Edit the if statement for exitTimestamp, which increments tickTrackingIndex when tickTracking.exitTimestamp == nextWeek:
Error
141345 (lookout) commented:
OpenCoreCH (Canto) confirmed and commented:
LSDan (judge) decreased severity to Medium
Note: for full discussion, see here.
