Contracts: remove legacy Simulation; HybridSimulation default everywhere #190
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#190
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
Pair/router legacy
Simulation/ReverseSimulationremain pool-only while Pattern C execution uses the on-chain FIFO book. Integrators and tooling that call legacy queries can mis-quote hybrid routes (invariant L8 indocs/contracts-security-audit.md).Evidence / context
smartcontracts/contracts/pair/src/lib.rs— pool-only legacy queries documented.HybridSimulation/HybridReverseSimulation; adoption is partial.simulationin places (swapRoutePreflight.ts).Proposed solution
Simulation/ReverseSimulation(or make them thin aliases that require explicit zero-book hybrid params with documented sunset).HybridSimulation/HybridReverseSimulation(zerobook_input= pool-only behavior).dex-common, integrator docs, and breaking-change notes.Acceptance criteria
Simulationfor user-facing quotes.SimulateSwapOperationsuses hybrid queries wheneverhybridis set; default path documented for pool-only (zero book leg).Priority
P1 (correctness / launch blocker for hybrid honesty)
Completely deprecate and remove legacy paths -as we are not yet deployed backwards compatibility not required.
mentioned in commit
7d57ccf535mentioned in commit
4b5365e0b9Implemented (#190) — merged to
main(7d57ccf)Removed legacy pair
Simulation/ReverseSimulationqueries and migrated all quoting toHybridSimulation/HybridReverseSimulationonly (per issue note: no backwards-compat aliases).What changed
QueryMsg::Simulation/ReverseSimulation; addedpool_only_hybrid_params()andpool_only_hybrid_template()index-common. Routersimulate_swap_operationsalways uses hybrid queries (pool-only whenterra_swap.hybridis null).hybrid_route_optno longer calls legacysimulationLCD; degraded path useshybrid_simulationwithbook_input: 0.simulateSwap/reverseSimulateSwap/swapRoutePreflightusehybrid_simulationviapoolOnlyHybrid.ts.route/solve/besttext), integrator + limit-order docs; newskills/AGENTS_HYBRID_QUOTING.md.Verification checklist
hybrid_simulationwithbook_input: "0"matches prior pool-only quotes on a funded pairhybrid_reverse_simulationwithpool_input: "1",book_input: "0"returns sensibleoffer_amountsimulate_swap_operationswithhybrid: nullhops matches direct pair hybrid pool-only quotessimulateSwap→ hybrid)GET route/solve?hybrid_optimize=truestill returnsestimated_amount_out(nosimulationLCD)cargo test -p cl8y-dex-tests limit_order_testsgreen on your machine@brouie — please run the checklist on your environment and confirm before we close this issue.
mentioned in commit
9312fc01famentioned in commit
6416ee50aaVerification complete (2026-05-27)
Ran the full checklist on LocalTerra + host Postgres + indexer :3001 + frontend :5173 + bot swarm (30/30).
Checklist
hybrid_simulationwithbook_input: "0"— EMBER→CORAL 1M offer →return_amount950297,book_return_amount0hybrid_reverse_simulationwithpool_input: "1",book_input: "0"— sensibleoffer_amount(1052 for ask 1000 CORAL)simulate_swap_operationswithhybrid: null— amount 950297 matches direct pair pool-only hybridsimulateSwap), route spread check renderedGET /api/v1/route/solve?hybrid_optimize=true—estimated_amount_out950297, 1 hopcargo test -p cl8y-dex-tests limit_order_tests— 34 passedcargo test --test api_route_solve— 14 passed (after fix below)Bug fixed
Indexer
hybrid_route_optdegraded fallback still queried removed legacysimulationLCD → 502 on grid failure. Replaced with pool-onlyhybrid_simulation(book_input: 0). Merged tomainas6416ee5, pushed; indexer restarted locally.Acceptance criteria
All production quoting paths use hybrid queries only; router/indexer/frontend verified on live stack.
mentioned in issue #209
mentioned in commit
616c44c6e9mentioned in issue #332
mentioned in issue #707
mentioned in issue #708
mentioned in issue #713