Skip to content

fix: release-blocker restore gas estimate alerts cp-7.78.0#30266

Merged
maxime-oe merged 3 commits into
mainfrom
fix/release-blocker-restore-gas-estimate-alerts
May 18, 2026
Merged

fix: release-blocker restore gas estimate alerts cp-7.78.0#30266
maxime-oe merged 3 commits into
mainfrom
fix/release-blocker-restore-gas-estimate-alerts

Conversation

@maxime-oe

@maxime-oe maxime-oe commented May 15, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes release blocker regression #30260 for release 7.78.0

Changelog

CHANGELOG entry: restores gas estimate alerts on all networks except strictly gas-sponsored ones

Related issues

Fixes: #30260

Manual testing steps

Same testing intructions as for #29835
Add non-regression for issues raised in #30260, which may include for example calling pause on Mainnet USDC and checking that the "gas estimation failed" alert shows at least somewhere (can be second alert, but it needs to exist).

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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

Medium Risk
Changes confirmation alert gating logic for gas estimation failures and sponsorship reserve warnings, which could alter what users see during transaction approval on different networks. Risk is moderate because it affects transaction UX/decisioning but does not change signing or on-chain behavior.

Overview
Restores and tightens when gas-related confirmation alerts are shown by introducing useIsGasSponsored, which returns true only when both the gasless transaction is supported and the current chain is enabled via the gasFeesSponsoredNetwork feature flag.

useGasEstimateFailedAlert now suppresses the “gas estimate failed” warning only when useIsGasSponsored is true (instead of suppressing for any gasless-supported/pending checks), and useGasSponsorshipWarningAlert now shows the Monad reserve-balance blocking warning only when sponsorship is expected for the transaction. Tests were updated and a new unit test suite was added for useIsGasSponsored.

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

@github-actions

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.

@metamaskbotv2 metamaskbotv2 Bot added the team-networks Networks team label May 15, 2026
@github-actions github-actions Bot added pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. size-S labels May 15, 2026
@maxime-oe maxime-oe changed the title fix: release-blocker restore gas estimate alerts fix: release-blocker restore gas estimate alerts cp-7.78.0 May 15, 2026
@maxime-oe maxime-oe marked this pull request as ready for review May 15, 2026 16:53
@maxime-oe maxime-oe requested a review from a team as a code owner May 15, 2026 16:53
Comment thread app/components/Views/confirmations/hooks/alerts/useGasEstimateFailedAlert.ts Outdated
@maxime-oe maxime-oe force-pushed the fix/release-blocker-restore-gas-estimate-alerts branch from 08c4b6f to bc78256 Compare May 15, 2026 17:08
@maxime-oe maxime-oe removed the pr-not-ready-for-e2e Skip E2E and block merging. Remove this label once the PR is ready to run the E2E tests. label May 15, 2026
@maxime-oe maxime-oe force-pushed the fix/release-blocker-restore-gas-estimate-alerts branch from bc78256 to 6f5bb10 Compare May 18, 2026 07:29
@github-actions github-actions Bot added size-M and removed size-S labels May 18, 2026
transactionMeta?.chainId &&
isGaslessSupported &&
isGasFeesSponsoredNetworkEnabled(transactionMeta?.chainId),
);

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.

Missing pending state causes alert flash on sponsored networks

Medium Severity

The new useIsCurrentTransactionGasSponsored hook destructures only isSupported from useIsGaslessSupported(), ignoring its pending state. Both underlying hooks (useGaslessSupportedSmartTransactions and the 7702 relay check) use useAsyncResult for network calls, during which isSupported defaults to false. On gas-sponsored networks, isCurrentTransactionGasSponsored will temporarily be false while async checks resolve, causing useGasEstimateFailedAlert to briefly show the "Inaccurate fee" warning before hiding it — a visible flash. The old code explicitly suppressed alerts during the pending state via isGaslessSupportCheckPending, and a dedicated test for this case was removed.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6f5bb10. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For this specific hook, we want the default value to be false rather than being true, so it doesn't affect "main" (non-sponsored) flows. So it will always be false when pending, instead of true when pending - had to choose one of the two anyways.

@maxime-oe maxime-oe force-pushed the fix/release-blocker-restore-gas-estimate-alerts branch from 6f5bb10 to d70e0b2 Compare May 18, 2026 07:38
Comment thread app/components/Views/confirmations/hooks/alerts/useGasEstimateFailedAlert.ts Outdated

@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.

There are 2 total unresolved issues (including 1 from previous review).

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 0c1926b. Configure here.

Comment thread app/components/Views/confirmations/hooks/gas/useIsGasSponsored.test.ts Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the confirmation alert system for gas-sponsored transactions:

  1. New useIsGasSponsored hook: Consolidates gas sponsorship detection by combining useIsGaslessSupported (checks if gasless is supported for the wallet/transaction) with a feature flag selector (getGasFeesSponsoredNetworkEnabled) that checks if the network has gas fee sponsorship enabled. This is a behavioral change - previously the pending state was checked to suppress alerts, now it's replaced with a feature flag network check.

  2. useGasEstimateFailedAlert: Now uses useIsGasSponsored instead of useIsGaslessSupported. The key behavioral change is: the alert is suppressed when gas is sponsored (combining both gasless support AND network feature flag), rather than when gasless is supported OR pending.

  3. useGasSponsorshipWarningAlert: Now uses useIsGasSponsored instead of checking isGasFeeSponsored from transaction metadata + isGaslessSupported. Removes the isGasFeeSponsored check from transaction metadata in favor of the consolidated hook.

These changes directly affect the transaction confirmation UI - specifically the alert system shown during EIP-7702 batch transactions and gasless/sponsored transactions. The SmokeConfirmations tag covers smart contract interactions, gas fee customization, EIP-7702 account abstraction features, and batch transactions - all of which are directly impacted by these alert hook changes.

No other tags are needed as:

  • No changes to navigation, browser, accounts, swaps, staking, or other features
  • The changes are isolated to confirmation alert hooks
  • No Engine/controller changes

Performance Test Selection:
These changes are limited to React hooks that determine alert display logic in the confirmation flow. They don't affect rendering performance, list rendering, data loading, app startup, or any other performance-sensitive areas. The hooks are lightweight boolean computations that won't impact measurable performance metrics.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@maxime-oe maxime-oe requested a review from matthewwalsh0 May 18, 2026 11:54
@maxime-oe

Copy link
Copy Markdown
Contributor Author

@matthewwalsh0 made changes related to your comments ;)

@maxime-oe maxime-oe added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit ac8df0d May 18, 2026
166 of 176 checks passed
@maxime-oe maxime-oe deleted the fix/release-blocker-restore-gas-estimate-alerts branch May 18, 2026 13:47
@github-actions github-actions Bot locked and limited conversation to collaborators May 18, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.79.0 Issue or pull request that will be included in release 7.79.0 size-M team-networks Networks team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Inaccurate fee alert missing

2 participants