contracts: greedy opt-out default on pair Swap + router TerraSwap #718
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#718
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Owner follow-up from #708 / G1 (called out as out of scope on #712): greedy becomes the omitted-params default on pair
Swapand routerTerraSwap.A bot that treats CL8Y like TerraSwap / TerraPort (CW20
Send+{"swap":{…}}withmax_spread, nohybrid, nogreedy) must still execute and get OK (not perfect) pricing: fill live same-side makers that strictly beat the pool, remainder to the AMM. Perfect execution stays indexerGET /route/solve(official dApp, G4 / #501 / #596).Greedy is opt-out, not opt-in. Missing
greedyis not pool-only.Gate (do not columbus-5 migrate this wasm first)
Blocked by #712 — pair 1.16.0 opt-in greedy must be live on columbus-5 (
config.pair_code_id+ all pairs) before this default-greedy wasm (pair 1.17.0 + router migrate) is stored/migrated.Implementation in-repo may proceed in parallel. Do not reopen #708 / #709 / #710.
This leftover does require a router migrate (live router 11576 / 1.1.0 rejects unknown
greedytoday). #712 does not.New G1 (replaces opt-in)
hybrid: None,greedy: None(TerraSwap-shaped)max_maker_fills(suggest 8, same as dApp hybrid cap) andbook_start_hint: None(head, L17).hybrid: Some(_)book_input: 0.greedy: Some(params)max_maker_fills == 0still rejects (G5) unless we pick a different opt-out wire — do not overload0.Pool-only opt-out for callers who want classic v2: send Pattern C
hybrid: { pool_input: offer, book_input: "0", max_maker_fills: 1, book_start_hint: null }(already pool-only). Do not invent a secondpool_onlyflag unless serde on TerraSwap-compatSwapcannot carryhybrid.Same mutex on query and execute (G7 / G11): omitted
greedyonHybridSimulationmust resolve the same way as execute.Must not break TerraSwap-shaped execute (G8)
Today explicit greedy requires
belief_priceormin_return(G8). Classic TerraSwap/TerraPort txs usually sendmax_spreadonly. If default greedy keeps G8 as-is, those bots start reverting after migrate — worse than pool-only.For the omitted-greedy default path, use the existing pool/Pattern C slippage story (
max_spread/belief_price). Keep G8 for explicitgreedy: Someif we still want a hard floor on the integrator-opt-in shape — or unify, but naive omitted-params txs must succeed.Router dummy G8 string (“book_input 1 requires per-hop min_return”) on hops with no
book_inputis already a #712 should-fix; this issue must not ship that LCD error on default-greedy hops.Router
hybrid+ omittedgreedyon aTerraSwaphop → default greedy (same as pair).hybridon a hop stays Pattern C / solver (G12 flip only for the omitted case).Gas (G13)
Default greedy with cap 8 must not fall through to silent 600k. Naive bots often simulate ~pool gas; they may OOG if the book is live. Cap 8 is the “OK not perfect” bound. Swarm /
getGasLimitForTxmust treat omitted-greedy hook"swap"as the greedy/hybrid envelope once this wasm is live — neverBASE_GAS.Official dApp
Do not take Swap/Trade off
/route/solve. Solver hops send explicithybrid; they are unaffected.Docs / #707
#707 (pair.swap is pool-only) must be updated or closed as superseded when this lands — TerraSwap-compat
Swapwill no longer be pool-only.Update G1 / G12 in
skills/AGENTS_GREEDY_BOOK_FIRST.md,docs/contracts-security-audit.md,docs/integrators.md,docs/adr/0001-hybrid-quoting-and-routing.md,docs/limit-orders.md.Acceptance criteria
HybridSimulation: omittedhybrid/greedy→ greedy (default cap), not pool-only.TerraSwaphop: omittedhybrid/greedy→ greedy; explicithybridunchanged.max_spreadand nobelief_price/min_returnsucceeds on the default path (G8 does not brick clones).book_input: 0remains pool-only (opt-out).hybrid+greedystill reject./route/solve.UpdateConfig { pair_code_id }+ pair fleet + router migrate.Out of scope
book_start_hinton-chain./route/solve.marked as related to #712
mentioned in issue #712
#712 columbus-5 pair migrate is done — gate is open.
config.pair_code_id11639, 20/20 pairs.hybrid/greedyis still pool-only (EMBER/CORAL929574matches Pattern Cbook_input=0).99440vs98538,greedy_stop=filled).Do not migrate 718 wasm until the default-greedy cw2 bump is in-tree.
mentioned in issue #704
/agent implement
Verified against origin/main
54c4868e: keep #718 open. Pair G1 still maps omitted hybrid+greedy to pool-only (9 dex-common mode tests and 21 greedy-book-first multitests pass; the G1 test leaves a better resting bid untouched). Router sim/execute also select pool-only when fields are omitted. #712 is closed; no newer issue tracks this default flip. #1324 only tracks the unrelated pair 1.18.0 TWAP migration; source is pair 1.18.0 / router 1.1.0. Remaining: implement omitted-default on pair query/execute and router (including max_spread-only slippage, reverse-quote policy, and greedy gas envelope); update version/migrate and reconcile still-open #707. This verification updates G1/G12 crosslinks in the contract, integrator, audit, and agent docs; keep #718 open until implementation and deployment acceptance pass.PR #1337 merged while refreshed Woodpecker CI remained Pending under the explicit CI-skip authorization. Local greedy suites passed 9/9 and 21/21. #718 remains open for the default-greedy implementation and its #1225 liveness/parity gate.
Status clarification after merge: #1225 is currently marked Closed, while its latest verification comment still reports outstanding liveness acceptance. PR #1337 is documentation-only; #718 remains open until the default-greedy implementation, pair/router upgrade, and acceptance checks are complete.