# FOK orders wrongly revert on dust residual amounts below lot size

CLOB FOK orders revert when residual unmatched amount is below lotSizeInBase, breaking multi-hop swaps where Uniswap output can't match lot size.

- Payout: Contest reward
- Severity: medium
- Program: GTE
- Credited: montecristo
- Disclosed: 2026-02-05
- Write-up quality: 6/10
- Original: https://code4rena.com/reports/2025-07-gte-spot-clob-and-router#m-02
- Library page: https://bugbountylibrary.com/r/c4%3A2025-07-gte-spot-clob-and-router%3AM-02
- Tags: domain:web3 impact:dos kind:contest platform:code4rena sev:medium tech:evm tech:solidity vuln:accounting-error vuln:business-logic

**Target:** CLOB.sol fill order matching / GTERouter multi-hop swap
**Root cause:** FOK check reverts whenever newOrder.amount > 0, ignoring that amounts below lotSizeInBase are dust that should be rounded off per documented behavior.
**Steps:**
1. Set lotSizeInBase = 1e6.
2. Case 1: limit ask amountInBase=1e18 price=3000e6; FOK bid amountInBase=1e18-1. After matching, newOrder.amount = 1e6-1 > 0, reverts at `if (args.fillOrderType == FillOrderType.FILL_OR_KILL && newOrder.amount > 0) revert FOKOrderNotFilled();`.
3. Case 2: two limit asks of 1e18; FOK bid amountInBase=1e18+1. After matching ask1, newOrder.amount=1; ask2 yields 0; still reverts.
4. Practical: GTERouter sets `fillArgs.amount = route.prevAmountOut` from UniswapV2 and forces FILL_OR_KILL; output not lot-aligned triggers revert.
**How found:** Compared README's documented rounding behavior (dust below lot should not revert) against the FOK check `newOrder.amount > 0`, then traced GTERouter's use of Uniswap output as FOK amount to show real-world trigger.
**Insight:** When a spec says amounts are rounded down to a lot, audit every revert condition against lotSizeInBase rather than >0; cross-contract routers feeding external DEX outputs into FOK orders are a reliable source of non-lot-aligned amounts.
