Skip to content

feat: suppress RPC connection banner during single-provider outages (WPC-1014)#31047

Merged
cryptodev-2s merged 7 commits into
mainfrom
wpc-1014-rpc-banner-by-domain
Jun 4, 2026
Merged

feat: suppress RPC connection banner during single-provider outages (WPC-1014)#31047
cryptodev-2s merged 7 commits into
mainfrom
wpc-1014-rpc-banner-by-domain

Conversation

@cryptodev-2s

@cryptodev-2s cryptodev-2s commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Description

The "Still connecting" / "Unable to connect" banner fires today whenever any one enabled EVM network's default RPC is unavailable, which means a single Infura blip — or a wide Infura outage that takes down many *.infura.io networks at once — pops a banner that doesn't reflect anything the user can act on.

This PR keeps the banner UI, timer thresholds, and analytics untouched and only changes the show/hide rule. The banner now shows when failed RPCs span 2+ distinct registrable domains (eTLD+1 via the Public Suffix List), or every enabled EVM network has failed (so single-network setups still get a signal), or any failed RPC is a non-Infura (custom) endpoint — those have no automatic failover. When a custom failure exists, it's surfaced first so the "Switch to MetaMask default RPC" CTA targets the one the user can act on.

Mobile counterpart to extension PR #43073. Same rule, kept inline in useNetworkConnectionBanner rather than split into composed selectors.

Implementation:

  • New app/util/url-utils.ts exposing getDomain (psl-backed eTLD+1) and isLocalhostOrIPAddress (ip-regex-backed). Localhost, IP literals, and single-label hosts short-circuit so callers grouping by domain can still distinguish them.
  • useNetworkConnectionBanner.checkNetworkStatus collects every failing enabled EVM network instead of breaking on the first, counts distinct domains, and applies the new rule.
  • New direct deps: psl, ip-regex (the latter added to transformIgnorePatterns since it ships ESM-only).

Changelog

CHANGELOG entry: Reduced false-positive RPC connection banners — single-provider outages no longer pop the banner, even when many popular networks fail at once.

Related issues

Fixes: WPC-1014

Manual testing steps

Feature: RPC connection banner suppression

  Scenario: single Infura blip during a wide outage
    Given the user has many popular networks enabled
    When all *.infura.io endpoints become unreachable simultaneously
    Then no banner should appear (one registrable domain, suppressed)

  Scenario: two different providers fail simultaneously
    Given the user has Infura- and non-Infura-backed networks enabled
    When both providers' RPCs fail at the same time
    Then the degraded banner should appear at 5s and escalate to unavailable at 30s

  Scenario: user-added custom RPC fails alone
    Given the user has a custom RPC configured for any network
    When only that custom endpoint is unreachable
    Then the banner should appear (custom override) with the "Switch to MetaMask default RPC" CTA targeting that network

  Scenario: only enabled network fails
    Given the user has a single network enabled
    When that network's RPC becomes unreachable
    Then the banner should appear (all-enabled-down escape hatch)

  Scenario: device is offline
    Given the device has no internet connectivity
    When any RPC times out
    Then no banner should appear (existing device-offline short-circuit)

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
  • I've tested with a power user scenario
  • I've instrumented key operations with Sentry traces for production performance metrics

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Connectivity UX only—no auth, payments, or transaction signing; behavior is covered by new hook and url-utils tests, with main risk being under-alerting if domain grouping misclassifies an outage.

Overview
Reduces false-positive “Still connecting” / RPC connection banners by changing only when the banner is shown or hidden; timers, UI, and analytics stay the same.

useNetworkConnectionBanner now scans all enabled EVM networks with a failing default RPC (not just the first), derives each endpoint’s registrable domain via new app/util/url-utils (getDomain + Public Suffix List via psl), and shows the banner only when a custom default RPC is down, failures span more than one provider domain, or every enabled network is failing. A wide single-provider outage (e.g. many *.infura.io networks) counts as one domain and is suppressed unless the user’s whole enabled set is on that provider; when showing, a custom failure is preferred for the switch-to-default CTA. The hook hides an existing banner when the situation no longer meets those rules (e.g. custom RPC recovers and only one Infura network is down).

Adds ip-regex and psl, Jest allowlisting for ip-regex, and unit tests for the new rules and url-utils.

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

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@cryptodev-2s cryptodev-2s marked this pull request as ready for review June 3, 2026 22:51
@mm-token-exchange-service mm-token-exchange-service Bot added the team-core-platform Core Platform team label Jun 3, 2026
@github-actions github-actions Bot added the size-M label Jun 3, 2026
@github-actions github-actions Bot added the risk:high AI analysis: high risk label Jun 3, 2026
@socket-security

socket-security Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​ip-regex@​5.0.01001009280100
Addednpm/​psl@​1.15.010010010080100

View full report

@cryptodev-2s cryptodev-2s force-pushed the wpc-1014-rpc-banner-by-domain branch from e8b620e to c1ac503 Compare June 4, 2026 06:03
@github-actions github-actions Bot added risk:medium AI analysis: medium risk and removed risk:high AI analysis: high risk labels Jun 4, 2026
@cryptodev-2s cryptodev-2s self-assigned this Jun 4, 2026
@cryptodev-2s cryptodev-2s force-pushed the wpc-1014-rpc-banner-by-domain branch from ac6604b to d93a635 Compare June 4, 2026 10:23
@github-actions github-actions Bot added risk:high AI analysis: high risk and removed risk:medium AI analysis: medium risk labels Jun 4, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d93a635. Configure here.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeIdentity, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeSwap, SmokeStake, SmokeWalletPlatform, SmokeMoney, SmokePerps, SmokeMultiChainAPI, SmokePredictions, SmokeSeedlessOnboarding, SmokeBrowser, SmokeSnaps
  • Selected Performance tags: @PerformanceAccountList, @PerformanceOnboarding, @PerformanceLogin, @PerformanceSwaps, @PerformanceLaunch, @PerformanceAssetLoading, @PerformancePredict, @PerformancePreps
  • Risk Level: high
  • AI Confidence: 100%
click to see 🤖 AI reasoning details

E2E Test Selection:
Hard rule (global-infrastructure-change): Global infrastructure changed: app/components/hooks/useNetworkConnectionBanner/useNetworkConnectionBanner.test.tsx, app/components/hooks/useNetworkConnectionBanner/useNetworkConnectionBanner.ts. Running all tests.

Performance Test Selection:
Hard rule (global-infrastructure-change): Global infrastructure changed: app/components/hooks/useNetworkConnectionBanner/useNetworkConnectionBanner.test.tsx, app/components/hooks/useNetworkConnectionBanner/useNetworkConnectionBanner.ts. Running all tests.

View GitHub Actions results

@cryptodev-2s cryptodev-2s requested a review from a team June 4, 2026 12:11
@cryptodev-2s cryptodev-2s enabled auto-merge June 4, 2026 12:50
@cryptodev-2s cryptodev-2s requested a review from mcmire June 4, 2026 12:51

@mcmire mcmire left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cryptodev-2s cryptodev-2s added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit 0a36f48 Jun 4, 2026
310 of 312 checks passed
@cryptodev-2s cryptodev-2s deleted the wpc-1014-rpc-banner-by-domain branch June 4, 2026 15:20
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

risk:high AI analysis: high risk size-M team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants