Limit order insert: honor hint_after for O(1) placement when valid #256

Closed
opened 2026-05-31 13:45:41 +00:00 by PlasticDigits · 9 comments
PlasticDigits commented 2026-05-31 13:45:41 +00:00 (Migrated from gitlab.com)

Summary

Use the hint_after / hint_after_order_id parameter on limit placement and price updates to achieve O(1) insertion when the hint is valid, falling back to the existing head walk capped by max_adjust_steps.

Current codebase

  • Limit orders are FIFO doubly-linked lists per side (HEAD_BID / HEAD_ASK, ORDERS map) in smartcontracts/contracts/pair/src/orderbook.rs.
  • find_insert_bid / find_insert_ask accept hint_after: Option<u64> but parameter is _hint_after — always linear walk from head, incrementing steps until max_adjust_steps (min with MAX_ADJUST_STEPS_HARD_CAP = 256) or insert position found.
  • Comment in code: "indexer hints are advisory; full verify is head-only within max_steps."
  • Call sites pass hint_after:
    • insert_bid_with_id / insert_ask_with_id (placement, batch — currently None in limit_placement.rs),
    • relink_limit_order_price / UpdateLimitOrderPrice (hint_after_order_id).
  • On LimitInsertStepsExceeded, batch placement skips rung (limit_placement.rs); single placement errors.

Why this is needed

  • Deep books: placement/update can cost up to 256 storage reads per order × batch rungs (hard cap 30), dominating limit-place gas.
  • Indexers and dApp already have book topology; hints are on the wire but unused.
  • Bounded fallback preserves safety when hint is stale (cancel, fill, relink elsewhere).

Constraints and guardrails

  • Never trust hint without verification: load hinted order; confirm it exists, correct side, and new (price, id) sorts after hint per bid_before / ask_before and before hint’s next neighbor (or tail).
  • On hint failure: fall back to existing head walk (same max_adjust_steps accounting).
  • Do not weaken total order / FIFO: composite key unchanged (dex-common / docs/limit-orders.md).
  • Malicious hints: worst case = today’s head walk; must not insert at wrong price level.
  • Simulation: N/A (execute only).
  • Migration: none.

Relevant files

Area Path
Insert / relink smartcontracts/contracts/pair/src/orderbook.rs (find_insert_*, link_*, relink_limit_order_price)
Batch place smartcontracts/contracts/pair/src/limit_placement.rs
Execute smartcontracts/contracts/pair/src/contract.rs (execute_update_limit_order_price)
Types smartcontracts/packages/dex-common/src/limit_placement.rs, pair.rs
Docs docs/limit-orders.md, skills/AGENTS_FRONTEND_LIMIT_ORDER_PLACEMENT_GAS.md
Tests orderbook.rs unit tests, limit_order_tests.rs
  1. Implement try_insert_after_hint(side, hint_id, new_price, new_id) -> Option<(prev, next)> with O(1) loads (hint + at most next).
  2. Wire into find_insert_bid / find_insert_ask: if Some(hint) and try succeeds, return; else existing while loop from head.
  3. Optionally pass hint_after from batch API when frontend/indexer supplies previous rung id.
  4. Add tests: valid hint O(1); stale hint (removed order) fallback; wrong-side hint fallback; hint at tail.

Acceptance criteria

  • Valid hint_after inserts in constant steps (≤ 3 order loads) without head walk.
  • Invalid/stale hints fall back to head walk; LimitInsertStepsExceeded unchanged.
  • UpdateLimitOrderPrice benefits when hint provided.
  • Book ordering invariant tests pass (head = best price, FIFO at price).

Test plan (functional paths)

Path Expectation
Empty book Head insert, hint ignored
Hint at correct predecessor Insert after hint
Hint wrong price order Fallback or error per verify
Hint order cancelled Fallback walk
max_adjust_steps = 1 with bad hint Steps exceeded as today
Relink price across levels Hint + fallback

Test plan (attack / abuse / hack vectors)

Vector Verification
Hint to far future id Verify fails → walk or exceed steps
Hint on other maker’s order Verify price-time order, not owner
Concurrent fills before tx Stale hint → safe fallback
Gas griefing via bogus hints Bounded by max_adjust_steps on fallback

Verification criteria

  • cargo test orderbook + limit placement tests green.
  • New unit tests for hint fast-path and fallback.
  • Document hint contract for integrators in docs/limit-orders.md.
## Summary Use the `hint_after` / `hint_after_order_id` parameter on limit placement and price updates to achieve O(1) insertion when the hint is valid, falling back to the existing head walk capped by `max_adjust_steps`. ## Current codebase - Limit orders are FIFO doubly-linked lists per side (`HEAD_BID` / `HEAD_ASK`, `ORDERS` map) in `smartcontracts/contracts/pair/src/orderbook.rs`. - `find_insert_bid` / `find_insert_ask` accept `hint_after: Option<u64>` but parameter is **`_hint_after`** — always linear walk from head, incrementing `steps` until `max_adjust_steps` (min with `MAX_ADJUST_STEPS_HARD_CAP` = 256) or insert position found. - Comment in code: *"indexer hints are advisory; full verify is head-only within max_steps."* - Call sites pass `hint_after`: - `insert_bid_with_id` / `insert_ask_with_id` (placement, batch — currently `None` in `limit_placement.rs`), - `relink_limit_order_price` / `UpdateLimitOrderPrice` (`hint_after_order_id`). - On `LimitInsertStepsExceeded`, batch placement skips rung (`limit_placement.rs`); single placement errors. ## Why this is needed - Deep books: placement/update can cost up to **256 storage reads** per order × batch rungs (hard cap 30), dominating limit-place gas. - Indexers and dApp already have book topology; hints are on the wire but unused. - Bounded fallback preserves safety when hint is stale (cancel, fill, relink elsewhere). ## Constraints and guardrails - **Never** trust hint without verification: load hinted order; confirm it exists, correct side, and new `(price, id)` sorts **after** hint per `bid_before` / `ask_before` and **before** hint’s `next` neighbor (or tail). - On hint failure: fall back to existing head walk (same `max_adjust_steps` accounting). - **Do not** weaken total order / FIFO: composite key unchanged (`dex-common` / `docs/limit-orders.md`). - **Malicious hints:** worst case = today’s head walk; must not insert at wrong price level. - **Simulation:** N/A (execute only). - **Migration:** none. ## Relevant files | Area | Path | |------|------| | Insert / relink | `smartcontracts/contracts/pair/src/orderbook.rs` (`find_insert_*`, `link_*`, `relink_limit_order_price`) | | Batch place | `smartcontracts/contracts/pair/src/limit_placement.rs` | | Execute | `smartcontracts/contracts/pair/src/contract.rs` (`execute_update_limit_order_price`) | | Types | `smartcontracts/packages/dex-common/src/limit_placement.rs`, `pair.rs` | | Docs | `docs/limit-orders.md`, `skills/AGENTS_FRONTEND_LIMIT_ORDER_PLACEMENT_GAS.md` | | Tests | `orderbook.rs` unit tests, `limit_order_tests.rs` | ## Recommended direction 1. Implement `try_insert_after_hint(side, hint_id, new_price, new_id) -> Option<(prev, next)>` with O(1) loads (hint + at most next). 2. Wire into `find_insert_bid` / `find_insert_ask`: if `Some(hint)` and try succeeds, return; else existing while loop from head. 3. Optionally pass `hint_after` from batch API when frontend/indexer supplies previous rung id. 4. Add tests: valid hint O(1); stale hint (removed order) fallback; wrong-side hint fallback; hint at tail. ## Acceptance criteria - [ ] Valid `hint_after` inserts in constant steps (≤ 3 order loads) without head walk. - [ ] Invalid/stale hints fall back to head walk; `LimitInsertStepsExceeded` unchanged. - [ ] `UpdateLimitOrderPrice` benefits when hint provided. - [ ] Book ordering invariant tests pass (head = best price, FIFO at price). ## Test plan (functional paths) | Path | Expectation | |------|-------------| | Empty book | Head insert, hint ignored | | Hint at correct predecessor | Insert after hint | | Hint wrong price order | Fallback or error per verify | | Hint order cancelled | Fallback walk | | `max_adjust_steps = 1` with bad hint | Steps exceeded as today | | Relink price across levels | Hint + fallback | ## Test plan (attack / abuse / hack vectors) | Vector | Verification | |--------|----------------| | Hint to far future id | Verify fails → walk or exceed steps | | Hint on other maker’s order | Verify price-time order, not owner | | Concurrent fills before tx | Stale hint → safe fallback | | Gas griefing via bogus hints | Bounded by `max_adjust_steps` on fallback | ## Verification criteria - `cargo test` orderbook + limit placement tests green. - New unit tests for hint fast-path and fallback. - Document hint contract for integrators in `docs/limit-orders.md`.
PlasticDigits commented 2026-05-31 14:01:55 +00:00 (Migrated from gitlab.com)

mentioned in commit 7f9e962d04

mentioned in commit 7f9e962d04b9f8f21026958c75b5dd7a31abfc6b
PlasticDigits commented 2026-05-31 14:02:03 +00:00 (Migrated from gitlab.com)

Implementation complete (pushed to main — 7f9e962)

Implemented verified O(1) limit-order insertion via hint_after / hint_after_order_id with bounded fallback to the existing head walk.

What changed

  • orderbook.rs: Added try_insert_after_hint_bid / try_insert_after_hint_ask — load hint (+ optional next), verify side, on-book linkage, and price-time order; wired into find_insert_bid / find_insert_ask. Invalid/stale hints fall back unchanged; LimitInsertStepsExceeded semantics preserved.
  • limit_placement.rs: Batch/ladder placement chains each successful rung id as hint_after for the next rung (helps monotonic ladders).
  • UpdateLimitOrderPrice: Already forwarded hint_after_order_id; now benefits from the fast path.
  • Tests: 7 new unit tests in orderbook::tests + adjusted limit_batch_partial_success_skips_book_walk_failures (middle rung price must beat prior rung so hint cannot bypass step cap).
  • Docs: Updated docs/limit-orders.md, invariant L14 + L5 in docs/contracts-security-audit.md, cross-linked skills/AGENTS_FRONTEND_LIMIT_ORDER_PLACEMENT_GAS.md and skills/AGENTS_LIMIT_ORDER_BATCH_LADDER.md.

Verification checklist

  • cd smartcontracts && cargo test -p cl8y-dex-pair hint
  • cd smartcontracts && cargo test -p cl8y-dex-tests limit_order
  • Deep book: place limit with valid hint_after_order_id from indexer limit-book walk — confirm placement succeeds with Low (16) steps where head walk would fail
  • Stale hint (cancelled predecessor): confirm safe fallback insert at correct price level
  • UpdateLimitOrderPrice with hint from book neighbor — confirm relink without extra head walk gas
  • Batch ladder (5+ rungs, monotonic prices): confirm all rungs place; compare gas vs pre-hint baseline on LocalTerra
  • Malicious hint (wrong side / far-future id): confirm no ordering corruption; worst case = bounded head walk

Follow-ups

  • Frontend/indexer: Optionally pass hint_after_order_id on single placement and price-edit txs when deep-book UI knows the predecessor id (wire already exists in pair.ts for price updates).

@qa-agent-team — please verify the checklist above on LocalTerra (or staging) and confirm book ordering invariants (head = best price, FIFO at price) after hint-assisted inserts. Issue left open pending QA sign-off.

## Implementation complete (pushed to `main` — `7f9e962`) Implemented verified O(1) limit-order insertion via `hint_after` / `hint_after_order_id` with bounded fallback to the existing head walk. ### What changed - **`orderbook.rs`**: Added `try_insert_after_hint_bid` / `try_insert_after_hint_ask` — load hint (+ optional `next`), verify side, on-book linkage, and price-time order; wired into `find_insert_bid` / `find_insert_ask`. Invalid/stale hints fall back unchanged; `LimitInsertStepsExceeded` semantics preserved. - **`limit_placement.rs`**: Batch/ladder placement chains each successful rung id as `hint_after` for the next rung (helps monotonic ladders). - **`UpdateLimitOrderPrice`**: Already forwarded `hint_after_order_id`; now benefits from the fast path. - **Tests**: 7 new unit tests in `orderbook::tests` + adjusted `limit_batch_partial_success_skips_book_walk_failures` (middle rung price must beat prior rung so hint cannot bypass step cap). - **Docs**: Updated `docs/limit-orders.md`, invariant **L14** + **L5** in `docs/contracts-security-audit.md`, cross-linked `skills/AGENTS_FRONTEND_LIMIT_ORDER_PLACEMENT_GAS.md` and `skills/AGENTS_LIMIT_ORDER_BATCH_LADDER.md`. ### Verification checklist - [ ] `cd smartcontracts && cargo test -p cl8y-dex-pair hint` - [ ] `cd smartcontracts && cargo test -p cl8y-dex-tests limit_order` - [ ] Deep book: place limit with valid `hint_after_order_id` from indexer `limit-book` walk — confirm placement succeeds with Low (16) steps where head walk would fail - [ ] Stale hint (cancelled predecessor): confirm safe fallback insert at correct price level - [ ] `UpdateLimitOrderPrice` with hint from book neighbor — confirm relink without extra head walk gas - [ ] Batch ladder (5+ rungs, monotonic prices): confirm all rungs place; compare gas vs pre-hint baseline on LocalTerra - [ ] Malicious hint (wrong side / far-future id): confirm no ordering corruption; worst case = bounded head walk ### Follow-ups - **Frontend/indexer**: Optionally pass `hint_after_order_id` on single placement and price-edit txs when deep-book UI knows the predecessor id (wire already exists in `pair.ts` for price updates). --- **@qa-agent-team** — please verify the checklist above on LocalTerra (or staging) and confirm book ordering invariants (head = best price, FIFO at price) after hint-assisted inserts. Issue left open pending QA sign-off.
PlasticDigits commented 2026-05-31 14:03:08 +00:00 (Migrated from gitlab.com)

mentioned in issue #261

mentioned in issue #261
Brouie commented 2026-06-01 03:44:36 +00:00 (Migrated from gitlab.com)

Verified #256 on main @ 6b22feb (7f9e962, live on LocalTerra). Source + the 7 new hint tests + live A/B demos. All acceptance criteria covered, ordering invariants hold, security checks confirmed.

Headline — live A/B (the O(1) benefit, proven functionally)

On a deep book, a valid hint places/relinks at a low max_adjust_steps where the no-hint head walk hits the cap and reverts — same operation, same cap, hint succeeds:

  • [3] deep run of 20 bids @1.70. Single insert @1.70, max_adjust_steps=16:
    • no hint → revert: "Limit batch placed no rungs (1 skipped due to book-walk cap)" (head walk through the ~20 prefix exceeded 16)
    • hint=407 (run tail) → placed id 408 @1.70, prev=407 — O(1) insert under the same cap
  • [5] UpdateLimitOrderPrice relink of a fresh high-id order to 1.70 (deep), max_adjust_steps=2:
    • no hint → revert: "Limit order insert exceeded max adjust steps (2)"
    • hint=408 → code=0, relinked to 1.70

This is a stronger benefit proof than a gas delta: it shows the hint path completing work the bounded head walk physically can't, at the same step budget.

Acceptance criteria

  • AC1 — valid hint → O(1), no head walk: source try_insert_after_hint_{bid,ask} returns the position from ≤2 loads; find_insert_* returns immediately. Tests insert_bid_with_valid_hint_after_is_o1, insert_ask_with_valid_hint_after. Live: 3b + 5b.
  • AC2 — invalid/stale → fallback; LimitInsertStepsExceeded unchanged: source — failed verify returns None and the head walk runs on the shared *steps counter, so a bad hint's loads count toward max_adjust_steps (can't bypass the cap). Tests insert_bid_stale_hint_falls_back_to_head_walk, insert_bid_bad_hint_with_max_steps_one_errors. Live: 4 (stale), 3a/5a (cap hit → revert).
  • AC3 — UpdateLimitOrderPrice benefits: source forwards hint_after_order_id → relink_limit_order_price → fast path. Test relink_limit_order_price_uses_hint. Live: 5b at max_adjust_steps=2.
  • AC4 — ordering invariants (head=best, FIFO at price): source uses the same bid_before/ask_before composite-key comparators as the walk (total order not weakened). Live: post-demo book walk — head=best (1.60), prices non-increasing, FIFO (ascending id) at equal price, no violations.

Security — the hint is verified, never trusted (prominent)

try_insert_after_hint_* loads the hint (+ at most its next) and rejects unless: it exists, correct side, on-book linkage (prev set or it is the head — not a dangling/cancelled row), and price-time order on both sides (new sorts after the hint and before the hint's next). Any failure → None → bounded head-walk fallback on the shared step counter. So the worst case for a bogus hint is today's bounded walk; it can neither insert at a wrong level nor exceed the step budget. Confirmed live:

  • [7a] far-future id 999999999 → fallback → correct 1.55 level
  • [7b] wrong-side hint (an ask id used for a bid) → side check → fallback → correct 1.56 level
  • [4] stale hint (predecessor cancelled mid-flow) → fallback → correct 1.60 level, prev = the surviving neighbor

Plus tests insert_bid_wrong_side_hint_falls_back, insert_bid_stale_hint_falls_back_to_head_walk, insert_bid_bad_hint_with_max_steps_one_errors.

Functional + attack plans

  • Functional (empty/head insert, hint at predecessor, wrong price order, cancelled→fallback, max_adjust_steps=1 bad hint, relink across levels): 7 hint unit tests + limit_batch_item_explicit_hint_places_on_deep_book + live 3/4/5/7.
  • Attack (far-future id, other maker's order, concurrent-fill stale, gas-griefing via bogus hints): owner-agnostic price-time/side verify + shared-step bounded fallback (source) + 7a/7b/4 live + tests.

Dev checklist

  • cargo test -p cl8y-dex-pair hint — 7/0
  • cargo test -p cl8y-dex-tests limit_order — 55/0 (incl. adjusted limit_batch_partial_success_skips_book_walk_failures)
  • Deep book, valid hint_after_order_id → places at low steps where head walk fails — live 3a/3b
  • Stale hint (cancelled predecessor) → safe fallback at correct price level — live 4
  • UpdateLimitOrderPrice with book-neighbor hint → relink without head-walk gas — live 5b
  • Batch ladder (8 monotonic rungs, max_adjust_steps=2) → all rungs place (chaining item.hint_after_order_id.or(last_placed_hint)) — live 6
  • Malicious hint (wrong side / far-future) → no ordering corruption; worst case = bounded head walk — live 7a/7b + source

Layer honesty + transparency

  • "≤3 order loads" is source/test-level — individual storage loads aren't observable from a tx; what's live-verified is the consequence (the hint completes inserts/relinks the bounded head walk reverts on, and ordering stays correct).
  • Transparency: a single-rung batch whose only rung is skipped reverts the whole tx ("Limit batch placed no rungs") rather than a silent no-op — this protects the CW20 escrow sent with the placement, and matches the intended "single placement errors" behavior.

One open item (flagged, not chased)

Gas vs a pre-hint baseline can't be shown as a numeric before/after — no pre-#256 build deployed (same structural gap as #252/#254/#255). The A/B above demonstrates the benefit more strongly than a gas delta would, so I'm not chasing it.

@PlasticDigits — verified and signed off from my side, no issues found (O(1) fast path, verified-never-trusted hint, ordering invariants all hold live); over to you to close.

Verified #256 on `main` @ `6b22feb` (`7f9e962`, live on LocalTerra). Source + the 7 new hint tests + live A/B demos. All acceptance criteria covered, ordering invariants hold, security checks confirmed. ## Headline — live A/B (the O(1) benefit, proven functionally) On a deep book, a **valid hint places/relinks at a low `max_adjust_steps` where the no-hint head walk hits the cap and reverts** — same operation, same cap, hint succeeds: - **[3] deep run of 20 bids @1.70.** Single insert @1.70, `max_adjust_steps=16`: - no hint → **revert**: *"Limit batch placed no rungs (1 skipped due to book-walk cap)"* (head walk through the ~20 prefix exceeded 16) - `hint=407` (run tail) → **placed** id 408 @1.70, `prev=407` — O(1) insert under the same cap - **[5] UpdateLimitOrderPrice relink** of a fresh high-id order to 1.70 (deep), `max_adjust_steps=2`: - no hint → **revert**: *"Limit order insert exceeded max adjust steps (2)"* - `hint=408` → **`code=0`**, relinked to 1.70 This is a stronger benefit proof than a gas delta: it shows the hint path completing work the bounded head walk physically can't, at the same step budget. ## Acceptance criteria - **AC1 — valid hint → O(1), no head walk:** source `try_insert_after_hint_{bid,ask}` returns the position from ≤2 loads; `find_insert_*` returns immediately. Tests `insert_bid_with_valid_hint_after_is_o1`, `insert_ask_with_valid_hint_after`. Live: 3b + 5b. - **AC2 — invalid/stale → fallback; `LimitInsertStepsExceeded` unchanged:** source — failed verify returns `None` and the head walk runs on the **shared `*steps` counter**, so a bad hint's loads count toward `max_adjust_steps` (can't bypass the cap). Tests `insert_bid_stale_hint_falls_back_to_head_walk`, `insert_bid_bad_hint_with_max_steps_one_errors`. Live: 4 (stale), 3a/5a (cap hit → revert). - **AC3 — UpdateLimitOrderPrice benefits:** source forwards `hint_after_order_id` → `relink_limit_order_price` → fast path. Test `relink_limit_order_price_uses_hint`. Live: 5b at `max_adjust_steps=2`. - **AC4 — ordering invariants (head=best, FIFO at price):** source uses the same `bid_before`/`ask_before` composite-key comparators as the walk (total order not weakened). Live: post-demo book walk — head=best (1.60), prices non-increasing, FIFO (ascending id) at equal price, no violations. ## Security — the hint is verified, never trusted (prominent) `try_insert_after_hint_*` loads the hint (+ at most its `next`) and rejects unless: it exists, **correct side**, **on-book linkage** (`prev` set or it is the head — not a dangling/cancelled row), and **price-time order on both sides** (`new` sorts after the hint and before the hint's `next`). Any failure → `None` → bounded head-walk fallback on the shared step counter. So the worst case for a bogus hint is today's bounded walk; it can neither insert at a wrong level nor exceed the step budget. Confirmed live: - **[7a] far-future id `999999999`** → fallback → correct 1.55 level - **[7b] wrong-side hint (an ask id used for a bid)** → side check → fallback → correct 1.56 level - **[4] stale hint (predecessor cancelled mid-flow)** → fallback → correct 1.60 level, `prev` = the surviving neighbor Plus tests `insert_bid_wrong_side_hint_falls_back`, `insert_bid_stale_hint_falls_back_to_head_walk`, `insert_bid_bad_hint_with_max_steps_one_errors`. ## Functional + attack plans - Functional (empty/head insert, hint at predecessor, wrong price order, cancelled→fallback, `max_adjust_steps=1` bad hint, relink across levels): 7 hint unit tests + `limit_batch_item_explicit_hint_places_on_deep_book` + live 3/4/5/7. - Attack (far-future id, other maker's order, concurrent-fill stale, gas-griefing via bogus hints): owner-agnostic price-time/side verify + shared-step bounded fallback (source) + 7a/7b/4 live + tests. ## Dev checklist - [x] `cargo test -p cl8y-dex-pair hint` — 7/0 - [x] `cargo test -p cl8y-dex-tests limit_order` — 55/0 (incl. adjusted `limit_batch_partial_success_skips_book_walk_failures`) - [x] Deep book, valid `hint_after_order_id` → places at low steps where head walk fails — live 3a/3b - [x] Stale hint (cancelled predecessor) → safe fallback at correct price level — live 4 - [x] `UpdateLimitOrderPrice` with book-neighbor hint → relink without head-walk gas — live 5b - [x] Batch ladder (8 monotonic rungs, `max_adjust_steps=2`) → all rungs place (chaining `item.hint_after_order_id.or(last_placed_hint)`) — live 6 - [x] Malicious hint (wrong side / far-future) → no ordering corruption; worst case = bounded head walk — live 7a/7b + source ## Layer honesty + transparency - **"≤3 order loads" is source/test-level** — individual storage loads aren't observable from a tx; what's live-verified is the consequence (the hint completes inserts/relinks the bounded head walk reverts on, and ordering stays correct). - **Transparency:** a single-rung batch whose only rung is skipped reverts the whole tx (*"Limit batch placed no rungs"*) rather than a silent no-op — this protects the CW20 escrow sent with the placement, and matches the intended "single placement errors" behavior. ## One open item (flagged, not chased) Gas vs a pre-hint baseline can't be shown as a numeric before/after — no pre-#256 build deployed (same structural gap as #252/#254/#255). The A/B above demonstrates the benefit more strongly than a gas delta would, so I'm not chasing it. @PlasticDigits — verified and signed off from my side, no issues found (O(1) fast path, verified-never-trusted hint, ordering invariants all hold live); over to you to close.
PlasticDigits commented 2026-06-01 03:55:14 +00:00 (Migrated from gitlab.com)

Instead of head walk fallback, the fallback should be to walk from the hint up/down depending on which direction the hint is incorrect. This is because usually an invalid hint is off by only a few units due to other tx arriving between when the user signed and when his tx is executed onchain.

No need for gas vs prehint baseline - current gas expenditure is acceptable.

Instead of head walk fallback, the fallback should be to walk from the hint up/down depending on which direction the hint is incorrect. This is because usually an invalid hint is off by only a few units due to other tx arriving between when the user signed and when his tx is executed onchain. No need for gas vs prehint baseline - current gas expenditure is acceptable.
PlasticDigits commented 2026-06-01 03:56:55 +00:00 (Migrated from gitlab.com)

mentioned in issue #265

mentioned in issue #265
PlasticDigits commented 2026-06-01 03:56:59 +00:00 (Migrated from gitlab.com)

Closing #256 — O(1) verified hint insertion shipped on main (7f9e962) and QA-signed off by @Brouie.

Follow-up: directional hint fallback (walk from hint toward head/tail on near-miss verify failure instead of always restarting from book head) is tracked in #265 — per near-miss fallback requirement.

Closing #256 — O(1) verified hint insertion shipped on `main` (`7f9e962`) and QA-signed off by @Brouie. **Follow-up:** directional hint fallback (walk from hint toward head/tail on near-miss verify failure instead of always restarting from book head) is tracked in #265 — per [near-miss fallback requirement](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/256#note_3404156286).
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-01 03:57:05 +00:00
Brouie commented 2026-06-01 04:11:04 +00:00 (Migrated from gitlab.com)

mentioned in issue #257

mentioned in issue #257
Brouie commented 2026-06-01 05:25:47 +00:00 (Migrated from gitlab.com)

mentioned in issue #258

mentioned in issue #258
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#256
No description provided.