SEC-E07: Playwright E2E for swap route display vs on-chain hops (#428) #963

Merged
PlasticDigits merged 1 commit from issue-428-swap-route-alignment-e2e into main 2026-06-29 16:22:20 +00:00
PlasticDigits commented 2026-06-29 16:14:51 +00:00 (Migrated from gitlab.com)

Summary

Adds strict LocalTerra Playwright coverage for SEC-E07 (#428): the Swap page Route row (swap-route-summary) must match the wasm swap hop sequence actually executed on-chain.

  • New e2e/swap-route-alignment-tx.spec.ts — direct dual-CW20 swap (client pool-only path; 1 wasm hop) and multihop CORAL→IRON (≥2 hops, indexer hybrid).
  • Helpers: e2e/helpers/route-alignment-e2e.ts, txJsonWasmSwapHops in e2e/helpers/lcd.ts.
  • Cross-links in skills/AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.md, frontend-dapp/e2e/README.md, docs/testing.md.

Acceptance checklist

Criterion Command / step Result
E2e or LocalTerra transcript confirms displayed route matches submitted ops for multihop swap sg docker -c 'CI=1 bash scripts/with-node.sh --cwd frontend-dapp -- ./node_modules/.bin/playwright test e2e/swap-route-alignment-tx.spec.ts -g multihop --project=e2e-tx' (after make setup-cloud-localterra, indexer up) PASS
Trace also covers a direct pair swap Same spec, -g "direct pair" PASS
No duplicate or conflicting route segments in display or submitted ops assertNoDuplicateRouteSegments in helpers + symbol sequence equality assertion PASS

Verification checklist (third parties)

Prerequisites: LocalTerra + deploy (make setup-cloud-localterra or make deploy-local), indexer (bash scripts/e2e-start-indexer.sh), Playwright Chromium (bash scripts/with-node.sh --cwd frontend-dapp -- ./node_modules/.bin/playwright install chromium).

make has-localterra
curl -sf http://127.0.0.1:3001/health
sg docker -c 'export PATH="/usr/local/cargo/bin:$HOME/.nvm/versions/node/v24.18.0/bin:$PATH" && CI=1 bash scripts/with-node.sh --cwd frontend-dapp -- ./node_modules/.bin/playwright test e2e/swap-route-alignment-tx.spec.ts --project=e2e-tx'

Expected: 2 passed — direct pair (2 UI symbols, 1 wasm hop) and multihop (≥3 UI symbols, ≥2 wasm hops) with matching symbol sequences.

Agent playbook: skills/AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.md § On-chain route alignment (SEC-E07).

## Summary Adds strict LocalTerra Playwright coverage for **SEC-E07** ([#428](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/428)): the Swap page **Route** row (`swap-route-summary`) must match the wasm `swap` hop sequence actually executed on-chain. - New `e2e/swap-route-alignment-tx.spec.ts` — **direct** dual-CW20 swap (client pool-only path; 1 wasm hop) and **multihop** CORAL→IRON (≥2 hops, indexer hybrid). - Helpers: `e2e/helpers/route-alignment-e2e.ts`, `txJsonWasmSwapHops` in `e2e/helpers/lcd.ts`. - Cross-links in `skills/AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.md`, `frontend-dapp/e2e/README.md`, `docs/testing.md`. ## Acceptance checklist | Criterion | Command / step | Result | |-----------|----------------|--------| | E2e or LocalTerra transcript confirms displayed route matches submitted ops for **multihop** swap | `sg docker -c 'CI=1 bash scripts/with-node.sh --cwd frontend-dapp -- ./node_modules/.bin/playwright test e2e/swap-route-alignment-tx.spec.ts -g multihop --project=e2e-tx'` (after `make setup-cloud-localterra`, indexer up) | **PASS** | | Trace also covers a **direct pair** swap | Same spec, `-g "direct pair"` | **PASS** | | No duplicate or conflicting route segments in display or submitted ops | `assertNoDuplicateRouteSegments` in helpers + symbol sequence equality assertion | **PASS** | ## Verification checklist (third parties) Prerequisites: LocalTerra + deploy (`make setup-cloud-localterra` or `make deploy-local`), indexer (`bash scripts/e2e-start-indexer.sh`), Playwright Chromium (`bash scripts/with-node.sh --cwd frontend-dapp -- ./node_modules/.bin/playwright install chromium`). ```bash make has-localterra curl -sf http://127.0.0.1:3001/health sg docker -c 'export PATH="/usr/local/cargo/bin:$HOME/.nvm/versions/node/v24.18.0/bin:$PATH" && CI=1 bash scripts/with-node.sh --cwd frontend-dapp -- ./node_modules/.bin/playwright test e2e/swap-route-alignment-tx.spec.ts --project=e2e-tx' ``` Expected: **2 passed** — direct pair (2 UI symbols, 1 wasm hop) and multihop (≥3 UI symbols, ≥2 wasm hops) with matching symbol sequences. Agent playbook: [`skills/AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.md`](skills/AGENTS_FRONTEND_SWAP_ROUTE_DISPLAY.md) § On-chain route alignment (SEC-E07).
PlasticDigits commented 2026-06-29 16:16:56 +00:00 (Migrated from gitlab.com)

Security review — MR !963

Commit reviewed: 36e322bf4975596de4645f4804d0abd030aa10d0
Scope: SEC-E07 Playwright E2E for swap route display vs on-chain hops — swap-route-alignment-tx.spec.ts, route-alignment-e2e.ts, txJsonWasmSwapHops in lcd.ts, playwright.config.ts tx glob, docs/skills cross-links.

Outcome: FINDINGS: 0 medium+

Summary

Reviewed all added/modified code in this diff. Changes are confined to E2E test helpers, a new Playwright tx spec, and documentation — no production frontend, indexer, or contract code paths are touched.

Traced candidate sinks:

Area Input source Sink Verdict
LCD smart queries (resolveAssetSymbol / cw20Symbol) offer_asset / ask_asset from wasm swap events in the test's own submitted tx lcdRequestGet → LocalTerra LCD (127.0.0.1:1317 / E2E_LCD_PROXY_URL) Not exploitable in prod — E2E-only; same interpolation pattern as existing multihop-hybrid-e2e.ts; fixed LCD base URL; execFileSync array args prevent shell injection
Tx fetch (fetchTxJson) Tx hash from success-alert link after test submit /cosmos/tx/v1beta1/txs/${encodeURIComponent(h)} Controlled — existing helper; hash URL-encoded
Route text parsing (parseDisplayedRouteSymbols) DOM textContent of swap-route-summary Test assertions only No user-facing sink
Indexer route abort (page.route) Test fixture Forces client direct-pool path Test setup only

No new dependencies, secrets, authn/authz changes, or production deserialization surfaces introduced.

Inline threads: none (no medium+ findings).

Security review: no medium+ findings on this diff.

## Security review — MR !963 **Commit reviewed:** `36e322bf4975596de4645f4804d0abd030aa10d0` **Scope:** SEC-E07 Playwright E2E for swap route display vs on-chain hops — `swap-route-alignment-tx.spec.ts`, `route-alignment-e2e.ts`, `txJsonWasmSwapHops` in `lcd.ts`, `playwright.config.ts` tx glob, docs/skills cross-links. **Outcome:** `FINDINGS: 0` medium+ ### Summary Reviewed all added/modified code in this diff. Changes are confined to **E2E test helpers, a new Playwright tx spec, and documentation** — no production frontend, indexer, or contract code paths are touched. Traced candidate sinks: | Area | Input source | Sink | Verdict | |------|--------------|------|---------| | LCD smart queries (`resolveAssetSymbol` / `cw20Symbol`) | `offer_asset` / `ask_asset` from wasm swap events in the test's own submitted tx | `lcdRequestGet` → LocalTerra LCD (`127.0.0.1:1317` / `E2E_LCD_PROXY_URL`) | **Not exploitable in prod** — E2E-only; same interpolation pattern as existing `multihop-hybrid-e2e.ts`; fixed LCD base URL; `execFileSync` array args prevent shell injection | | Tx fetch (`fetchTxJson`) | Tx hash from success-alert link after test submit | `/cosmos/tx/v1beta1/txs/${encodeURIComponent(h)}` | **Controlled** — existing helper; hash URL-encoded | | Route text parsing (`parseDisplayedRouteSymbols`) | DOM `textContent` of `swap-route-summary` | Test assertions only | **No user-facing sink** | | Indexer route abort (`page.route`) | Test fixture | Forces client direct-pool path | **Test setup only** | No new dependencies, secrets, authn/authz changes, or production deserialization surfaces introduced. **Inline threads:** none (no medium+ findings). Security review: **no medium+ findings** on this diff.
PlasticDigits commented 2026-06-29 16:22:20 +00:00 (Migrated from gitlab.com)

mentioned in commit de59858d9a

mentioned in commit de59858d9a7d4b0f16a39ede4b6a017c5245c7ad
PlasticDigits (Migrated from gitlab.com) merged commit de59858d9a into main 2026-06-29 16:22:20 +00:00
Sign in to join this conversation.
No reviewers
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!963
No description provided.