-
Notifications
You must be signed in to change notification settings - Fork 6
xiaoming90 - Partial liquidations are not possible #204
Comments
This is true. This is an issue when a vaultAccount is borrowing from the prime maturity, but not an issue when an account is borrowing from an fCash maturity. |
Escalate for 10 USDC We are able to set up a vault account in a way such that liquidating an amount equal or up to |
You've created a valid escalation for 10 USDC! To remove the escalation from consideration: Delete your comment. You may delete or edit your escalation comment anytime before the 48-hour escalation window closes. After that, the escalation becomes final. |
Agree with the escalation that this should be a high issue. |
Result: |
Escalations have been resolved successfully! Escalation status:
|
@0xleastwood + @xiaoming9090 : Verified. Fixed in PR notional-finance/contracts-v2#132 |
xiaoming90
high
Partial liquidations are not possible
Summary
Due to an incorrect implementation of
VaultValuation.getLiquidationFactors()
, Notional requires that a liquidator reduces an account's debt belowminBorrowSize
. This does not allow liquidators to partially liquidate a vault account into a healthy position and opens up the protocol to an edge case where an account is always ineligible for liquidation.Vulnerability Detail
While
VaultValuation.getLiquidationFactors()
might allow for the resultant outstanding debt to be below the minimum borrow amount and non-zero,deleverageAccount()
will revert due tocheckMinBorrow
being set totrue
. Therefore, the only option is for liquidators to wipe the outstanding debt entirely but users can set up their vault accounts such that thatmaxLiquidatorDepositLocal
is less than each of the vault currency's outstanding debt.https://github.com/sherlock-audit/2023-03-notional-0xleastwood/blob/main/contracts-v2/contracts/internal/vaults/VaultValuation.sol#L240-L270
If
depositUnderlyingInternal >= maxLiquidatorDepositLocal
, then the liquidator's deposit is capped tomaxLiquidatorDepositLocal
. However,maxLiquidatorDepositLocal
may put the vault account's outstanding debt below the minimum borrow amount but not to zero.However, because it is not possible to partially liquidate the account's debt, we reach a deadlock where it isn't possible to liquidate all outstanding debt and it also isn't possible to liquidate debt partially. So even though it may be possible to liquidate an account into a healthy position, the current implementation doesn't always allow for this to be true.
Impact
Certain vault positions will never be eligible for liquidation and hence Notional may be left with bad debt. Liquidity providers will lose funds as they must cover the shortfall for undercollateralised positions.
Code Snippet
https://github.com/sherlock-audit/2023-03-notional-0xleastwood/blob/main/contracts-v2/contracts/external/actions/VaultLiquidationAction.sol#L76-L82
https://github.com/sherlock-audit/2023-03-notional-0xleastwood/blob/main/contracts-v2/contracts/external/actions/VaultAccountHealth.sol#L260-L264
https://github.com/sherlock-audit/2023-03-notional-0xleastwood/blob/main/contracts-v2/contracts/internal/vaults/VaultValuation.sol#L240-L270
Tool used
Manual Review
Recommendation
VaultValuation.getLiquidationFactors()
must be updated to allow for partial liquidations.The text was updated successfully, but these errors were encountered: