# Fewer than expected LP tokens if the pool is imbalanced during vault restoration

Notional's restoreVault always joins pools proportionally, so an imbalanced Curve/Balancer pool applies deposit penalties, returning fewer LP tokens and losing vault shareholder value.

- Payout: Contest reward
- Severity: high
- Program: Notional
- Credited: mstpr-brainbot
- Disclosed: 2023-10-09
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2023-10-notional-judging/issues/82
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-10-notional%3AH-4
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high tech:evm tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** SingleSidedLPVaultBase.restoreVault / Curve & Balancer pool joins
**Root cause:** restoreVault deposits all withdrawn tokens back into the pool in fixed proportional amounts regardless of current pool balance, so when the pool is imbalanced the join incurs Curve deposit penalties or internal-swap slippage instead of an optimal non-proportional deposit.
**Steps:**
1. Pool balanced at 1000 WETH / 1000 stETH; vault holds 100 WETH + 100 stETH after emergencyExit.
2. Pool becomes imbalanced (e.g. 540 WETH / 1260 stETH, 30/70).
3. Owner calls `restoreVault(minPoolClaim)`; code sets `amounts[i] = tokenBalance(tokens[i])` and calls `_joinPoolAndStake(amounts, minPoolClaim)` proportionally.
4. Curve `add_liquidity` computes `difference = |ideal_balance - new_balances[i]|` and charges `fees[i] = fee * difference / FEE_DENOMINATOR`, reducing minted LP tokens.
5. Vault receives fewer pool tokens than an optimal non-proportional deposit would yield; shareholder value lost.
**How found:** Code-reading of restoreVault's comment stating it joins proportionally; recognized that proportional join only minimizes slippage on a balanced pool, then modeled an imbalanced-pool scenario and traced Curve's add_liquidity fee/bonus math to confirm penalty.
**Exploitation:** Not attacker-driven; triggered by the vault owner calling restoreVault while the underlying Curve/Balancer pool is imbalanced (e.g. after a mass withdrawal or attack), causing the protocol to eat deposit penalties/slippage.
**Insight:** Proportional-join assumptions break when the pool can be externally imbalanced; check whether restore/reinvest paths hardcode proportional deposits and whether the pool's add_liquidity charges imbalance penalties (Curve difference-based fees) that a non-proportional or swap-then-join path would avoid.
