<!-- canonical: https://0xsimao.com/findings/mitosis-cap-epoch-add-stale -->

# Cap::setEpochCap() may add a stale cap

Low/Info · Three Sigma · Cross-chain liquidity layer 1 · 25th June, 2024

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

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

---

### Description

Cap::setEpochCap() reverts when nextCap < $.cap[i], allowing the next cap to be equal
to the current cap, which does not seem intended according to the error reason 'cap should
be greater than previous cap'.

### Recommendation

Replace the inequality check with less or equal to.

### Status

Addressed in [#ef1aa9a](https://github.com/mitosis-org/evm/pull/200/commits/ef1aa9a7c8524b074f0522d7d41011b55dda2431).

---

Related findings:

- [`ManagedLeveragedVault::executeWithdrawalEpoch()` will never work because `cd.prevICR` is not set](https://0xsimao.com/findings/beraborrow-i-withdrawal-epoch-prev-icr): Beraborrow Managed Dens
- [_addLiquidity() slippage is incorrectly set](https://0xsimao.com/findings/singularity-add-liquidity-slippage-incorrectly): Singularity
