# Rounding error when closing quote

Partial closeQuote with tiny filledAmount rounds locked-value reduction to zero, leaving locked balance unchanged and accumulating over many small closes.

- Payout: Contest reward
- Severity: medium
- Program: Symmetrical
- Credited: mstpr-brainbot
- Disclosed: 2023-06-05
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2023-06-symmetrical-judging/issues/251
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-06-symmetrical%3AM-19
- Tags: domain:web3 impact:funds-loss kind:contest platform:sherlock sev:medium tech:solidity technique:source-review vuln:accounting-error vuln:precision-loss

**Target:** symmio-core LibQuote.closeQuote / fillCloseRequest
**Root cause:** Locked-value reduction computes (lockedValues.cva * filledAmount) / quoteOpenAmount; when filledAmount is small relative to open amount the division truncates to zero, so lockedValues never decreases.
**Steps:**
1. Open a quote with non-trivial lockedValues (cva/mm/lf) and quantity.
2. Repeatedly call fillCloseRequest with a very small filledAmount such that lockedValues.cva * filledAmount < quoteOpenAmount(quote).
3. Observe each closeQuote computes reduction = 0, so quote.lockedValues and account lockedBalances stay unchanged.
4. Accumulate many partial closes; locked balance remains higher than expected, reducing withdrawable available balance.
**How found:** Code review of closeQuote arithmetic: noticed multiplication-before-division can truncate to zero when filledAmount is small versus quoteOpenAmount, and that forceClose/emergencyClose checks don't apply to partial fillCloseRequest.
**Exploitation:** Trader performs many tiny partial closes; each close reduces position but not locked values, silently inflating locked balance and shrinking available/withdrawable funds over time.
**Insight:** In partial-close accounting, check whether per-close proportional reductions can truncate to zero for small fill amounts; force-close invariant checks don't protect the arbitrary-filledAmount partial path.
