0x73696d616f - Liquidating maturies with unassigned earnings will not take into account floating assets increase leading to loss of funds #64
Labels
Medium
A Medium severity issue.
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Won't Fix
The sponsor confirmed this issue will not be fixed
0x73696d616f
Medium
Liquidating maturies with unassigned earnings will not take into account floating assets increase leading to loss of funds
Summary
Market::liquidate()
calculates the amount to liquidate inAuditor::checkLiquidation()
, which does not take into account floating assets accrual due to unassigned earnings inMarket::noTransferRepayAtMaturity()
. Thus, it will underestimate the collateral a certain account has and liquidate less than it should, either giving these funds to the liquidatee or in case the debt is bigger than the collateral, leave this extra untracked collateral in the account which will not enableclearBadDebt()
to work.Root Cause
In
Auditor::checkLiquidation()
, the collateral is computed just by looking at the shares of an account, without taking into account maturities accruing unassigned earnings.In
Market::noTransferRepayAtMaturity()
, maturities are repaid and floating assets are increased due to backup earnings.Thus, when it seizes the collateral, it will seize at most the collateral without taking into account the new amount due to the floating assets sudden increase, as
Auditor::checkLiquidation()
is called prior the floating assets increase.Internal pre-conditions
External pre-conditions
None.
Attack Path
Impact
If the user has less debt than collateral but the debt would require most of its collateral, it would not be possible to seize it all. If the user has more debt than collateral a portion of the collateral will be leftover which will not allow bad debt to be cleared right away via
clearBadDebt()
and stays accruing.PoC
Add the following test to
Market.t.sol
, confirming that the user should have all its collateral seized given that debt > collateral but some collateral remains due to the increase in floating assets.Mitigation
Auditor::checkLiquidation()
should compute the increase in collateral by previewing the floating assets increase due to accrued unassigned earnings in a fixed pool or instead of increasing floating assets these earnings could increase the earnings accumulator.The text was updated successfully, but these errors were encountered: