ops: post-merge !480 greedy book-first leftovers (#708 #709 #710) #712

Closed
opened 2026-08-31 05:09:17 +00:00 by PlasticDigits · 11 comments
PlasticDigits commented 2026-08-31 05:09:17 +00:00 (Migrated from gitlab.com)

Summary

!1198 landed on main (f54de4fd, source HEAD 56e4c4f5). It implements opt-in greedy book-first swap plus leftovers #708 / #709 / #710.

GitLab auto-closed those three on merge. Do not reopen them unless a merged invariant is wrong. Close this leftover when columbus-5 pair migrate + LocalTerra canary (and any should-fix you choose to land) are done.

Conflict resolution on !1198: only Makefile conflicted with !1197 (#705 candles newest-N). Union kept verify-issue-708 / 709 / 710 and verify-issue-705 (.PHONY, recipes, Cloud Agent help). AGENTS.md and docs/testing.md auto-merged cleanly.

No automerge. Do not wait on GitLab CI (quota is not a product signal).

Merged MR

MR Issues What landed
!1198 #708 #709 #710 Opt-in GreedySwapParams (no caller split). hybrid: None stays pool-only (G1). Quote/execute mutex (G11). greedy_stop=remainder_to_pool. Pool-spot overflow Skip (A7). Tax/pause/blacklist/AfterSwap L7 coverage.

Skill: skills/AGENTS_GREEDY_BOOK_FIRST.md

Local verify (after git pull)

make verify-issue-709
make verify-issue-710
make verify-issue-708   # needs frontend-dapp/node_modules for greedy gas vitest

Merge-time check: #709 and #710 verify scripts PASS. #708 gas vitest was previously skipped in a worktree without node_modules.

Operator leftovers

Pair wasm migrate (G14)

Factory pair_code_id + pair migrate on columbus-5 (and LocalTerra if that stack is still on pre-greedy pair wasm). Do not flip hybrid: None to greedy. Official dApp stays on GET /route/solve.

LocalTerra canary

On a pair with a strictly better live ask/bid: greedy hop emits limit_order_fill + positive book_return_amount; pool-only control does not. Optional vs GET /route/solve (greedy may lose to an interior split — G4).

Coolify

No indexer migration. Frontend gas map is already in-tree; rebuild is optional unless wallets start sending greedy. Contract migrate is the product gate, not a frontend rebuild.

Should-fix (not merge blockers; land here if cheap)

Item Why
Router G8 dummy book_input=1 error string LCD: “Hybrid swap with book_input 1 requires per-hop min_return” on greedy hops that have no book_input.
Router ReverseSimulateSwapOperations ignores greedy Reverse-quotes a greedy hop as pool-only. Pair HybridReverseSimulation has no greedy field — error or document, do not silent pool-only.
G6 live same-side stale hint Missing/wrong-side → head (L17). A live same-side stale hint starts there; greedy stop can dump the whole offer to the AMM. Document as integrator risk; optional greedy-only fallback.
Explicit return_amount ≥ pool-only on same offer Fill+remainder tested; no named ≥ pool-only / k / treasury = pool + book half assert.
Greedy MAX_SCAN_STEPS / park-cap multitest Caps exist on the shared matcher; no greedy-specific greedy_stop=scan_cap emit test.
Community-tax greedy buy analogue Sell extra-debit covered; buy path not named.
AfterSwap re-entrancy (A13) greedy-specific test Pattern C allowlist unchanged; optional greedy hook re-enter.
Swarm unmapped send throw dApp throws SendHookGasDecodeError; swarm decode miss falls through to BASE_GAS.

Out of scope (do not do here)

  • Flipping default to greedy (owner opt-out note; G1 stays).
  • Official dApp off /route/solve.
  • Indexer replacing GET best-execution with greedy.
  • Auto-deriving book_start_hint on-chain.
  • Sibling integrator docs #707 (pair.swap is pool-only) — keep that ticket separate.

Guardrails

  • Do not reopen #708 / #709 / #710 for ops/QA.
  • Do not wait on GitLab CI quota.
  • Do not treat in-repo verify as columbus-5 migrate close.
## Summary [!1198](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/480) landed on `main` (`f54de4fd`, source HEAD `56e4c4f5`). It implements opt-in greedy book-first swap plus leftovers [#708](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/708) / [#709](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/709) / [#710](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/710). GitLab auto-closed those three on merge. **Do not reopen them unless a merged invariant is wrong.** Close this leftover when columbus-5 pair migrate + LocalTerra canary (and any should-fix you choose to land) are done. Conflict resolution on !1198: only `Makefile` conflicted with !1197 (#705 candles newest-N). Union kept `verify-issue-708` / `709` / `710` and `verify-issue-705` (`.PHONY`, recipes, Cloud Agent help). `AGENTS.md` and `docs/testing.md` auto-merged cleanly. No automerge. Do not wait on GitLab CI (quota is not a product signal). ## Merged MR | MR | Issues | What landed | |----|--------|-------------| | !1198 | #708 #709 #710 | Opt-in `GreedySwapParams` (no caller split). `hybrid: None` stays pool-only (**G1**). Quote/execute mutex (**G11**). `greedy_stop=remainder_to_pool`. Pool-spot overflow Skip (**A7**). Tax/pause/blacklist/AfterSwap L7 coverage. | Skill: [`skills/AGENTS_GREEDY_BOOK_FIRST.md`](skills/AGENTS_GREEDY_BOOK_FIRST.md) ## Local verify (after `git pull`) ```bash make verify-issue-709 make verify-issue-710 make verify-issue-708 # needs frontend-dapp/node_modules for greedy gas vitest ``` Merge-time check: #709 and #710 verify scripts **PASS**. #708 gas vitest was previously skipped in a worktree without `node_modules`. ## Operator leftovers ### Pair wasm migrate (**G14**) Factory `pair_code_id` + pair migrate on columbus-5 (and LocalTerra if that stack is still on pre-greedy pair wasm). Do **not** flip `hybrid: None` to greedy. Official dApp stays on `GET /route/solve`. ### LocalTerra canary On a pair with a strictly better live ask/bid: greedy hop emits `limit_order_fill` + positive `book_return_amount`; pool-only control does not. Optional vs `GET /route/solve` (greedy may lose to an interior split — **G4**). ### Coolify No indexer migration. Frontend gas map is already in-tree; rebuild is optional unless wallets start sending `greedy`. Contract migrate is the product gate, not a frontend rebuild. ## Should-fix (not merge blockers; land here if cheap) | Item | Why | |------|-----| | Router G8 dummy `book_input=1` error string | LCD: “Hybrid swap with book_input 1 requires per-hop min_return” on greedy hops that have no `book_input`. | | Router `ReverseSimulateSwapOperations` ignores `greedy` | Reverse-quotes a greedy hop as pool-only. Pair `HybridReverseSimulation` has no `greedy` field — error or document, do not silent pool-only. | | G6 live same-side stale hint | Missing/wrong-side → head (**L17**). A live same-side stale hint starts there; greedy stop can dump the whole offer to the AMM. Document as integrator risk; optional greedy-only fallback. | | Explicit `return_amount ≥` pool-only on same offer | Fill+remainder tested; no named ≥ pool-only / k / treasury = pool + book half assert. | | Greedy `MAX_SCAN_STEPS` / park-cap multitest | Caps exist on the shared matcher; no greedy-specific `greedy_stop=scan_cap` emit test. | | Community-tax greedy **buy** analogue | Sell extra-debit covered; buy path not named. | | AfterSwap re-entrancy (**A13**) greedy-specific test | Pattern C allowlist unchanged; optional greedy hook re-enter. | | Swarm unmapped send throw | dApp throws `SendHookGasDecodeError`; swarm decode miss falls through to `BASE_GAS`. | ## Out of scope (do not do here) - Flipping default to greedy (owner opt-out note; **G1** stays). - Official dApp off `/route/solve`. - Indexer replacing GET best-execution with greedy. - Auto-deriving `book_start_hint` on-chain. - Sibling integrator docs [#707](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/707) (pair.swap is pool-only) — keep that ticket separate. ## Guardrails - Do not reopen #708 / #709 / #710 for ops/QA. - Do not wait on GitLab CI quota. - Do not treat in-repo verify as columbus-5 migrate close.
PlasticDigits commented 2026-08-31 05:09:18 +00:00 (Migrated from gitlab.com)

marked as related to #708

marked as related to #708
PlasticDigits commented 2026-08-31 05:09:18 +00:00 (Migrated from gitlab.com)

marked as related to #709

marked as related to #709
PlasticDigits commented 2026-08-31 05:09:19 +00:00 (Migrated from gitlab.com)

marked as related to #710

marked as related to #710
PlasticDigits commented 2026-08-31 05:09:37 +00:00 (Migrated from gitlab.com)

mentioned in issue #708

mentioned in issue #708
PlasticDigits commented 2026-08-31 05:09:38 +00:00 (Migrated from gitlab.com)

mentioned in issue #709

mentioned in issue #709
PlasticDigits commented 2026-08-31 05:09:40 +00:00 (Migrated from gitlab.com)

mentioned in issue #710

mentioned in issue #710
PlasticDigits commented 2026-09-01 08:15:55 +00:00 (Migrated from gitlab.com)

mentioned in issue #718

mentioned in issue #718
PlasticDigits commented 2026-09-01 08:16:09 +00:00 (Migrated from gitlab.com)

marked as related to #718

marked as related to #718
PlasticDigits commented 2026-09-01 08:16:22 +00:00 (Migrated from gitlab.com)

Follow-up for the G1 owner note (greedy opt-out default, TerraSwap-compat bots): #718.

Do not land 718’s wasm migrate until this leftover’s pair 1.16.0 migrate is done. 718 also needs a router migrate; this ticket does not.

Follow-up for the G1 owner note (greedy opt-out default, TerraSwap-compat bots): [#718](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/718). Do not land 718’s wasm migrate until this leftover’s pair **1.16.0** migrate is done. 718 also needs a **router** migrate; this ticket does not.
PlasticDigits commented 2026-09-01 08:25:08 +00:00 (Migrated from gitlab.com)

columbus-5 migrate smoke (G14) — PASS

LCD https://terra-classic-lcd.publicnode.com. Factory stays 11629 / 1.10.0. Official dApp stays on GET /route/solve. G1 still opt-in (omitted greedy = pool-only). Default-greedy is #718, not this ticket.

Store

Wasm code_id data_hash store tx height
Pair 11639 47E383B8EF75C5F4731CF88909A03AFA26945D17A20320A2F5F26FD23A630427 F12E6458…7D8A 30205192
Router 11640 E74689EF0F31BCD6164DC8F2D78775DBA2BC49C1243B4BB4750654F194301ACC 4E1C4EB0…86B9 30205195

Uploader cl8ydeploy. Instantiate permission Everybody.

Router migrate was not required for this leftover (dApp never sends greedy). It was done: router live 11576 → 11640, cw2 still 1.1.0 (no router version bump). Opt-in greedy hops now decode on the router.

Factory + fleet

Check Result
config.pair_code_id 11639
GetPairCount 20
Pair ContractInfo.code_id 20/20 on 11639
Pair cw2 20/20 cl8y-dex-pair 1.16.0
Wasm admin DEX 2-of-3 terra1zlmv2…hep7
EMBER/CORAL GetAssetCodeIds [10184, 10184] still factory-whitelisted

HybridSimulation smoke

EMBER/CORAL offer 1000000 EMBER:

Mode return_amount book_return_amount greedy_stop
Pattern C book_input=0 929574 0 omitted
Omitted hybrid+greedy (G1) 929574 0 omitted
greedy: { max_maker_fills: 8 } 929574 0 worse_than_pool

G11 mutex (both fields): pair query errors. Router hop mutex: cannot set both hybrid and greedy on a hop.

Router SimulateSwapOperations EMBER→CORAL: omitted hop amount=929574; greedy hop accepted (amount=929574). Pre-11640 router would have rejected unknown greedy.

Live-book canary (columbus-5, stands in for LocalTerra)

CL8Y/cUSTC terra1tz5vwrungh6drd9nt95qym3k892vs3as8nqmu7sg4ypek7wxvv4qm89upc — heads bid 288 / ask 289. Offer 1e15 CL8Y:

Mode return_amount book_return_amount limit_book_offer_consumed greedy_stop
Pool-only 98538 0 0 omitted
Greedy 99440 99440 1000000000000000 filled

Greedy strictly beats pool-only on the same offer (G4 “OK not perfect”). No execute tx (query-only).

UST1/USTR has a live book (heads 1851/2072) but greedy stopped worse_than_pool at 1e6 UST1 — makers do not strictly beat pool spot.

Not done here (by design)

  • LocalTerra canary stack not probed (columbus-5 live-book canary covers G14).
  • Should-fixes (G8 dummy string, reverse-sim greedy, etc.) not landed.
  • G1 stays opt-in. #718 is the opt-out default + pair 1.17.0 / router bump.
  • Do not reopen #708 / #709 / #710.

Closing this leftover.

## columbus-5 migrate smoke (G14) — PASS LCD `https://terra-classic-lcd.publicnode.com`. Factory stays **11629 / 1.10.0**. Official dApp stays on `GET /route/solve`. **G1 still opt-in** (omitted greedy = pool-only). Default-greedy is [#718](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/718), not this ticket. ### Store | Wasm | code_id | `data_hash` | store tx | height | |------|---------|-------------|----------|--------| | Pair | **11639** | `47E383B8EF75C5F4731CF88909A03AFA26945D17A20320A2F5F26FD23A630427` | [`F12E6458…7D8A`](https://finder.terraclassic.community/columbus-5/tx/F12E6458C06B615C04A51FF8E2B609304474FF1F5BF266FE512CE40733DC7D8A) | **30205192** | | Router | **11640** | `E74689EF0F31BCD6164DC8F2D78775DBA2BC49C1243B4BB4750654F194301ACC` | [`4E1C4EB0…86B9`](https://finder.terraclassic.community/columbus-5/tx/4E1C4EB012C58CB87A8E6B5A9B1A1C654BD39EA850FC07008CCF3ABA145E86B9) | **30205195** | Uploader `cl8ydeploy`. Instantiate permission Everybody. Router migrate was **not** required for this leftover (dApp never sends `greedy`). It **was** done: router live **11576 → 11640**, cw2 still **1.1.0** (no router version bump). Opt-in greedy hops now decode on the router. ### Factory + fleet | Check | Result | |-------|--------| | `config.pair_code_id` | **11639** | | `GetPairCount` | **20** | | Pair `ContractInfo.code_id` | **20/20** on **11639** | | Pair cw2 | **20/20** `cl8y-dex-pair` **1.16.0** | | Wasm admin | DEX 2-of-3 `terra1zlmv2…hep7` | | EMBER/CORAL `GetAssetCodeIds` | `[10184, 10184]` still factory-whitelisted | ### HybridSimulation smoke **EMBER/CORAL** offer `1000000` EMBER: | Mode | `return_amount` | `book_return_amount` | `greedy_stop` | |------|-----------------|----------------------|---------------| | Pattern C `book_input=0` | `929574` | `0` | omitted | | Omitted `hybrid`+`greedy` (**G1**) | `929574` | `0` | omitted | | `greedy: { max_maker_fills: 8 }` | `929574` | `0` | `worse_than_pool` | G11 mutex (both fields): pair query errors. Router hop mutex: `cannot set both hybrid and greedy on a hop`. **Router** `SimulateSwapOperations` EMBER→CORAL: omitted hop `amount=929574`; greedy hop accepted (`amount=929574`). Pre-11640 router would have rejected unknown `greedy`. ### Live-book canary (columbus-5, stands in for LocalTerra) **CL8Y/cUSTC** `terra1tz5vwrungh6drd9nt95qym3k892vs3as8nqmu7sg4ypek7wxvv4qm89upc` — heads bid `288` / ask `289`. Offer `1e15` CL8Y: | Mode | `return_amount` | `book_return_amount` | `limit_book_offer_consumed` | `greedy_stop` | |------|-----------------|----------------------|-----------------------------|---------------| | Pool-only | `98538` | `0` | `0` | omitted | | Greedy | **`99440`** | **`99440`** | **`1000000000000000`** | **`filled`** | Greedy strictly beats pool-only on the same offer (**G4** “OK not perfect”). No execute tx (query-only). UST1/USTR has a live book (heads `1851`/`2072`) but greedy stopped `worse_than_pool` at 1e6 UST1 — makers do not strictly beat pool spot. ### Not done here (by design) - LocalTerra canary stack not probed (columbus-5 live-book canary covers G14). - Should-fixes (G8 dummy string, reverse-sim greedy, etc.) not landed. - **G1 stays opt-in.** [#718](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/718) is the opt-out default + pair **1.17.0** / router bump. - Do not reopen #708 / #709 / #710. Closing this leftover.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-09-01 08:25:09 +00:00
PlasticDigits commented 2026-09-01 08:48:57 +00:00 (Migrated from gitlab.com)

mentioned in issue #704

mentioned in issue #704
Sign in to join this conversation.
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#712
No description provided.