Design: ADR for hybrid quoting (L8 / simulation vs execution) #64

Closed
opened 2026-04-09 03:23:39 +00:00 by PlasticDigits · 7 comments
PlasticDigits commented 2026-04-09 03:23:39 +00:00 (Migrated from gitlab.com)

Type

needs-design — choose approach before major implementation.

Evidence

  • Invariant L8 docs/contracts-security-audit.md
  • smartcontracts/contracts/router/src/contract.rs query_simulate_swap_operations ignores hybrid
  • Pair Simulation is pool-only per docs/limit-orders.md

Rationale

Simulated output can diverge from executed hybrid swaps; ADR picks new query vs off-chain estimator vs disclaim-only.

Dependencies

None.

Acceptance criteria

  • ADR committed under docs/ (e.g. docs/adr/)
  • Linked from docs/limit-orders.md

Epic

#56

## Type **needs-design** — choose approach before major implementation. ## Evidence - Invariant **L8** `docs/contracts-security-audit.md` - `smartcontracts/contracts/router/src/contract.rs` `query_simulate_swap_operations` ignores `hybrid` - Pair `Simulation` is pool-only per `docs/limit-orders.md` ## Rationale Simulated output can diverge from executed hybrid swaps; ADR picks new query vs off-chain estimator vs disclaim-only. ## Dependencies None. ## Acceptance criteria - [ ] ADR committed under `docs/` (e.g. `docs/adr/`) - [ ] Linked from `docs/limit-orders.md` ## Epic #56
PlasticDigits commented 2026-04-09 03:23:40 +00:00 (Migrated from gitlab.com)

marked this issue as related to #56

marked this issue as related to #56
PlasticDigits commented 2026-04-09 03:23:41 +00:00 (Migrated from gitlab.com)

mentioned in issue #65

mentioned in issue #65
PlasticDigits commented 2026-04-09 03:24:01 +00:00 (Migrated from gitlab.com)

mentioned in issue #75

mentioned in issue #75
PlasticDigits commented 2026-04-09 03:24:02 +00:00 (Migrated from gitlab.com)

marked this issue as related to #75

marked this issue as related to #75
PlasticDigits commented 2026-04-09 03:24:04 +00:00 (Migrated from gitlab.com)

mentioned in issue #76

mentioned in issue #76
PlasticDigits commented 2026-04-09 03:24:16 +00:00 (Migrated from gitlab.com)

mentioned in issue #81

mentioned in issue #81
Brouie commented 2026-04-22 04:12:32 +00:00 (Migrated from gitlab.com)

@PlasticDigits checked both ADR + implementation.

ADR exists and is accepted: docs/adr/0001-hybrid-quoting-and-routing.md — decides hybrid quoting via pair-level HybridSimulation / HybridReverseSimulation read-only book walk + pool leg, with legs summing to per-hop simulated amount. Reverse hybrid uses binary search over total offer to find minimum achieving target net output.

Implementation present:

  • smartcontracts/packages/dex-common/src/pair.rs — QueryMsg variants + response structs
  • smartcontracts/contracts/pair/src/contract.rs:1802 — query handlers wired in

Nothing appears to be blocking — design is accepted and implemented. If I'm missing a deeper gap (e.g. spec-vs-impl divergence or L8 invariant test coverage you want), let me know specifics.

@PlasticDigits checked both ADR + implementation. **ADR exists and is accepted:** `docs/adr/0001-hybrid-quoting-and-routing.md` — decides hybrid quoting via pair-level `HybridSimulation` / `HybridReverseSimulation` read-only book walk + pool leg, with legs summing to per-hop simulated amount. Reverse hybrid uses binary search over total offer to find minimum achieving target net output. **Implementation present:** - `smartcontracts/packages/dex-common/src/pair.rs` — QueryMsg variants + response structs - `smartcontracts/contracts/pair/src/contract.rs:1802` — query handlers wired in Nothing appears to be blocking — design is accepted and implemented. If I'm missing a deeper gap (e.g. spec-vs-impl divergence or L8 invariant test coverage you want), let me know specifics.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-04-22 04:47:32 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#64
No description provided.