Original vulnerabiliteis/impacts:
In pool.sol, fees(getCollectedFees) are inconsistently accounted in undeployedAssets valuation. As the fees is set aside for the pool owner, it shouldn’t be counted towards undeployedAssets to be withdrawn by users.
The original implementation only correctly subtracted fees from undeployedAssets in _getUndeployedAssets(). In other flows such as validateOffer, _reallocate, getCollectedFees is not subtracted from currentBalance and will be mistakenly included as transferrable assets, or affect the optimal range.
The mitigation is to factor in getCollectedFees in the undeployed asset calculation in various flows. In validateOffer(),_reallocate() and _reallocateOnWithdrawal(), getCollectedFees is now subtracted from currentBalance. This correctly factors in fees when accounting for the withdrawable amount or targetIdle calculations.
Lines of code
Vulnerability details
C4 Issue
M-09: Inconsistent accounting of undeployedAssets might result in undesired optimal range in the pool
Comments
Original vulnerabiliteis/impacts: In pool.sol, fees(getCollectedFees) are inconsistently accounted in undeployedAssets valuation. As the fees is set aside for the pool owner, it shouldn’t be counted towards undeployedAssets to be withdrawn by users.
The original implementation only correctly subtracted fees from undeployedAssets in _getUndeployedAssets(). In other flows such as validateOffer, _reallocate, getCollectedFees is not subtracted from currentBalance and will be mistakenly included as transferrable assets, or affect the optimal range.
Mitigation
Fix: https://github.com/pixeldaogg/florida-contracts/pull/375/files
The mitigation is to factor in
getCollectedFees
in the undeployed asset calculation in various flows. In validateOffer(),_reallocate() and _reallocateOnWithdrawal(), getCollectedFees is now subtracted from currentBalance. This correctly factors in fees when accounting for the withdrawable amount or targetIdle calculations.The mitigation resolves the issue.
Conclusion
LGTM