getFeeGrowthInside
can incorrectly return zero because of fee growth underflow
#26
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
insufficient quality report
This report is not of sufficient quality
🤖_primary
AI based primary recommendation
Lines of code
https://github.com/code-423n4/2024-10-ramses-exchange/blob/236e9e9e0cf452828ab82620b6c36c1e6c7bb441/contracts/CL/core/libraries/Tick.sol#L40-L77
Vulnerability details
Proof of Concept
When operations need to calculate Uniswap V3 position's fee growth, it used similar function implemented by uniswap v3.
However, according to this known issue, The contract is implicitly relies on underflow/overflow when calculating the fee growth, if underflow is prevented, some operations that rely on fee growth will revert.
This could impact crucial operation that rely on this call, such as liquidation, could revert unexpectedly. This behavior is quite often especially for pools that use lower fee.
Impact
some user transactions will revert.
Recommended Mitigation Steps
Use unchecked when calculating
feeGrowthInside0X128
andfeeGrowthInside1X128
.Assessed type
Under/Overflow
The text was updated successfully, but these errors were encountered: