# Partial liquidations are not possible

Notional's VaultValuation forces full liquidation when deposit exceeds maxLiquidatorDeposit, so prime-maturity vaults with debt above minBorrowSize become unliquidatable, accruing bad debt.

- Payout: Contest reward
- Severity: high
- Program: Notional
- Credited: xiaoming90 + 0xleastwood
- Disclosed: 2023-03-09
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2023-03-notional-judging/issues/204
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-10
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:business-logic vuln:liquidation

**Target:** VaultValuation.getLiquidationFactors / VaultLiquidationAction.deleverageAccount
**Root cause:** getLiquidationFactors caps deposit to maxLiquidatorDepositLocal but then requires post-liquidation debt < minBorrowSize, so any partial liquidation leaving debt >= minBorrowSize reverts via checkMinBorrow.
**Steps:**
1. Set up a prime-maturity vault account whose per-currency debt exceeds maxLiquidatorDepositLocal and where maxLiquidatorDepositLocal leaves residual debt >= minBorrowSize.
2. Make the account undercollateralized so liquidation is warranted.
3. Call deleverageAccount with depositUnderlyingInternal >= maxLiquidatorDepositLocal; deposit is capped to maxLiquidatorDepositLocal.
4. Observe require(debtOutstanding - deposit < minBorrowSize) fails with 'Must Liquidate All Debt'.
5. Attempting full wipe is impossible since maxLiquidatorDepositLocal < outstanding debt -> deadlock, no liquidation possible.
**How found:** Code reading of getLiquidationFactors: noticed the branch capping deposit to maxLiquidatorDepositLocal still enforces the minBorrowSize require, and reasoned that capping can leave residual debt above minBorrowSize, making both full and partial liquidation impossible.
**Exploitation:** Attacker/borrower opens a prime vault position sized so that maxLiquidatorDepositLocal cannot clear debt and partial liquidation reverts; when undercollateralized, no liquidator can act, leaving bad debt for LPs.
**Insight:** When a liquidation path caps the repay amount, check whether the post-cap residual still satisfies downstream min-size invariants; a cap combined with a min-borrow require can create an unliquidatable deadlock zone.
