Align hybrid swap quotes with hybrid on-chain execution #418
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#418
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?
Parent
#411 — Updated Gap Analysis (recommendation 11 — parent clarification: hybrid quote must match hybrid execution; not a disclosure/acknowledgment UX)
Current codebase
Quote vs execution mismatch is the core gap:
SwapPage.tsxdocuments that receive line can be pool-only while tx submits hybrid Pattern C whenuseHybridBookis set.TradeMarketOrderPanel.tsxsetsquoteDisclosure: 'Direct pair · hybrid_simulation (pool-only leg; book not in quote).'when book leg omitted from quote path.GET /api/v1/route/solveruns global best execution with hybrid grid (best_execution.rs,hybrid_route_opt.rs,db_orderbook_sim.rs) but frontend paths sometimes fall back to LCDhybrid_simulationpool-only or client-side pool sim.docs/contracts-security-audit.md.Parent #411 comment (2026-06-25): do not add acknowledgment/disclosure UX — make the quote hybrid when execution is hybrid (indexer changes likely required).
Why needed
Users migrating from Uniswap/CEX expect quoted output ≈ executed output. Showing pool-only receive while submitting hybrid routes is a critical trust defect and support burden.
Constraints / guardrails
pool_onlyquery flag for integrators who want pool quotes explicitly.ROUTE_SOLVER_DB_HYBRID/ mirror freshness rules (#319) must be respected — stale mirror → honest error, not silent pool fallback.enrichSwapOperationsWithHopMinReturnsandswapRoutePreflight.ts(#334).Relevant files
Frontend
frontend-dapp/src/pages/SwapPage.tsxfrontend-dapp/src/components/trade/TradeMarketOrderPanel.tsxfrontend-dapp/src/services/terraclassic/pair.ts(hybrid_simulation)frontend-dapp/src/services/terraclassic/swapRoutePreflight.tsfrontend-dapp/src/services/indexer/client.tsskills/AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.mdIndexer
indexer/src/api/best_execution.rsindexer/src/api/hybrid_route_opt.rsindexer/src/api/db_orderbook_sim.rsindexer/src/api/route_solver.rsdocs/route-solver.md,docs/adr/0002-global-best-execution-route-solver.mdContracts
smartcontracts/contracts/pair/src/orderbook.rs,execute_swapRecommended direction
hybrid_simulationwith identicalbook_input/ operations.estimated_amount_out+ on-chain attrs.useHybridBook, receive line uses hybrid sim (indexer or LCD), not pool-onlysimulate_swap.Acceptance criteria
quoteDisclosurestrings reflect actual sim path (or removed after jargon cleanup sibling).Test plan
make test-frontend—SwapPage.test.tsx,TradeMarketOrderPanel.submitSnapshot.test.tsxmake test-indexer-integration— route solve hybrid casesskills/AGENTS_E2E_HYBRID_SWAP.md— strict on-chain hybrid specmake test-e2e—fee-discount-quote-245.spec.ts, hybrid swap specsreturn_amountAttack / abuse test plan
Verification criteria
fee-discount-quote-245.spec.tsextended to hybrid book walk.hybridQuoteMismatch/ pool-only warning flags inSwapPage.tsxsim data.mentioned in issue #411
Hybrid should be enabled by default
mentioned in commit
2e19887e65mentioned in merge request !938
mentioned in commit
476b5f6e43mentioned in commit
a58948b6cbmentioned in merge request !947
mentioned in commit
3de656052amentioned in issue #589
mentioned in issue #597