Frontend: LP risk disclosure, swap precision display, and a11y axe coverage (#366) #875

Merged
PlasticDigits merged 1 commit from issue-366-lp-risk-swap-precision-a11y into main 2026-06-12 07:57:07 +00:00
PlasticDigits commented 2026-06-12 05:21:46 +00:00 (Migrated from gitlab.com)

Summary

Implements GitLab #366 (gap follow-up M6, M10, H10 from #361):

  • Pool IL disclosure — compact impermanent-loss notice in the Provide Liquidity panel with link to docs/frontend.md#pool-lp-risk-disclosure.
  • Swap precision — isPositiveDecimalAmount for amount gating and spreadPercentFromRawSim for hop spread %; submit path unchanged (still BigInt-safe via #356).
  • A11y CI — axe smoke extended to Swap (/), /limits, /pool, /portfolio (critical/serious = 0).

Acceptance checklist

Criterion Command / step Result
Pool page shows succinct IL / LP risk notice before first provide-liquidity action make test-frontend → PoolPage.test.tsx “shows impermanent loss notice…” PASS
Swap price-impact and amount validation correct for raw amounts > 9007199254740991 make test-frontend → decimalAmountInput.test.ts, rawAmountMath.test.ts, SwapPage.test.tsx “large-amount precision” PASS
Axe E2E passes on /swap, /limits, /pool, /portfolio cd frontend-dapp && PLAYWRIGHT_SKIP_CHAIN=1 npm run test:e2e:smoke -- e2e/a11y-critical-routes.spec.ts (Swap route is / in app) PASS
No new enforced Vitest coverage thresholds vitest.config.ts unchanged PASS
Frontend lint make lint-frontend PASS

Verification checklist (third parties)

  1. make test-frontend
  2. make lint-frontend
  3. PLAYWRIGHT_SKIP_CHAIN=1 npm run test:e2e:smoke -- e2e/a11y-critical-routes.spec.ts from frontend-dapp/
  4. Manual: /pool → open Provide Liquidity → confirm IL notice + Learn more link
  5. Manual: / (Swap) → paste 9007199254740992 in You Pay → confirm quote path not stuck on Enter Amount
  6. Optional strict: with make deploy-local + make dev, re-run a11y spec without PLAYWRIGHT_SKIP_CHAIN for full Swap shell

Note

Low Risk
Mostly UI copy, test coverage, and display-layer math; swap submit still uses existing BigInt paths (#356). Low risk unless amount gating regressions on edge-case inputs.

Overview
GitLab #366 — three retail-facing changes plus docs/agent playbooks.

Pool (/pool) — When Provide Liquidity is expanded, a compact impermanent loss notice (pool-il-risk-notice, role="note") appears before amount fields, with Learn more linking to docs/frontend.md#pool-lp-risk-disclosure. No wallet required.

Swap (/) — Replaces parseFloat-based positive-amount checks with isPositiveDecimalAmount so human amounts above Number.MAX_SAFE_INTEGER still enable quotes. Hop expected slippage uses spreadPercentFromRawSim (BigInt on raw sim strings); severity/warnings use parseSlippagePercent instead of parseFloat(priceImpact).

A11y CI — Playwright axe smoke adds /, /limits, /pool, and /portfolio with shell wait helpers (waitForSwapShell, waitForRouteShell); docs and AGENTS_FRONTEND_A11Y_CI.md list the expanded route set.

Tests — Vitest for new helpers, Pool IL notice, and Swap large-amount integration case.

Reviewed by Cursor Bugbot for commit 0bb04f445e. Bugbot is set up for automated code reviews on this repo. Configure here.

## Summary Implements GitLab #366 (gap follow-up M6, M10, H10 from #361): - **Pool IL disclosure** — compact impermanent-loss notice in the Provide Liquidity panel with link to `docs/frontend.md#pool-lp-risk-disclosure`. - **Swap precision** — `isPositiveDecimalAmount` for amount gating and `spreadPercentFromRawSim` for hop spread %; submit path unchanged (still BigInt-safe via #356). - **A11y CI** — axe smoke extended to Swap (`/`), `/limits`, `/pool`, `/portfolio` (critical/serious = 0). ## Acceptance checklist | Criterion | Command / step | Result | |-----------|----------------|--------| | Pool page shows succinct IL / LP risk notice before first provide-liquidity action | `make test-frontend` → `PoolPage.test.tsx` “shows impermanent loss notice…” | PASS | | Swap price-impact and amount validation correct for raw amounts > `9007199254740991` | `make test-frontend` → `decimalAmountInput.test.ts`, `rawAmountMath.test.ts`, `SwapPage.test.tsx` “large-amount precision” | PASS | | Axe E2E passes on `/swap`, `/limits`, `/pool`, `/portfolio` | `cd frontend-dapp && PLAYWRIGHT_SKIP_CHAIN=1 npm run test:e2e:smoke -- e2e/a11y-critical-routes.spec.ts` (Swap route is `/` in app) | PASS | | No new enforced Vitest coverage thresholds | `vitest.config.ts` unchanged | PASS | | Frontend lint | `make lint-frontend` | PASS | ## Verification checklist (third parties) 1. `make test-frontend` 2. `make lint-frontend` 3. `PLAYWRIGHT_SKIP_CHAIN=1 npm run test:e2e:smoke -- e2e/a11y-critical-routes.spec.ts` from `frontend-dapp/` 4. Manual: `/pool` → open **Provide Liquidity** → confirm IL notice + **Learn more** link 5. Manual: `/` (Swap) → paste `9007199254740992` in You Pay → confirm quote path not stuck on **Enter Amount** 6. Optional strict: with `make deploy-local` + `make dev`, re-run a11y spec without `PLAYWRIGHT_SKIP_CHAIN` for full Swap shell <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Mostly UI copy, test coverage, and display-layer math; swap submit still uses existing BigInt paths (#356). Low risk unless amount gating regressions on edge-case inputs. > > **Overview** > **GitLab #366** — three retail-facing changes plus docs/agent playbooks. > > **Pool (`/pool`)** — When **Provide Liquidity** is expanded, a compact **impermanent loss** notice (`pool-il-risk-notice`, `role="note"`) appears before amount fields, with **Learn more** linking to `docs/frontend.md#pool-lp-risk-disclosure`. No wallet required. > > **Swap (`/`)** — Replaces `parseFloat`-based positive-amount checks with **`isPositiveDecimalAmount`** so human amounts above `Number.MAX_SAFE_INTEGER` still enable quotes. Hop **expected slippage** uses **`spreadPercentFromRawSim`** (BigInt on raw sim strings); severity/warnings use **`parseSlippagePercent`** instead of `parseFloat(priceImpact)`. > > **A11y CI** — Playwright axe smoke adds `/`, `/limits`, `/pool`, and `/portfolio` with shell wait helpers (`waitForSwapShell`, `waitForRouteShell`); docs and `AGENTS_FRONTEND_A11Y_CI.md` list the expanded route set. > > **Tests** — Vitest for new helpers, Pool IL notice, and Swap large-amount integration case. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0bb04f445ea6d58c2eb8eb9133f4e2bbf3195572. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
ghost1 commented 2026-06-12 05:21:55 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
ghost1 commented 2026-06-12 05:22:03 +00:00 (Migrated from gitlab.com)

changed the description

changed the description
PlasticDigits commented 2026-06-12 05:23:58 +00:00 (Migrated from gitlab.com)

Security review — MR !875

Commit reviewed: 0bb04f445ea6d58c2eb8eb9133f4e2bbf3195572

Scope: LP impermanent-loss disclosure (PoolPage.tsx), swap amount gating (isPositiveDecimalAmount), hop spread display (spreadPercentFromRawSim, parseSlippagePercent for UI severity/confirm), axe E2E route expansion, docs/skills.

Method: Diff-only review with sink tracing for user-controlled inputs (swap amount field, indexer/LCD sim strings) into display gates, slippage warnings, expert-mode block, and on-chain submit path (useSubmitAlignedSimQuote, assertSubmitQuotePayRawAligned, toRawAmount / BigInt).

Outcome: FINDINGS: 0 medium+

Summary: No new injection, authz, XSS, or submit-path bypass identified on this diff.

  • Pool IL notice: Static copy and a constant https://gitlab.com/... docs URL with rel="noopener noreferrer"; no attacker-controlled HTML or href.
  • Swap amount gating: isPositiveDecimalAmount is constrained by the existing DECIMAL_AMOUNT_DRAFT_RE; submit still uses toRawAmount + debounced raw alignment (#356). Change fixes false negatives above Number.MAX_SAFE_INTEGER without weakening chain args.
  • Slippage display / confirm: spreadPercentFromRawSim is display-only BigInt math on uint strings via tryParseBigInt; expert-mode block (expectedSlippagePct > 30) and high-slippage confirm (> 5%) still gate on parsed percent — no bypass vs prior parseFloat(priceImpact) behavior for normal formatted values.
  • A11y tests: Test-only route coverage; no runtime security surface.

Prior threads: No prior security-review notes on this MR; nothing re-reported.

Inline findings: None (no medium+ issues to thread).

## Security review — MR !875 **Commit reviewed:** `0bb04f445ea6d58c2eb8eb9133f4e2bbf3195572` **Scope:** LP impermanent-loss disclosure (`PoolPage.tsx`), swap amount gating (`isPositiveDecimalAmount`), hop spread display (`spreadPercentFromRawSim`, `parseSlippagePercent` for UI severity/confirm), axe E2E route expansion, docs/skills. **Method:** Diff-only review with sink tracing for user-controlled inputs (swap amount field, indexer/LCD sim strings) into display gates, slippage warnings, expert-mode block, and on-chain submit path (`useSubmitAlignedSimQuote`, `assertSubmitQuotePayRawAligned`, `toRawAmount` / BigInt). **Outcome:** `FINDINGS: 0` medium+ **Summary:** No new injection, authz, XSS, or submit-path bypass identified on this diff. - **Pool IL notice:** Static copy and a constant `https://gitlab.com/...` docs URL with `rel="noopener noreferrer"`; no attacker-controlled HTML or href. - **Swap amount gating:** `isPositiveDecimalAmount` is constrained by the existing `DECIMAL_AMOUNT_DRAFT_RE`; submit still uses `toRawAmount` + debounced raw alignment (#356). Change fixes false negatives above `Number.MAX_SAFE_INTEGER` without weakening chain args. - **Slippage display / confirm:** `spreadPercentFromRawSim` is display-only BigInt math on uint strings via `tryParseBigInt`; expert-mode block (`expectedSlippagePct > 30`) and high-slippage confirm (`> 5%`) still gate on parsed percent — no bypass vs prior `parseFloat(priceImpact)` behavior for normal formatted values. - **A11y tests:** Test-only route coverage; no runtime security surface. **Prior threads:** No prior security-review notes on this MR; nothing re-reported. **Inline findings:** None (no medium+ issues to thread).
Brouie commented 2026-06-12 07:34:30 +00:00 (Migrated from gitlab.com)

mentioned in issue #366

mentioned in issue #366
PlasticDigits commented 2026-06-12 07:57:07 +00:00 (Migrated from gitlab.com)

mentioned in commit ede4ce9b6b

mentioned in commit ede4ce9b6ba1b71d6ab674c40bbaa30b6b46fcce
PlasticDigits (Migrated from gitlab.com) merged commit ede4ce9b6b into main 2026-06-12 07:57:07 +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!875
No description provided.