Submitted by oakcobalt, also found by bin2chen
undeployedAssets is calculated inconsistently. Currently in _getUndeployedAssets() the protocol collected fees are subtracted; however, in validateOffer, the protocol collected fees are not subtracted.
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/pools/Pool.sol#L398
Note that in (2), undeployedAssets are inflated because getCollectedFees are fees protocol collected from liquidation/repayment flows and shouldnt be considered as liquid assets to cover the loan principal amount.
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/pools/Pool.sol#L572
Inconsistent accounting in various flows may result in incorrect checks or undesirable optimal ranges.
Account for getCollectedFees in (2) and (3), noted above.
0xend (Gondi) confirmed
Gondi mitigated:
Status: Mitigation confirmed. Full details in reports from oakcobalt and minhquanym.
