# All transactions to claim assets from the vault will revert in some situations due to double subtraction of the claimed assets in market position allocations calculation.

Perennial V2 vault double-subtracts claimed assets in market position allocation, causing claim transactions to revert and temporarily lock funds when a market hits minPosition.

- Payout: Contest reward
- Severity: medium
- Program: Perennial V2 3
- Credited: panprog
- Disclosed: 2024-02-28
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-02-perennial-v2-3-judging/issues/11
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-02-perennial-v2-3%3AM-4
- Tags: domain:web3 impact:dos impact:funds-loss kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:business-logic

**Target:** Perennial V2 vault smart contract (Vault.sol, StrategyLib.sol)
**Root cause:** In _ineligable, withdrawal is added to ineligible assets, and then assets = collateral - ineligable, effectively subtracting withdrawal twice from total assets. This can push assets below minAssets and revert.
**Steps:**
1. Deploy vault with a market; deposit funds and open positions.
2. User redeems half of shares via `vault.update(user, 0, half, 0)`.
3. Another user deposits small amount via `vault.update(user2, smallDeposit, 0, 0)` creating a min position in the market.
4. User attempts to claim redeemed assets via `vault.update(user, 0, 0, half)`; transaction reverts due to `StrategyLibInsufficientAssetsError`.
**How found:** Code review of Vault.update and StrategyLib._ineligable revealed that withdrawal is added to ineligible assets and also subtracted from collateral, leading to double subtraction in assets calculation.
**Exploitation:** Not an attack; a logic bug causing denial of service for all users trying to claim redeemed assets when a market's position is at minPosition due to skew.
**Insight:** When auditing vault share accounting, trace every variable through both collateral and ineligible asset calculations to catch double-counting; pay attention to how minPosition constraints in integrated markets can turn accounting errors into claim reverts.
