Submitted by 0xA5DF, also found by __141345__
liquidateClean doesnt check that the amount of shares the liquidator repays are covered by the collateral available, if the user repays more shares than (equally worth) collateral available - hell get only the amount of collateral available.
Liquidator might end up paying assets that are worth much more than the collateral hes received.
Even though its also the liquidators responsibility to check that theres enough collateral available, mistakes are commonly done (wrong calculation, typos, deadline too large) and the protocol should prevent those kinds of errors if possible.
Otherwise users might lose trust in the protocol when they lose their funds due to errors.
The following test was added to src/test/e2e/LiquidationPairTest.sol.
In this scenario the user ends up with collateral thats worth only 1/3 of the asset-tokens he paid.
Output:
Check that the shares intended to be repaid are worth the collateral + fee, if not reduce the amount of shares to be repaid accordingly.
DrakeEvans (Frax) acknowledged, but disagreed with severity and commented:
gititGoro (judge) commented:
