Skip to content

Fix: Ensure cross-network Web3 integrity, handle async wallet transitions, and enforce strict TypeScript boundaries - #4

Open
mozluk wants to merge 1 commit into
etherlinkcom:mainfrom
mozluk:mozluk-patch-1
Open

Fix: Ensure cross-network Web3 integrity, handle async wallet transitions, and enforce strict TypeScript boundaries#4
mozluk wants to merge 1 commit into
etherlinkcom:mainfrom
mozluk:mozluk-patch-1

Conversation

@mozluk

@mozluk mozluk commented Aug 21, 2026

Copy link
Copy Markdown

Description

This PR addresses cross-network configuration bugs, unhandled asynchronous wallet states, and loose TypeScript boundaries within the Etherlink bridge repository.

Vulnerabilities & Security Defects Remediated:

  • Cross-Network Web3 Integrity (src/lib/beacon/beacon.ts): Beacon permissions and wallet connections previously used a hardcoded Ghostnet RPC regardless of the selected network. Both flows have been updated to dynamically use the selected network and the NEXT_PUBLIC_NODE_URL environment variable, with a documented Ghostnet fallback.
  • Async Error Propagation (src/contexts/TezosContext/TezosContext.tsx, src/components/Header/Header.tsx): Wallet connections, disconnections, and network transitions previously detached promises, leaving rejected operations unhandled. The context provider now explicitly awaits cleanup and transition operations, and the header component intercepts rejected wallet actions to present a user-visible notification via Mantine.
  • Strict TypeScript Boundaries (src/components/Faucet/Faucet.tsx, src/contexts/TezosContext/TezosContext.tsx, src/lib/types/type-aliases.ts): Removed explicit any types from caught exceptions and Michelson map-key arrays. Caught errors are now typed as unknown and explicitly narrowed (error instanceof Error) before use. Map keys now use Array<unknown>. Additionally, the Faucet component has been updated to report errors safely and reference the correct form field (address instead of email).

…ions, and enforce strict TypeScript boundaries

### Description
This PR addresses cross-network configuration bugs, unhandled asynchronous wallet states, and loose TypeScript boundaries within the Etherlink `bridge` repository.

**Vulnerabilities & Security Defects Remediated:**
* **Cross-Network Web3 Integrity (`src/lib/beacon/beacon.ts`):** Beacon permissions and wallet connections previously used a hardcoded Ghostnet RPC regardless of the selected network. Both flows have been updated to dynamically use the selected network and the `NEXT_PUBLIC_NODE_URL` environment variable, with a documented Ghostnet fallback.
* **Async Error Propagation (`src/contexts/TezosContext/TezosContext.tsx`, `src/components/Header/Header.tsx`):** Wallet connections, disconnections, and network transitions previously detached promises, leaving rejected operations unhandled. The context provider now explicitly awaits cleanup and transition operations, and the header component intercepts rejected wallet actions to present a user-visible notification via Mantine. 
* **Strict TypeScript Boundaries (`src/components/Faucet/Faucet.tsx`, `src/contexts/TezosContext/TezosContext.tsx`, `src/lib/types/type-aliases.ts`):** Removed explicit `any` types from caught exceptions and Michelson map-key arrays. Caught errors are now typed as `unknown` and explicitly narrowed (`error instanceof Error`) before use. Map keys now use `Array<unknown>`. Additionally, the Faucet component has been updated to report errors safely and reference the correct form field (address instead of email).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant