repayBadDebtWithReserves()
function breaks the core invariant.
One of the core invariant of this protocol is:
exchange rate cannot change from calling functions repayBadDebtWithCash, repayBadDebtWithReserves, or fixUser.
But this invariant doesn't hold true when calling repayBadDebtWithReserves()
.
The exchange rate is defined as:
In case of calling fixUser()
function,
Here, totalBorrows
is subtracted by principal
amount which will change the exchange rate
but badDebt
is also increased by the same principal
amount which will balance the exchange rate
.
But, let's look at repayBadDebtWithReserves()
function:
Here, totalReserves
is subtracted by some subtractAmount
and badDebt
is also subtracted by the same amount. For the subtraction of totalReserves
and badDebt
by some amount, there is no equivalent addition of the subtraction amount. This will decrease the exchange rate and thus breaking the core invariant.
This issue breaks one of the core invariant of the protocol. Sudden change of exchange rate will hamper the current market with healthy users and it will be unfair to the current holders of the mTokens.
Manual Analysis
Decreasing the totalSupply()
by the equivalent amount will balance the exchange rate.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.