Skip to content

fix(metamask-pay): cp-7.80.0 use latest on-chain nonce for EIP-7702 authorization list#30297

Merged
matthewwalsh0 merged 2 commits into
mainfrom
fix/pay-auth-nonce-latest
Jun 1, 2026
Merged

fix(metamask-pay): cp-7.80.0 use latest on-chain nonce for EIP-7702 authorization list#30297
matthewwalsh0 merged 2 commits into
mainfrom
fix/pay-auth-nonce-latest

Conversation

@matthewwalsh0

@matthewwalsh0 matthewwalsh0 commented May 18, 2026

Copy link
Copy Markdown
Member

Description

When building the EIP-7702 authorization list for a Pay delegation transaction, the nonce was previously read from NonceLock.nextNonce — the value computed by the nonce tracker, which accounts for locally-pending transactions the Relay has no visibility into. This could produce a nonce ahead of the true on-chain state, causing the Relay to reject the authorization as invalid.

The fix reads NonceLock.nonceDetails.params.nextNetworkNonce instead — the raw eth_getTransactionCount result that the nonce tracker already fetches internally. This gives the committed on-chain nonce the Relay needs to verify the authorization signature, without introducing a separate provider call or adding a new Engine dependency.

Changelog

CHANGELOG entry: null

Related issues

Related to: #30798

Manual testing steps

Feature: EIP-7702 Pay delegation transaction

  Scenario: user submits a Pay transaction requiring EIP-7702 upgrade
    Given the account has not yet been delegated (not upgraded to EIP-7702)
    And the account has locally-pending transactions in the queue

    When user initiates a Pay transaction and confirms
    Then the authorization list is signed with the correct on-chain nonce
    And the transaction submits successfully via Relay

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

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 nonce selection for EIP-7702 authorization signing in Pay flows; wrong nonce would break Relay submission but scope is limited to delegation authorization building.

Overview
EIP-7702 Pay delegation now signs the authorization list with the committed on-chain nonce (nonceLock.nonceDetails.params.nextNetworkNonce) instead of the nonce tracker’s nextNonce, which can include locally pending txs the Relay cannot see.

Tests were updated to mock networkClientId on transaction meta and to return the new nonce lock shape so KeyringController:signEip7702Authorization still receives the expected nonce.

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

@metamaskbotv2 metamaskbotv2 Bot added the team-confirmations Push issues to confirmations team label May 18, 2026
@github-actions github-actions Bot added size-XS and removed size-S labels May 27, 2026
@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: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are a targeted bug fix in app/util/transactions/delegation.ts, correcting the nonce property path from nonceLock.nextNonce to nonceLock.nonceDetails.params.nextNetworkNonce when building EIP-7702 authorization lists. This is used in the EIP-7702 batch transaction / account abstraction flow via the TransactionPayController. The corresponding test file is updated to match the new mock structure. SmokeConfirmations is the appropriate tag as it explicitly covers "advanced EIP-7702 account abstraction features like batch transactions and gas fee token payments." No other flows are affected by this narrow fix.

Performance Test Selection:
This is a single-line bug fix correcting a nonce property path in the EIP-7702 delegation utility. It has no impact on rendering performance, data loading, UI components, or app startup. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

Copy link
Copy Markdown

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review May 27, 2026 23:58
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner May 27, 2026 23:58
@matthewwalsh0 matthewwalsh0 enabled auto-merge May 29, 2026 13:02
@matthewwalsh0 matthewwalsh0 changed the title fix(pay): use latest on-chain nonce for EIP-7702 authorization list fix(metamask-pay): cp-7.80.0 use latest on-chain nonce for EIP-7702 authorization list May 29, 2026
@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Jun 1, 2026
Merged via the queue into main with commit fa851e7 Jun 1, 2026
297 of 316 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/pay-auth-nonce-latest branch June 1, 2026 12:04
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-XS team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants