design(indexer): remaining GET /route/solve failure modes after wrap-enter and mixed-decimal quotes #1265
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#1265
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
Research / decision only — do not implement indexer solver, Swap quote, wrap-mapper, or CosmWasm changes in this issue.
Question: after the known wrap-enter ranking work and the mixed-decimal CW20 quote tickets, which additional
GET /api/v1/route/solvefailure modes still exist on retail Swap/Trade (wrong path, implausible output, no path, timeout, client BFS fallback), and which of those are already owned vs still uncatalogued.Bundle into one investigation (do not split indexer vs frontend vs wrap vs Trade):
GET /api/v1/route/solve(quoteCw20ViaRouteSolvevsfindRouteWithNativeSupport/simulateNativeSwapvs client BFS fallback).intermediate_tokens),estimated_amount_outvs wallet sim, worst-hop spread,quote_kind, hop count vsGET_DEFAULT_MAX_HOPS(4), and whether the client timed out.Related, not duplicates (keyword overlap on “route” / “solve” is not enough):
GET /route/solve; hop-count / top-K ranking drops wrap-then-cUSTC on LUNC→USTR (and wrap-enter LUNC→listed CL8Y). Specific ranking + native I/O mapping bug. This census must not fold those constraints into a sibling implement ticket./route/solve. Scale/identity/sim honesty, not wrap-enter.GET /route/solve/progress. Latency/UX, not wrong-path ranking.estimated_amount_out_netranking.Current codebase
docs/route-solver.mdis the integrator contract. OptimizedGET /api/v1/route/solvewithamount_in(andpool_onlynot true):uluna/uusdwithout a wrap-mapper substitution are not indexer-routable.find_paths_top_k— ≤MAX_PATH_CANDIDATES(5) simple paths, ≤GET_DEFAULT_MAX_HOPS(4), shortest-first.optimize_multihop_hybrid_joint(17-point book grid + 2 coordinate-descent passes). Empty-book hops short-circuit (#493).estimated_amount_out_net(#615).estimated_amount_outstays pre-taxraw_out.OPTIMALITY_SCOPE: optimal within top-5 shortest simple paths + per-hop hybrid grid — not a global optimum; paths outside top-5 are never scored.AMOUNT_CACHE_BUCKET(1_000_000 raw), maker-fill bucket, discount/tax identity. Trader address is not keyed.Retail Swap/Trade:
quoteCw20ViaRouteSolveGET /api/v1/route/solvethen walletsimulateMultiHopSwap+ hop preflightfindRouteWithNativeSupport→ first BFS after wrap substitution →simulateNativeSwapamount_in) / POSTYou Receive is wallet sim humanized with
getDecimals/fromRawAmount. Slippage chrome: >5% banner, >30% Expert, ≥99% extreme (#678). A 100% hop spread or 10^9-scale receive that still paints is a quote honesty failure.Why this work is needed
MAX_PATH_CANDIDATES = 5+ shortest-first is a documented non-goal of global optimality. Some “failures” are in-scope of that bound (need a product decision: raise K vs reject ~100% spread vs map natives into solve). Others are bugs (decimals, cache alias, identity).Constraints / guardrails
MAX_PATH_CANDIDATES/ hop-cap / cache-bucket / wrap-mapping / Swap quote-path change in this MR. No CosmWasm migrate. No other-DEX edges (#690) as the “fix.”USDT/USTRas identity. Contract / denom only (#715). Gems stay hidden (#562).AMOUNT_CACHE_BUCKETmust not be “fixed” here; the memo may recommend a later ticket if 18-dec vs 6-dec keys alias.Relevant files
indexer/src/api/best_execution.rsSOLVER_VERSION_*,OPTIMALITY_SCOPE, LCD budgetindexer/src/api/route_paths.rsfind_paths_top_k, hop-first top-Kindexer/src/api/route_solver.rsAMOUNT_CACHE_BUCKETindexer/src/api/hybrid_route_opt.rsindexer/src/api/route_graph.rsindexer/tests/api_route_solve.rsfrontend-dapp/src/utils/cw20RouteSolveQuote.tsfrontend-dapp/src/pages/SwapPage.tsxfrontend-dapp/src/services/indexer/client.tsgetRouteSolvetimeout / AbortSignalfrontend-dapp/src/utils/swapRouting.tsfrontend-dapp/src/utils/swapRouteSlippage.tsspot_amount_outfrontend-dapp/src/services/terraclassic/swapRoutePreflight.tsdocs/route-solver.mddocs/adr/0002-global-best-execution-route-solver.mdskills/AGENTS_INDEXER_HYBRID_BEST_EXECUTION.mdskills/AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.mdscripts/check_route_solver_docs.pyRecommended direction
docs/adr/NNNN-route-solve-remaining-failures.md(Status: Proposed) plus a one-line pointer fromdocs/README.mdand a “remaining failures” subsection pointer indocs/route-solver.md(no constant edits)./route/solve? wrap-mapped? decimals per hop; last observed failure class (or “honest within OPTIMALITY_SCOPE”)./route/solveAMOUNT_CACHE_BUCKETaliases 18-dec vs 6-dectoken_outnot unique-symbol winnerscripts/qa/verify-issue-NNN.sh: required ADR headings present; no productionbest_execution.rs/route_paths.rs/cw20RouteSolveQuote.ts/SwapPage.tsxquote-branch edits in the research MR.What would make a later implement issue ready
A follow-up bug or feature issue may be opened only when the ADR names:
Until that exists, this issue stays research. No Given/When/Then. No
ready. No/agent implement.Research acceptance criteria
Test plan (research paths)
Document and process tests, not chain deploys or solver patches.
quoteCw20ViaRouteSolvevs BFS fallback/vs Trade markettoken_in/token_out/ hopsNegative / skip:
ready//agent implementto this issue → fail (research).Test plan (attack, hack, and abuse)
Research must evaluate each vector. Do not write exploits, PoCs, or attack procedures.
route-solver.mdrouter_operations(#450 / SEC-I02)RATE_LIMIT_LCD_HEAVY_RPScode_idstill routedVerification criteria
scripts/qa/verify-issue-NNN.shasserts required headings and that production solver/quote files are untouched (python3 scripts/check_route_solver_docs.pystill green).Out of scope
First-pass model recommendation
Recommendation: grok-high
Rationale: This is a research census across the indexer global solver (
best_execution.rs,route_paths.rs,route_solver.rscache), Swap/Trade quote branches (cw20RouteSolveQuote.ts, native wrap BFS), mixed-decimal hops, and slippage fail-closed chrome. That is more than three production files, crosses routing/quote protocol (not a local known edit), and has no deterministic product patch in this ticket. Composer criteria fail on investigation-only scope, file/subsystem count, and uncertain remaining failure classes. Verification is an ADR plus a docs-only check script, not a unit-test-only ranking change. Policy: research stays grok-high; this is advisory planning text, not a runner argument or permission to execute.Merged as PR #1289. ADR 0007 Stay; no solver impl spawn. F0 stays #1218 (now also merged). Wallet sim vs estimated_amount_out still unmeasured as designed.
Leftover ops: #1300
Verified 2026-09-24 on origin/main
54c4868e: make verify-issue-1265 passes 9/9, including R-CENSUS-1–8, constants/docs lockstep, cross-links, and no production solver or quote-path diff. ADR 0007 accepts the documented unmeasured wallet-simulation comparison for the docs-only Stay; no solver issue is warranted. Census implementation PR #1289 is merged and post-merge tracker #1300 is closed. Separate F0 follow-up remains under #1218 (PR #1297); #1257 and #1264 are closed. Newer adjacent Swap route-display verification is tracked separately in #1330.