# `CuratedVaultSetters::_supplyPool()` does not consider the pool cap of the underlying pool, which may cause `deposit()` to revert or lead to an unintended reordering of `supplyQueue`

CuratedVault._supplyPool ignores the underlying pool's supplyCap, so deposits revert or get misallocated across the supplyQueue despite available capacity.

- Payout: Audit contest
- Severity: medium
- Program: New Scope
- Found by: Bigsam
- Disclosed: 2024-06-27
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2024-06-new-scope-judging/issues/433
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-06-new-scope%3AM-12
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic vuln:dos

**Target:** CuratedVault / CuratedVaultSetters._supplyPool (ERC4626 vault over lending pools)
**Root cause:** _supplyPool computes toSupply from only the curated vault's config[pool].cap, not the underlying pool's reserve supplyCap; the pool.supplySimple call is wrapped in try/catch so cap-exceeding supplies silently revert and the loop skips the pool.
**Steps:**
1. Deploy curated vault with two pools in supplyQueue, each underlying pool supplyCap=100e18, each already at 99e18 from other depositors.
2. Set curated vault config[pool].cap >= 2e18 for both pools.
3. User calls deposit(2e18) on the curated vault.
4. _supplyPool computes toSupply=2e18 for pool 1; pool.supplySimple reverts on SUPPLY_CAP_EXCEEDED, caught by try/catch, assets unchanged.
5. Same for pool 2; loop ends with assets!=0 and reverts CuratedErrorsLib.AllCapsReached().
6. Alternatively with a smaller deposit, the first pool is skipped and liquidity lands in the next pool, reordering supplyQueue.
**How found:** Code review of _supplyPool: noticed toSupply only uses config[pool].cap and that supplySimple is wrapped in try/catch, then compared against the underlying pool's validateSupply cap check to spot the mismatch.
**Exploitation:** No attacker profit; griefing/DoS of deposit() and misallocation of liquidity. Precondition: underlying pools near their own supplyCap from external deposits while curated vault cap still allows more.
**Insight:** When a vault aggregates multiple lending pools, always reconcile the vault-level per-pool cap against the underlying pool's own reserve supplyCap (which counts all depositors, not just the vault); a try/catch around supply() hides cap-exceeded reverts and silently skips pools, so cap math must be done before the call.

