OE-3 UI: Limit ladder crossing guard blocks ASK side only; BID orders above market price still accepted after MR !39 fix (follow up #297) #385

Closed
opened 2026-06-16 15:15:25 +00:00 by totdking · 13 comments
totdking commented 2026-06-16 15:15:25 +00:00 (Migrated from gitlab.com)
No description provided.
totdking commented 2026-06-16 15:18:07 +00:00 (Migrated from gitlab.com)

changed title from UI: Limit ladder crossing guard blocks ASK side only; BID orders above market price still accepted after MR !757 fix (follow up #297) to OE-3 UI: Limit ladder crossing guard blocks ASK side only; BID orders above market price still accepted after MR !757 fix (follow up #297)

<p>changed title from <code class="idiff">UI: Limit ladder crossing guard blocks ASK side only; BID orders above market price still accepted after MR !757 fix (follow up #297)</code> to <code class="idiff"><span class="idiff left right addition">OE-3 </span>UI: Limit ladder crossing guard blocks ASK side only; BID orders above market price still accepted after MR !757 fix (follow up #297)</code></p>
totdking commented 2026-06-16 15:18:07 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
totdking commented 2026-06-16 15:18:09 +00:00 (Migrated from gitlab.com)

Summary

After MR !757 (merged) ported the crossing guard into LimitOrderLadderPanel.tsx, manual browser verification on LocalTerra shows the guard is only enforced in one direction. ASK ladders priced below the current market price are correctly blocked with an inline warning. BID ladders priced above the current market price are still accepted and placed on-chain without any warning or block.

The Vitest suite in LimitOrderLadderPanel.crossing.test.tsx passes 7/7 for both directions, meaning the asymmetry is present in the live runtime but not caught by the component tests.


Observed behavior

Tested on the CORAL/EMBER pair (market price approximately 0.8 to 1.1):

Ladder type Price range set Expected Actual
BID ladder 15 to 18 (above market) Blocked with crossing warning Accepted -- all rungs placed on-chain
ASK ladder 0.1 to 0.5 (below market) Blocked with crossing warning Correctly blocked with inline warning

Reproduction steps

  1. Open http://localhost:5173/limits or /trade/:pairAddr
  2. Connect Keplr wallet (funded test account)
  3. Select the CORAL/EMBER pair and note the current market price (approximately 0.8 to 1.1)
  4. Open the Limit Ladder panel, set ladder type to BID, start price 2, end price 10 (both above market)
  5. Observe: no crossing warning shown, submit button remains enabled
  6. Submit the ladder
  7. Observe: all rungs are broadcast and confirmed on-chain without any crossing disclosure
  8. Reset and repeat with ASK, start price 0.1, end price 0.5 (both below market)
  9. Observe: inline crossing warning appears and submit is blocked (correct behavior)

Expected behavior

Both directions should be enforced symmetrically. A BID ladder with any rung priced above the best ask should show the inline crossing warning ("N of M rungs will cross the market...") and disable the submit button, matching the behavior already working for ASK ladders.


Actual behavior

The ASK side crossing guard is active. The BID side crossing guard is not enforced in the live browser. BID rungs priced above market are placed on-chain silently with no warning.


Technical context

The fix in MR !757 ported describeLimitCrossingBlocker into the ladder panel via a ladderCrossingGate memo and a mutation hard-guard. The Vitest suite exercises both sides and passes. The live asymmetry suggests the BID path in the ladderCrossingGate memo or the useTradeBestBookPrices hook is not resolving correctly at runtime (possibly a stale or undefined bestAsk value on the BID path, causing the guard to be silently skipped rather than triggered).

The single-order form in TradeOrderTicket.tsx calls describeLimitCrossingBlocker(side, price, bestBid, bestAsk) symmetrically for both sides. The ladder port should be checked against this reference implementation for parity.


Environment

  • Chain: localterra
  • LCD: http://localhost:1317
  • Wallet: Keplr (Terra Classic)
  • Browser: Chrome
  • Page: /limits -- Limit Ladder panel
  • Pair tested: CORAL/EMBER
  • Branch: main (after MR !757 and MR !767 merged)

Severity: P2 -- BID crossing orders are submitted silently; users can place unintended taker fills with no slippage UX. The single-order form warns correctly; the ladder form does not for the BID direction.

Related checklist items: OE-3

Regression of: #297 (fix is partial)

Video link in https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/297#note_3459942096

cc: @PlasticDigits

### Summary After MR !757 (merged) ported the crossing guard into `LimitOrderLadderPanel.tsx`, manual browser verification on LocalTerra shows the guard is only enforced in one direction. ASK ladders priced below the current market price are correctly blocked with an inline warning. BID ladders priced above the current market price are still accepted and placed on-chain without any warning or block. The Vitest suite in `LimitOrderLadderPanel.crossing.test.tsx` passes 7/7 for both directions, meaning the asymmetry is present in the live runtime but not caught by the component tests. --- ### Observed behavior Tested on the CORAL/EMBER pair (market price approximately 0.8 to 1.1): | Ladder type | Price range set | Expected | Actual | |-------------|-----------------|----------|--------| | BID ladder | 15 to 18 (above market) | Blocked with crossing warning | Accepted -- all rungs placed on-chain | | ASK ladder | 0.1 to 0.5 (below market) | Blocked with crossing warning | Correctly blocked with inline warning | --- ### Reproduction steps 1. Open `http://localhost:5173/limits` or `/trade/:pairAddr` 2. Connect Keplr wallet (funded test account) 3. Select the CORAL/EMBER pair and note the current market price (approximately 0.8 to 1.1) 4. Open the Limit Ladder panel, set ladder type to BID, start price 2, end price 10 (both above market) 5. Observe: no crossing warning shown, submit button remains enabled 6. Submit the ladder 7. Observe: all rungs are broadcast and confirmed on-chain without any crossing disclosure 8. Reset and repeat with ASK, start price 0.1, end price 0.5 (both below market) 9. Observe: inline crossing warning appears and submit is blocked (correct behavior) --- ### Expected behavior Both directions should be enforced symmetrically. A BID ladder with any rung priced above the best ask should show the inline crossing warning ("N of M rungs will cross the market...") and disable the submit button, matching the behavior already working for ASK ladders. --- ### Actual behavior The ASK side crossing guard is active. The BID side crossing guard is not enforced in the live browser. BID rungs priced above market are placed on-chain silently with no warning. --- ### Technical context The fix in MR !757 ported `describeLimitCrossingBlocker` into the ladder panel via a `ladderCrossingGate` memo and a mutation hard-guard. The Vitest suite exercises both sides and passes. The live asymmetry suggests the BID path in the `ladderCrossingGate` memo or the `useTradeBestBookPrices` hook is not resolving correctly at runtime (possibly a stale or undefined `bestAsk` value on the BID path, causing the guard to be silently skipped rather than triggered). The single-order form in `TradeOrderTicket.tsx` calls `describeLimitCrossingBlocker(side, price, bestBid, bestAsk)` symmetrically for both sides. The ladder port should be checked against this reference implementation for parity. --- ### Environment - Chain: localterra - LCD: [http://localhost:1317](http://localhost:1317) - Wallet: Keplr (Terra Classic) - Browser: Chrome - Page: `/limits` -- Limit Ladder panel - Pair tested: CORAL/EMBER - Branch: main (after MR !757 and MR !767 merged) --- **Severity:** P2 -- BID crossing orders are submitted silently; users can place unintended taker fills with no slippage UX. The single-order form warns correctly; the ladder form does not for the BID direction. **Related checklist items:** OE-3 **Regression of:** #297 (fix is partial) Video link in https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/297#note_3459942096 cc: @PlasticDigits
totdking commented 2026-06-16 15:32:22 +00:00 (Migrated from gitlab.com)

mentioned in issue #291

mentioned in issue #291
PlasticDigits commented 2026-06-16 15:33:45 +00:00 (Migrated from gitlab.com)

mentioned in commit 5850aa28ba

mentioned in commit 5850aa28ba51d5ab36fdeaa7230c448cba24e8c1
PlasticDigits commented 2026-06-16 15:34:17 +00:00 (Migrated from gitlab.com)

mentioned in merge request !914

mentioned in merge request !914
PlasticDigits commented 2026-06-16 15:36:51 +00:00 (Migrated from gitlab.com)

mentioned in commit 8a5c9e85a2

mentioned in commit 8a5c9e85a2a2ce6c6e500a1e0ac4cb1faf79af90
totdking commented 2026-06-16 15:46:39 +00:00 (Migrated from gitlab.com)

Verification

Ladder tx execution works as expected. The place-N-rung ladder button is disabled on invalid price range for either bid / ask

Good for a close

## Verification Ladder tx execution works as expected. The place-N-rung ladder button is disabled on invalid price range for either bid / ask Good for a close
PlasticDigits commented 2026-06-16 15:58:53 +00:00 (Migrated from gitlab.com)

Verification — #385 (OE-3 BID ladder crossing guard)

Fix under test: 5850aa28 — describeLimitCrossingBlockerWithRef, refToken1PerToken0 wiring in LimitOrderLadderPanel, and limitBookPage cache seed in useTradeBestBookPrices.

Results

Check Result How verified
Vitest — LimitOrderLadderPanel.crossing + limitOrderNonCrossing PASS (9/9) cd frontend-dapp && npm test -- LimitOrderLadderPanel.crossing limitOrderNonCrossing
BID ladder above market blocked (inline warning + disabled submit) PASS Playwright on LocalTerra /limits (EMBER/CORAL pair), Simulated Wallet, start=15 end=18 — #ladder-crossing-guard shows "rungs will cross the market", submit disabled
ASK ladder below market blocked (inline warning + disabled submit) PASS Same session, ASK side start=0.1 end=0.5 — guard visible, submit disabled
BID guard with empty best_ask + reference fallback (#385 regression) PASS Covered by unit test blocks bid ladder when best ask is missing but reference price is below rungs (#385); live EMBER/CORAL book heads were empty (no resting bid/ask) during browser run — guard still blocked BID rungs via reference path
Issue reproduction steps (CORAL/EMBER, Keplr/simulated wallet) PASS Reproduced via Playwright against make dev + fresh deploy-local + indexer on :3001
Docs / skill invariants (AGENTS_LIMIT_ORDER_BATCH_LADDER.md, docs/frontend.md) PASS Cross-links and guard description match merged implementation

Environment

  • Branch: main @ 8a5c9e85
  • LocalTerra + indexer + frontend (http://127.0.0.1:5173/limits)
  • Pair: EMBER/CORAL (terra16jd56…tdy0g); book heads empty at test time (reference-fallback path exercised for BID)

Follow-ups

  • Consider adding a committed verify-issue-385-crossing.spec.ts + make verify-issue-385 target (mirroring #295) so future regressions are caught in CI smoke without manual LocalTerra setup.

Closing — fix verified on main.

## Verification — #385 (OE-3 BID ladder crossing guard) **Fix under test:** `5850aa28` — `describeLimitCrossingBlockerWithRef`, `refToken1PerToken0` wiring in `LimitOrderLadderPanel`, and `limitBookPage` cache seed in `useTradeBestBookPrices`. ### Results | Check | Result | How verified | |-------|--------|--------------| | Vitest — `LimitOrderLadderPanel.crossing` + `limitOrderNonCrossing` | **PASS** (9/9) | `cd frontend-dapp && npm test -- LimitOrderLadderPanel.crossing limitOrderNonCrossing` | | BID ladder above market blocked (inline warning + disabled submit) | **PASS** | Playwright on LocalTerra `/limits` (EMBER/CORAL pair), Simulated Wallet, start=15 end=18 — `#ladder-crossing-guard` shows "rungs will cross the market", submit disabled | | ASK ladder below market blocked (inline warning + disabled submit) | **PASS** | Same session, ASK side start=0.1 end=0.5 — guard visible, submit disabled | | BID guard with empty `best_ask` + reference fallback (#385 regression) | **PASS** | Covered by unit test `blocks bid ladder when best ask is missing but reference price is below rungs (#385)`; live EMBER/CORAL book heads were empty (no resting bid/ask) during browser run — guard still blocked BID rungs via reference path | | Issue reproduction steps (CORAL/EMBER, Keplr/simulated wallet) | **PASS** | Reproduced via Playwright against `make dev` + fresh `deploy-local` + indexer on `:3001` | | Docs / skill invariants (`AGENTS_LIMIT_ORDER_BATCH_LADDER.md`, `docs/frontend.md`) | **PASS** | Cross-links and guard description match merged implementation | ### Environment - Branch: `main` @ `8a5c9e85` - LocalTerra + indexer + frontend (`http://127.0.0.1:5173/limits`) - Pair: EMBER/CORAL (`terra16jd56…tdy0g`); book heads empty at test time (reference-fallback path exercised for BID) ### Follow-ups - Consider adding a committed `verify-issue-385-crossing.spec.ts` + `make verify-issue-385` target (mirroring #295) so future regressions are caught in CI smoke without manual LocalTerra setup. Closing — fix verified on main.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-16 15:58:54 +00:00
PlasticDigits commented 2026-08-17 10:26:08 +00:00 (Migrated from gitlab.com)

mentioned in issue #546

mentioned in issue #546
PlasticDigits commented 2026-08-24 03:15:17 +00:00 (Migrated from gitlab.com)

mentioned in issue #617

mentioned in issue #617
PlasticDigits commented 2026-08-24 03:15:45 +00:00 (Migrated from gitlab.com)

mentioned in issue #619

mentioned in issue #619
PlasticDigits commented 2026-09-01 08:14:37 +00:00 (Migrated from gitlab.com)

mentioned in issue #717

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