# Bad debt may persist even after complete liquidation in Velo Vault due to truncation

Velo Vault prices collateral per-NFT vs summed, so truncation makes proposedLiquidationAmount < totalUserCollateral, leaving bad debt uncleared after full liquidation.

- Payout: Contest reward
- Severity: medium
- Program: Isomorph
- Credited: 0x52
- Disclosed: 2022-11-05
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2022-11-isomorph-judging/issues/174
- Library page: https://bugbountylibrary.com/r/sherlock%3A2022-11-isomorph%3AM-9
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:liquidation vuln:precision-loss

**Target:** Vault_Velo.sol liquidation logic
**Root cause:** totalCollateralValue sums pooled tokens then prices once, while _calculateProposedReturnedCapital prices each NFT individually, truncating up to NFT_LIMIT times; the bad-debt-clearing check compares these mismatched valuations.
**Steps:**
1. User holds 2 collateral NFTs valued 10.6 and 10.7 (pre-truncation).
2. totalCollateralValue: (10.6+10.7)=21.3 -> 21.
3. _calculateProposedReturnedCapital: 10.6->10, 10.7->10, sum=20.
4. Liquidator takes all collateral; proposedLiquidationAmount(20) < totalUserCollateral(21), so `if(proposedLiquidationAmount >= totalUserCollateral)` fails and bad debt is not cleared.
**How found:** Code-reading comparison of two valuation functions: noticed one sums pooled tokens before pricing while the other prices each NFT then sums, and reasoned truncation yields divergent results for identical inputs.
**Insight:** When a protocol has two code paths computing the 'same' value, check whether rounding/truncation happens before or after aggregation—mismatched order creates exploitable inequality at boundary checks.
