Tests: 3+ hop routes with hybrid on multiple legs #192
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#192
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
Regression coverage stops short of multihop paths ≥3 hops where more than one leg carries non-zero
hybrid/ book consumption. Router composition and indexer merge logic can drift without always-on tests.Evidence / context
smartcontracts/tests/src/limit_order_tests.rs— two-hop hybrid on first leg exists; 3+ multi-leg hybrid called out in TEST_GAP_MATRIX.md (DEX-P1-008).route_solver.rs).Proposed solution
Add cw-multi-test (and optional indexer integration) scenarios:
hybridon ≥2 legs (non-trivialbook_inputeach).SimulateSwapOperations≈ execute totals within tolerance.hybrid_by_hoplength matches hop count; LCD sim succeeds.Acceptance criteria
docs/testing.md.Priority
P1
mentioned in commit
b34d54e4afImplementation summary (GitLab #192)
Added regression coverage for ≥3-hop router paths with hybrid on ≥2 legs (L8 quote vs execute parity), plus indexer route-solve fixtures for 3-hop POST/GET hybrid merge.
Contract (cw-multi-test)
setup_router_abcd_envharness (A→B→C→D chain)router_three_hop_two_legs_hybrid_matches_simulate— hybrid on hops 1 & 2, pool-only hop 3; assertsSimulateSwapOperations== execute and ≥2 limit-book fillsIndexer integration
seed_route_solve_3hop(A→B→C→D pairs)route_solve_post_three_hop_multi_leg_hybrid— POSThybrid_by_hoplength 3, hybrid merged on legs 1–2, LCD mock simroute_solve_get_hybrid_optimize_three_hops— GEThybrid_optimize=trueon 3-hop pathDocs / agent playbooks
docs/testing.md,docs/indexer-invariants.md,docs/contracts-security-audit.md(L8 row),TEST_GAP_MATRIX.mdskills/AGENTS_TESTING_MULTIHOP_HYBRID.mdMerged to
mainin commitb34d54e.@brouie — please verify when you have a moment. Leaving this issue open until sign-off.
Verification checklist
cd smartcontracts && cargo test router_three_hop_two_legs_hybrid_matches_simulatecd smartcontracts && cargo test router_two_hop_first_leg_hybrid_matches_simulatecd indexer && cargo test --test api_route_solve three_hop -j 1 -- --test-threads=1(Postgres + migrations)docs/testing.mdand L8 row indocs/contracts-security-audit.mdreference #192 testsskills/AGENTS_TESTING_MULTIHOP_HYBRID.mdfor agent onboarding accuracydeploy-dex-local.shVerification sign-off (agent)
Verified GitLab #192 on
main@0e5f020using worktreefix/issue-192-verify.Acceptance criteria
cargo test hybrid_matches_simulate— bothrouter_two_hop_first_leg_hybrid_matches_simulateandrouter_three_hop_two_legs_hybrid_matches_simulatepass (L8 sim vs execute parity, ≥2 book fills on 3-hop path).cargo test --test api_route_solve three_hop -j 1 -- --test-threads=1—route_solve_post_three_hop_multi_leg_hybridandroute_solve_get_hybrid_optimize_three_hopspass (Postgresdex_indexer_test, Wiremock LCD).docs/testing.mdL8/hybrid section,docs/contracts-security-audit.mdL8 row, andskills/AGENTS_TESTING_MULTIHOP_HYBRID.mdall reference #192 tests accurately.Verification checklist
main)pool_only=true; browser MCP confirmed Swap UI loads with connected wallet and token picker on:5173. Default hybrid GET for that pair returns 400 router sim on current local book state (expected when optimizer splits don’t sim cleanly on live chain) — not a regression in #192 test coverage.No code changes required; closing as verified.
mentioned in issue #209
mentioned in issue #335