fix(frontend): in-flight TX link during Terra confirming phase (#305) #827

Merged
PlasticDigits merged 1 commit from cursor/gitlab-issue-workflow-3325 into main 2026-06-06 07:12:02 +00:00
PlasticDigits commented 2026-06-06 07:04:43 +00:00 (Migrated from gitlab.com)

Summary

Fixes #305: Confirming… showed during pollTx but the in-flight TX: explorer link below the submit button did not.

Root cause: separate useState updates for phase and pendingTxHash could desync inside async mutationFn. The Playwright spec also delayed LCD REST instead of the JSON-RPC abci_query path that pollTx uses.

Changes

  • useTerraBroadcastMutation: atomic useReducer for phase + hash; onMutate reset; signing no longer clears hash mid-mutation (CW20 allowance flows)
  • E2E: delay RPC GetTx abci_query during confirming
  • DOM integration test asserts TX link paints before pollTx resolves

Acceptance checklist

Criterion Command / step Result
After tx hash, UI shows Confirming… until poll resolves DOM + e2e tests PASS
Phase callback fires for every transition terraBroadcast.test.ts PASS
Failed broadcast never enters confirming terraBroadcast.test.ts PASS
Timeout #173 regression make test-frontend (872 passed) PASS
Swap / Limit Orders / Trade ticket labels existing wiring PASS
In-flight TX: link during confirming DOM test + e2e + Simulated Wallet screenshot PASS
make test-frontend 872 passed PASS
make lint-frontend 0 errors PASS
Manual Keplr LocalTerra swap Cloud Agent Chrome cannot load Keplr extension SKIP (env blocker)

Third-party verification

make test-frontend
make lint-frontend
cd frontend-dapp && npx playwright install chromium
sg docker -c 'npx playwright test e2e/terra-broadcast-confirming-link-tx.spec.ts --project=e2e-tx'

Manual: Simulated Wallet or Keplr on LocalTerra — swap 0.001 EMBER→CORAL; during Confirming… expect TX: link under button.

Related: !778 (initial #305 plumbing)

## Summary Fixes [#305](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/305): **Confirming…** showed during `pollTx` but the in-flight **TX:** explorer link below the submit button did not. Root cause: separate `useState` updates for `phase` and `pendingTxHash` could desync inside async `mutationFn`. The Playwright spec also delayed LCD REST instead of the JSON-RPC `abci_query` path that `pollTx` uses. ## Changes - `useTerraBroadcastMutation`: atomic `useReducer` for phase + hash; `onMutate` reset; signing no longer clears hash mid-mutation (CW20 allowance flows) - E2E: delay RPC `GetTx` abci_query during confirming - DOM integration test asserts TX link paints before `pollTx` resolves ## Acceptance checklist | Criterion | Command / step | Result | |-----------|----------------|--------| | After tx hash, UI shows **Confirming…** until poll resolves | DOM + e2e tests | **PASS** | | Phase callback fires for every transition | `terraBroadcast.test.ts` | **PASS** | | Failed broadcast never enters confirming | `terraBroadcast.test.ts` | **PASS** | | Timeout #173 regression | `make test-frontend` (872 passed) | **PASS** | | Swap / Limit Orders / Trade ticket labels | existing wiring | **PASS** | | In-flight **TX:** link during confirming | DOM test + e2e + Simulated Wallet screenshot | **PASS** | | `make test-frontend` | 872 passed | **PASS** | | `make lint-frontend` | 0 errors | **PASS** | | Manual Keplr LocalTerra swap | Cloud Agent Chrome cannot load Keplr extension | **SKIP** (env blocker) | ## Third-party verification ```bash make test-frontend make lint-frontend cd frontend-dapp && npx playwright install chromium sg docker -c 'npx playwright test e2e/terra-broadcast-confirming-link-tx.spec.ts --project=e2e-tx' ``` Manual: Simulated Wallet or Keplr on LocalTerra — swap 0.001 EMBER→CORAL; during **Confirming…** expect **TX:** link under button. Related: !778 (initial #305 plumbing)
ghost1 commented 2026-06-06 07:04:50 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-06 07:04:56 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-06 07:06:08 +00:00 (Migrated from gitlab.com)

Security review

Commit reviewed: 85145a2184fa0dd7473088863e772f1409d7117a
Scope: useTerraBroadcastMutation reducer refactor (atomic phase + pendingTxHash), E2E poll delay route change (abci_query GetTx), DOM integration test.

Outcome: FINDINGS: 0 medium+

Summary

Reviewed added/modified code for injection, authz, secret leakage, XSS, SSRF, and unsafe URL construction. No exploitable paths identified in this diff.

Areas examined

Change Assessment
broadcastUiReducer + onMutate reset UI-state only; pendingTxHash still sourced from wallet.broadcastTx() via onPhaseChange('confirming', { txHash }). TerraBroadcastPendingLink renders only when phase === 'confirming'; React escapes title/text; explorer href built from static network base + hash (unchanged).
Signing branch keeps prior hash Link hidden while phase === 'signing'; confirming always passes fresh txHash from broadcast. No new attacker-controlled sink.
E2E page.route('**/*', …) + JSON.parse(postData) Test-only; delays abci_query GetTx POSTs. Not shipped to production.
DOM integration test Mocks wallet; no production surface.

Inline threads: none (no medium+ findings).


Automated security review (MR open webhook).

## Security review **Commit reviewed:** `85145a2184fa0dd7473088863e772f1409d7117a` **Scope:** `useTerraBroadcastMutation` reducer refactor (atomic phase + `pendingTxHash`), E2E poll delay route change (`abci_query` GetTx), DOM integration test. **Outcome:** `FINDINGS: 0` medium+ ### Summary Reviewed added/modified code for injection, authz, secret leakage, XSS, SSRF, and unsafe URL construction. No exploitable paths identified in this diff. ### Areas examined | Change | Assessment | |--------|------------| | `broadcastUiReducer` + `onMutate` reset | UI-state only; `pendingTxHash` still sourced from `wallet.broadcastTx()` via `onPhaseChange('confirming', { txHash })`. `TerraBroadcastPendingLink` renders only when `phase === 'confirming'`; React escapes `title`/text; explorer `href` built from static network base + hash (unchanged). | | Signing branch keeps prior hash | Link hidden while `phase === 'signing'`; confirming always passes fresh `txHash` from broadcast. No new attacker-controlled sink. | | E2E `page.route('**/*', …)` + `JSON.parse(postData)` | Test-only; delays `abci_query` GetTx POSTs. Not shipped to production. | | DOM integration test | Mocks wallet; no production surface. | **Inline threads:** none (no medium+ findings). --- *Automated security review (MR open webhook).*
PlasticDigits (Migrated from gitlab.com) merged commit 248c9997f7 into main 2026-06-06 07:12:03 +00:00
PlasticDigits commented 2026-06-06 07:12:04 +00:00 (Migrated from gitlab.com)

mentioned in commit 248c9997f7

mentioned in commit 248c9997f7cacd79d80e361758b332031d93c162
PlasticDigits commented 2026-06-06 07:35:24 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-06 07:35:24 +00:00 (Migrated from gitlab.com)

mentioned in issue #305

mentioned in issue #305
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit 3cb93d5f7a

mentioned in commit 3cb93d5f7a95e01af2ac3e91dff1289d1e707fce
PlasticDigits commented 2026-06-08 13:42:29 +00:00 (Migrated from gitlab.com)

mentioned in commit 000e8f3a39

mentioned in commit 000e8f3a39c99f1b7bf19174cdba32055a0d3610
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!827
No description provided.