# Vault accounts with excess cash can avoid being settled

Notional vault settlement transfers out excess cash then reverts on collateral check, deadlocking liquidation so risky vault accounts can never be deleveraged.

- 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/207
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-03-notional%3AH-11
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:high tech:solidity technique:source-review vuln:accounting-error vuln:business-logic vuln:liquidation

**Target:** VaultAccountAction.settleVaultAccount / VaultLiquidationAction._authenticateDeleverage
**Root cause:** settleVaultAccount transfers excess cash out then calls checkVaultAccountCollateralRatio which reverts if the account becomes unhealthy, while _authenticateDeleverage requires the vault be settled before any liquidation, creating a deadlock.
**Steps:**
1. Create vault account with small secondary cash and most debt in primary currency, healthy overall.
2. Call `settleVaultAccount(account, vault)`; excess secondary cash is transferred out (didTransfer=true).
3. `checkVaultAccountCollateralRatio` now reverts because account is undercollateralized.
4. Attempt `deleverageAccount` or `liquidateVaultCashBalance`; `_authenticateDeleverage` reverts with `Must Settle` since maturity not reached.
5. Account cannot be settled nor liquidated, accruing bad debt.
**How found:** Code reading of settleVaultAccount's conditional collateral check combined with _authenticateDeleverage's 'Must Settle' requirement; noticed the two preconditions are mutually unsatisfiable for accounts with excess cash in one currency.
**Exploitation:** Sophisticated vault account self-arranges excess cash in one currency and debt in another so settlement always reverts the collateral check, permanently blocking liquidators from purchasing vault shares or offsetting debt.
**Insight:** When a settlement/cleanup path performs a health check after moving funds, and liquidation paths require prior settlement, look for accounts that can be pushed into a state where settlement reverts but liquidation is gated on settlement — a mutual-exclusion deadlock.
