fix(pair): named min-size for dust limit rungs (#1219) #1296

Merged
PlasticDigits merged 2 commits from issue/1219-limit-min-size into main 2026-09-21 05:33:51 +00:00

Closes #1219

Pair place now rejects post-fee remaining below the L16 dust floor of 10 with named LimitOrderAmountTooSmall. Descending ladder_prices steps by absolute span so 18-vs-6 raw 3 to 1 no longer overflows. Official dApp disables Place on dust rungs.

Summary

  • Shared helper min_limit_place_remaining() equals LIMIT_ORDER_DUST_FLUSH_THRESHOLD (10).
  • After floor maker fee, remaining below 10 reverts all-or-nothing (not LimitInsertStepsExceeded skip).
  • ladder_prices uses |end−start| so descending equal-dec 3→1 and 18-vs-6 Decimal::raw(3)→raw(1) place without Overflow: Cannot Sub.
  • /trade ticket and /limits ladder show Minimum size is 10 units and do not sign dust rungs.
  • Invariant L24, skill S1219-1–S1219-8, integrators crosslink, make verify-issue-1219.

Acceptance

  • AC1. Batch / retail n=1 with amount 1 or 9 reverts named min-size; message includes 10; no Overflow.
  • AC2. Post-fee remaining ≥ 10 still places; remaining = amount − floor fee (amount 10 and 667 @ 15 bps).
  • AC3. Healthy rungs plus one dust rung revert the whole tx; zero new orders / pending escrow.
  • AC4. Ladder totals that assign < 10 to any equal-split rung (total=1, total=29 / count=3) revert before inserts.
  • AC5. Descending in-band ladders place count rungs; prices monotonic toward end; amounts sum to total (equal-dec and 18-vs-6 raw 3→1).
  • AC6. T9 (limit_discount_bps = 10000) cannot place amount < 10; spam batch named-rejects.
  • AC7. dApp dust total / dust rung disables Place (Vitest); healthy 5-rung expand unchanged.
  • AC8. #467 / #529 / #264 / #1227 gates unchanged. #1225 stays open (unfillable in-band MIN_LIMIT_PRICE asks).
  • AC9. Docs + AGENTS_LIMIT_ORDER_BATCH_LADDER.md + make verify-issue-1219.

Out of scope (issue)

  • Playwright T13 LocalTerra limit-orders-tx 5-rung (needs full chain).
  • Coolify pair wasm migrate (later ops if columbus-5 still runs pre-fix code).
  • Match-time park / CleanLimitBook defaults / remaining × price < 1 (#1225 / #264).
  • Maker/taker bps split, #514 tier table, indexer schema, community-tax extra-debit on limit Send.

Verify

make verify-issue-1219

Ran twice in this worktree (4/4). Also retested dust_price_rejected, ladder_five_rungs, match_dust_flush_bid_hybrid.

Manual leftover: /limits ladder total that splits under 10 → no wallet popup; raise total → place. Descending start/end on UST1/USTR.

Closes #1219 Pair place now rejects post-fee remaining below the L16 dust floor of 10 with named `LimitOrderAmountTooSmall`. Descending `ladder_prices` steps by absolute span so 18-vs-6 raw 3 to 1 no longer overflows. Official dApp disables Place on dust rungs. ## Summary - Shared helper `min_limit_place_remaining()` equals `LIMIT_ORDER_DUST_FLUSH_THRESHOLD` (10). - After floor maker fee, remaining below 10 reverts all-or-nothing (not `LimitInsertStepsExceeded` skip). - `ladder_prices` uses `|end−start|` so descending equal-dec 3→1 and 18-vs-6 `Decimal::raw(3)→raw(1)` place without `Overflow: Cannot Sub`. - `/trade` ticket and `/limits` ladder show **Minimum size is 10 units** and do not sign dust rungs. - Invariant **L24**, skill **S1219-1–S1219-8**, integrators crosslink, `make verify-issue-1219`. ## Acceptance - [x] AC1. Batch / retail n=1 with amount 1 or 9 reverts named min-size; message includes 10; no Overflow. - [x] AC2. Post-fee remaining ≥ 10 still places; remaining = amount − floor fee (amount 10 and 667 @ 15 bps). - [x] AC3. Healthy rungs plus one dust rung revert the whole tx; zero new orders / pending escrow. - [x] AC4. Ladder totals that assign < 10 to any equal-split rung (total=1, total=29 / count=3) revert before inserts. - [x] AC5. Descending in-band ladders place `count` rungs; prices monotonic toward end; amounts sum to total (equal-dec and 18-vs-6 raw 3→1). - [x] AC6. T9 (`limit_discount_bps = 10000`) cannot place amount < 10; spam batch named-rejects. - [x] AC7. dApp dust total / dust rung disables Place (Vitest); healthy 5-rung expand unchanged. - [x] AC8. #467 / #529 / #264 / #1227 gates unchanged. **#1225 stays open** (unfillable in-band MIN_LIMIT_PRICE asks). - [x] AC9. Docs + `AGENTS_LIMIT_ORDER_BATCH_LADDER.md` + `make verify-issue-1219`. ## Out of scope (issue) - Playwright T13 LocalTerra `limit-orders-tx` 5-rung (needs full chain). - Coolify pair wasm migrate (later ops if columbus-5 still runs pre-fix code). - Match-time park / `CleanLimitBook` defaults / `remaining × price < 1` (#1225 / #264). - Maker/taker bps split, #514 tier table, indexer schema, community-tax extra-debit on limit Send. ## Verify ``` make verify-issue-1219 ``` Ran twice in this worktree (4/4). Also retested `dust_price_rejected`, `ladder_five_rungs`, `match_dust_flush_bid_hybrid`. Manual leftover: `/limits` ladder total that splits under 10 → no wallet popup; raise total → place. Descending start/end on UST1/USTR.
fix(pair): named min-size for dust limit rungs (#1219)
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
33fa0dc5ae
Reject post-fee remaining below the L16 dust floor of 10 with LimitOrderAmountTooSmall, and step descending ladder prices by absolute span so 18-vs-6 raw 3 to 1 no longer overflows.
Author
Owner

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue

drain skip: no occupying job for rebase/fix-pr/CI-wait; remaining continue
Merge origin/main into issue/1219-limit-min-size
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
39d0822c75
Keep named min-size L24 with F6 reprice gate and FIFO L23.
PlasticDigits deleted branch issue/1219-limit-min-size 2026-09-21 05:33:51 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!1296
No description provided.