Indexer: GET /route/solve defaults to hybrid; default max hops = 3 #191
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#191
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?
Problem statement
GET /api/v1/route/solvereturns pool-onlyterra_swap.hybrid: nullunless callers passhybrid_optimize=true. Retail and integrator defaults should assume hybrid-aware routing with a 3-hop cap on GET (per ADR 0001).Evidence / context
indexer/src/api/route_solver.rs— GET defaulthybrid: null;hybrid_optimizeopt-in; GET max 3 hops, POST max 4.Proposed solution
router_operationsinclude mergedhybridparams withouthybrid_optimize=true.pool_only=true(or similar) escape hatch for backward-compatible integrators during migration.Acceptance criteria
/api/v1/route/solvereturns hybrid-merged ops by default whenamount_inis set and LCD/router configured.docs/indexer-invariants.md).hybrid_optimizeflag.indexer/tests/api_route_solve.rs(or successor) cover default hybrid GET.Priority
P1
Product does not required 4 hops, 3 is sufficient.
mentioned in commit
7d54939437mentioned in commit
392dd8253dImplementation complete (pushed to
main)Summary:
GET /api/v1/route/solvenow runs hybrid per-hop optimization by default whenamount_inis set (max 3 hops). Legacy integrators can passpool_only=true(orhybrid_optimize=false) for pool-only ops (max 4 hops,hybrid: null).GET /route/solve/bestremains an alias requiringamount_in.Changes
route_solver.rs— default hybrid GET path reusesexecute_hybrid_route_solve;GET_DEFAULT_MAX_HOPS/GET_POOL_ONLY_MAX_HOPSconstants; helper fns for pool-only vs hybrid routing.route_solve_get_default_hybrid_two_hops,route_solve_pool_only_escape_hatch; updatedroute_solve_best_matches_hybrid_optimizeto compare/bestvs default GET.SwapPage+getRouteSolveclient — no longer sendshybrid_optimize=true; addedpoolOnlyoption.indexer-invariants.md,integrators.md,limit-orders.md,contracts-security-audit.md(L8),testing.md.AGENTS_INDEXER_HYBRID_BEST_EXECUTION.md,AGENTS_TESTING_MULTIHOP_HYBRID.md,AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.md,AGENTS_LOCALNET_TRADING_SWARM.md.Verification checklist
cd indexer && cargo test --test api_route_solve -j 1 -- --test-threads=1(Postgres +TEST_DATABASE_URL)GET /api/v1/route/solve?token_in=…&token_out=…&amount_in=…returns non-nullterra_swap.hybridon hops when LCD/router configuredpool_only=truereturnshybrid: nullandquote_kind: indexer_pool_lcdGET /route/solve/bestmatches default GET withamount_in(seeroute_solve_best_matches_hybrid_optimize)hybrid_optimizequery param (npm test -- client.test.ts)@brouie — please verify on your indexer deployment when convenient. Leaving issue open until sign-off.
GitLab #191 | merge
7d54939Verification complete — closing GitLab #191
Verified on local stack (LocalTerra healthy, host Postgres :5432, indexer :3001, frontend :5173, bot swarm 30/30).
Checklist
cargo test --test api_route_solve -j 1 -- --test-threads=1— 14/14 passed (includesroute_solve_get_default_hybrid_two_hops,route_solve_pool_only_escape_hatch,route_solve_best_matches_hybrid_optimize, degraded fallback)GET /api/v1/route/solve?…&amount_in=…returns hybrid optimizer output (hybrid_notesset, non-nullterra_swap.hybridwhen book leg optimal; e.g. EMBER→CORAL)pool_only=true→quote_kind: indexer_pool_lcd,hybrid: null, nohybrid_notesGET /route/solve/bestmatches default GET (estimated_amount_out+router_operationsidentical for 2-hop)npm test -- client.test.ts— default GET omitshybrid_optimize;poolOnlyaddspool_only=truehybrid_optimize; shows Execution: Indexer hybrid and route pathImplementation on
main:392dd82(default hybrid GET, 3-hop cap,pool_onlyescape hatch) +3f99e68(degraded LCD fallback via poolsimulationwhenHybridSimulationunavailable).No additional code changes required from this verification pass.
mentioned in issue #209
marked as related to #209
mentioned in issue #323