MEDIUM severity: The vulnerability allows users to create vault positions that are ineligible for liquidation. This o. The vulnerability allows users to create vault positions that are ineligible for liquidation. This occurs when a user self-liquidates their secondary debt holdings in a way that makes it impossible to deleverage their vault account. The `checkMinBorrow` function will fail post-maturity, preventing t...

Vulnerable code:
```\nFile: VaultLiquidationAction.sol\n\nfunction deleverageAccount(\n    address account,\n    address vault,\n    address liquidator,\n    uint16 currencyIndex,\n    int256 depositUnderlyingInternal\n) external payable nonReentrant override returns (\n    uint256 vaultSharesToLiquidator,\n    int256 depositAmountPrimeCash\n) {\n    require(currencyIndex < 3);\n\n    (\n        VaultConfig memory vaultConfig,\n        VaultAccount memory vaultAccount,\n        VaultState memory vaultState\n    ) = _authenticateDeleverage(account, vault, liquidator);\n\n    PrimeRate memory pr;\n    (\n        depositUnderlyingInternal,\n        vaultSharesToLiquidator,\n        pr\n    ) = IVaultAccountHealth(address(this)).calculateDepositAmountInDeleverage(\n        currencyIndex,\n        vaultAccount,\n        vaultConfig,\n        vaultState,\n        depositUnderlyingInternal\n    );\n\n    uint16 currencyId = vaultConfig.borrowCurrencyId;\n    if (currencyIndex == 1) {\n        currencyId = vaultConfig.secondaryBorrowCurrencies[0];\n    } else if (currencyIndex == 2) {\n        currencyId = vaultConfig.secondaryBorrowCurrencies[1];\n    }\n\n    Token memory token = TokenHandler.getUnderlyingToken(currencyId);\n    (\n        /* */,\n        depositAmountPrimeCash\n    ) = TokenHandler.depositUnderlyingExternal(\n        liquidator,\n        currencyId,\n        token.convertToExternal(depositUnderlyingInternal),\n        pr,\n        false\n    );\n\n    vaultAccount.vaultShares = vaultAccount.vaultShares.sub(vaultSharesToLiquidator);\n    if (vaultAccount.maturity == Constants.PRIME_CASH_VAULT_MATURITY) {\n        _reduceAccountDebt(\n            vaultConfig,\n            vaultState,\n            vaultAccount,\n            pr,\n            currencyIndex,\n            depositUnderlyingInternal,\n            true\n        );\n        depositAmountPrimeCash = 0;\n    }\n\n    vaultAccount.setVaultAccountForLiquidation(\n        vaultConfig,\n        currencyIndex,\n        depositAmountPrimeCash,\n        true\n    );\n\n    emit VaultDeleverageAccount(\n        vault,\n        account,\n        currencyId,\n        vaultSharesToLiquidator,\n        depositAmountPrimeCash\n    );\n    emit VaultLiquidatorProfit(\n        vault,\n        account,\n        liquidator,\n        vaultSharesToLiquidator,\n        true\n    );\n\n    _transferVaultSharesToLiquidator(\n        liquidator,\n        vaultConfig,\n        vaultSharesToLiquidator,\n        vault\n```\n```\nFile: VaultLiquidationAction.sol\n\nfunction _reduceAccountDebt(\n    VaultConfig memory vaultConfig,\n    VaultState memory vaultState,\n    VaultAccount memory vaultAccount,\n    PrimeRate memory primeRate,\n    uint256 currencyIndex,\n    int256 depositUnderlyingInternal,\n    bool checkMinBorrow\n) private {\n    if (currencyIndex == 0) {\n        vaultAccount.updateAccountDebt(vaultState, depositUnderlyingInternal, 0);\n        vaultState.setVaultState(vaultConfig);\n    } else {\n        // Only set one of the prime rates, the other prime rate is not used since\n        // the net debt amount is set to zero\n        PrimeRate[2] memory pr;\n        pr[currencyIndex - 1] = primeRate;\n\n        VaultSecondaryBorrow.updateAccountSecondaryDebt(\n            vaultConfig,\n            vaultAccount.account,\n            vaultAccount.maturity,\n            currencyIndex == 1? depositUnderlyingInternal : 0,\n            currencyIndex == 2? depositUnderlyingInternal : 0,\n            pr,\n            checkMinBorrow\n        );\n    }\n}\n```\n```\nFile: VaultSecondaryBorrow.sol\n\nif (checkMinBorrow) {\n    require(accountDebtOne == 0 || vaultConfig.minAccountSecondaryBorrow[0] <= -accountDebtOne, "min borrow");\n    require(accountDebtTwo == 0 || vaultConfig.minAccountSecondaryBorrow[1] <= -accountDebtTwo, "min borrow");\n}\n```