Obedient Lava Monkey
Medium
Incorrect adjustment of outstandingDebt
in GHO repayment logic leads to protocol accounting inaccuracies.
Inaccurate subtraction of the accrued interest (accruedInterest - actualDebtToLiquidate
) from outstandingDebt
in _burnDebtTokens
will cause accounting errors for the protocol, as the remaining bad debt is miscalculated. This occurs when the actualDebtToLiquidate
is less than the accrued interest during a liquidation involving GHO.
In _burnDebtTokens, specifically [line where subtraction occurs], outstandingDebt -= amountToBurn
is misapplied, causing inaccurate bad debt tracking. The root cause of the bug lies in the miscalculation of outstandingDebt
during GHO liquidation. Specifically, when the accrued interest (accruedInterest
) exceeds the amount being repaid (actualDebtToLiquidate
), the code subtracts the difference (amountToBurn
) from outstandingDebt
. This logic fails to account for scenarios where the residual interest should not affect the tracked bad debt, resulting in inaccurate deficit accounting. The protocol's bad debt metrics become unreliable, potentially misallocating resources for recovery or treasury management.
- User has an outstanding GHO debt and accrued interest.
- Liquidation partially covers the debt but leaves residual interest greater than the debt repaid.
- GHO asset configuration must permit liquidation under the existing conditions.
- Liquidation thresholds and health factors trigger the liquidation.
- Liquidator initiates a liquidation call.
- Partial repayment leads to execution of
_burnDebtTokens
. - The subtraction misapplies the interest adjustment, inflating or deflating
outstandingDebt
.
The protocol suffers inaccurate bad debt tracking, affecting deficit recovery and potentially misallocating treasury resources.
Update the logic in _burnDebtTokens
to properly account for remaining interest and ensure outstandingDebt
reflects the correct post-liquidation balance.