<!-- canonical: https://0xsimao.com/findings/mitosis-redeem-correctly-queue-enabled -->

# BasicVault::_redeem() does not correctly deal with a disabled redeem queue after it was enabled

Medium · Three Sigma · Cross-chain liquidity layer 1 · 25th June, 2024

Finding 3S-Mitosis-M05 of the Mitosis security review.

- Protocol: https://mitosis.org/
- Report: /reports/mitosis
- Source: https://cdn.sanity.io/files/qoqld077/production/b6b3bd7bb47407d99e76abb7c6dc615c1db5018e.pdf

---

### Description

BasicVault::_redeem() only calls BasicVault::_resolveWithIdleBalance() when the
redeem queue is enabled, but it should also do it when it is disabled as not enough assets
may have been reserved. Additionally, when the redeem queue is disabled, it only checks
the balance of the contract, not the _idleBalance(), as amounts may have been reserved
to fulfill requests.

### Recommendation

```solidity
... _resolveWithIdleBalance($v2, asset_);
if ($v2.redeemQueueEnabled) {
    uint256 requestId = $v2.redeemQueue.push(_msgSender(), amount);
    emit RedeemQueued(receiver, address(asset_), requestId);
} else {
    if (_idleBalance($v2, asset_) < newAmount)
    revert("You're unable to redeem your assets now. Please try again later.");
    asset_.safeTransfer(receiver, newAmount);
}
...
```

### Status

Addressed in [#cfd54e5](https://github.com/mitosis-org/evm/pull/188/commits/cfd54e585cdbb5825454f561ffc234481bb4357c), [#f379467](https://github.com/mitosis-org/evm/pull/223/commits/f37946742224cd3d37f1947ede1c8805b2d314b0).

---

Related findings:

- [CurveAddLiquidityAssetManager::curveAddLiquidity() does not deal correctly with isLegacy = 0b10 and ETH](https://0xsimao.com/findings/singularity-curve-legacy-0b10-eth): Singularity
- [Queue MapleWithdrawalManager may revert due to honest removeShares() or manual redeem calls](https://0xsimao.com/findings/maple-finance-ii-queue-withdrawal-shares-redeem): Maple Withdrawal Manager
- [Incorrect `ERC4626ExceededMaxRedeem` event on `ManagedLeveragedVault.sol:: cancelWithdrawalIntent()`](https://0xsimao.com/findings/beraborrow-i-erc4626-exceeded-redeem-withdrawal): Beraborrow Managed Dens
- [Admin new issuance or user calling `Vault::redeemExpiredLv()` after `Psm::redeemWithCt()` will lead to stuck funds when trying to withdraw](https://0xsimao.com/findings/cork-protocol-issuance-redeem-stuck-withdraw): Cork Protocol
