fix(indexer): skip zero-reserve paths in DB-hybrid route/solve (#369) #880
No reviewers
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!880
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "verify/issue-369-zero-reserve-route-solve"
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
mirror_missing) instead of propagatingInsufficientLiquidityas a 502 for the whole request.make verify-issue-369, andskills/AGENTS_HYBRID_QUOTING.mdcross-link.Verification checklist
GET /api/v1/route/solveno longer 502 when a longer candidate touches a zero-reserve pair while a direct pool is healthymake verify-issue-369→ integrationroute_solve_db_hybrid_skips_zero_reserve_candidate_pathPASS (200, 1-hop direct path,estimated_amount_out > 0)GET /api/v1/route/solve/bestsame behavior/route/solve/bestboth directions PASShybrid_hits == 0in test PASScargo test pool_reserves_unusable --libPASScargo test concurrent_eval_skips --libPASScargo test --test api_route_solve_db_hybrid -- --test-threads=1PASS (4/4)Follow-ups
book_snapshot.changed the description
changed the description
Security review — MR !880
Commit reviewed:
2d46702d237baea7ae0d36f180206c33d101e912Scope: DB-hybrid route/solve error handling — zero-reserve mirror detection (
pool_reserves_unusable,MissingReserves),pool_only_or_zerohop simulation, concurrent candidate skip-and-continue (best_execution.rs), integration tests and QA script.Method: Traced attacker-controlled inputs (
token_in,token_out,amount_in, optionaltrader/sender) throughGET /api/v1/route/solveand/route/solve/bestinto hybrid grid simulation, router re-simulation (maybe_simulate), andapply_fidelity_guard. Checked for injection, authz bypass, quote inflation, SSRF/LCD abuse, and secret leakage in new paths.Outcome:
FINDINGS: 0medium+Inline threads: None (no medium+ issues on this diff).
Notes (informational, below reporting threshold)
Ok(0)and skip LCD fallback by design; this is conservative (underestimates, does not inflate quotes) and is covered by the integration test assertinghybrid_hits == 0.db_outvssim_udrift clamp).db_modecandidates withgrid_out == 0are excluded before winner selection, preventing zero-output paths from being returned as viable quotes.Prior review comments: None on this MR; nothing to re-report.
added 32 commits
mainfaf127ce- Merge branch 'main' into verify/issue-369-zero-reserve-route-solveCompare with previous version
Resolved merge conflicts with
mainin four indexer files:pool_only_or_zero(#369) with main's infra-LCD guards andPathUnusablematch armsOption<CandidateEval>skip path with #369 zerogrid_outfiltering and "no viable route" 404 textpool_reserves_unusableand zero-reserve mirror unit testsSanity:
cargo check,pool_reserves_unusablelib test,concurrent_eval_skipslib test — all pass.changed the description
Security review — MR !880
Commit reviewed:
faf127ce0ad7addc71e225ca8b3adad7a15d380bScope: DB-hybrid route/solve error handling (#369) after merge with
main—pool_reserves_unusable/EmptyPoolmirror freshness,pool_only_or_zerohop simulation, zerogrid_outcandidate filtering, concurrent skip-and-continue evaluation (best_execution.rs),PathUnusablecandidate skip frommain, integration tests and QA script.Method: Re-traced attacker-controlled inputs (
token_in,token_out,amount_in, optionaltrader/sender) throughGET /api/v1/route/solveand/route/solve/bestinto hybrid grid simulation, router re-simulation (maybe_simulate), andapply_fidelity_guard. Compared post-merge diff (2d46702d→faf127ce) for regressions from conflict resolution. Checked injection, authz bypass, quote inflation, SSRF/LCD abuse, and secret leakage.Outcome:
FINDINGS: 0medium+Inline threads: None (no medium+ issues on this diff).
Security review: no medium+ findings on this diff.
Notes (informational, below reporting threshold)
Ok(0)and skip LCD fallback by design; conservative (underestimates, does not inflate quotes). Integration test assertshybrid_hits == 0.db_outvssim_udrift clamp).db_modecandidates withgrid_out == 0are excluded before winner selection.mainaddedPathUnusable→Ok(None)skip and infra-LCD error guards; no new attack surface identified.Prior review:
2d46702d(2026-06-12) reached the same conclusion; re-reviewed after merge-conflict resolution — findings unchanged.mentioned in commit
15551045b6