Skip to content

chore(runway): cherry-pick fix: cp-7.60.2 overwrite account upgrade in metamask pay - #23542

Merged
joaoloureirop merged 2 commits into
release/7.60.2from
runway-cherry-pick-7.60.2-1764686762
Dec 2, 2025
Merged

joaoloureirop merged 2 commits into
release/7.60.2from
runway-cherry-pick-7.60.2-1764686762

Conversation

@runway-github

@runway-github runway-github Bot commented Dec 2, 2025 •

Copy link
Copy Markdown
Contributor

Description

When generating delegation data for the TransactionPayController,
overwrite any existing EIP-7702 delegation if not supported.

Also bump the controller version to include missing authorization lists
on Predict deposit source transactions, when payment token is on
Polygon.

Changelog

CHANGELOG entry: Fixed bugs causing failed Perps and Predict deposits
due to unsupported or missing account upgrades

Related issues

Fixes: #23494 #23514

Manual testing steps

Screenshots/Recordings

Before

After

Pre-merge author checklist

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

Updates delegation transaction to conditionally include EIP-7702 authorization with new error handling, expands tests, and bumps transaction-related controllers.

  • Delegation utils (app/util/transactions/delegation.ts):
    • Build authorization from TransactionController.isAtomicBatchSupported per-chain result; skip if isSupported.
    • Add errors for unsupported chains and missing upgradeContractAddress.
    • Use getNonceLock nonce and KeyringController:signEip7702Authorization to construct authorizationList.
    • Support overwriting existing delegationAddress when upgrade target differs; logging adjustments.
  • Tests (app/util/transactions/delegation.test.ts + snapshot):
    • Add coverage for already-upgraded, different-upgrade targets, signing calls, and new error cases.
    • Update snapshot naming and expectations.
  • Dependencies:
    • Bump @metamask/transaction-controller to 62.4.0 and @metamask/transaction-pay-controller to 10.3.0 (with lockfile updates).

Written by Cursor Bugbot for commit 310fa44. This will update automatically on new commits. Configure here.

509b61d

…n metamask pay (#23521)

## **Description**

When generating delegation data for the `TransactionPayController`,
overwrite any existing EIP-7702 delegation if not supported.

Also bump the controller version to include missing authorization lists
on Predict deposit source transactions, when payment token is on
Polygon.

## **Changelog**

CHANGELOG entry: Fixed bugs causing failed Perps and Predict deposits
due to unsupported or missing account upgrades

## **Related issues**

Fixes: #23494 #23514 

## **Manual testing steps**

## **Screenshots/Recordings**

### **Before**

### **After**

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Refactors delegation to correctly build/overwrite EIP-7702
authorizations with validation, integrates Transaction Pay and
Delegation 7702 hooks into publish flow, and bumps transaction-related
controllers.
> 
> - **Engine/TransactionController init**:
> - Integrates `TransactionPayPublishHook` and
`Delegation7702PublishHook` with fallback logic before smart
transactions.
> - Adds `isEIP7702GasFeeTokensEnabled`, `publicKeyEIP7702`, and
`getNextNonce` helper.
>   - Exposes `getNetworkState` via `networkController.state`.
> - **Delegation utils (`app/util/transactions/delegation.ts`)**:
> - Refactors `buildAuthorizationList` to use `isAtomicBatchSupported`
result per-chain, throwing on unsupported chains and missing
`upgradeContractAddress`.
> - Skips authorization if already upgraded; overwrites authorization
when upgraded to a different contract.
> - Signs EIP-7702 authorization using nonce lock and builds
`AuthorizationList`.
> - **Tests**:
> - Expands `delegation.test.ts` with cases for already upgraded,
different upgrade target, signing calls, and error paths; updates
snapshot name.
> - **Dependencies**:
> - Bumps `@metamask/transaction-controller` to `62.4.0` and
`@metamask/transaction-pay-controller` to `^10.3.0` (and associated
`@metamask/network-controller` peer to `^27`).
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
923e879. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@metamaskbot metamaskbot added the team-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Dec 2, 2025
@socket-security

socket-security Bot commented Dec 2, 2025 •

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
Updatednpm/​@​metamask/​transaction-controller@​62.3.1 ⏵ 62.4.0100 +4100100 +20100 +3100
Updatednpm/​@​metamask/​transaction-pay-controller@​10.2.0 ⏵ 10.3.0100 +22100100 +23100 +4100

View full report

@github-actions

github-actions Bot commented Dec 2, 2025

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.

@joaoloureirop
joaoloureirop enabled auto-merge (squash) December 2, 2025 14:55
@socket-security

socket-security Bot commented Dec 2, 2025 •

Copy link
Copy Markdown

All alerts resolved. Learn more about Socket for GitHub.

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring alerts on:

  • npm/@metamask/network-controller@27.0.0

View full report

@github-actions

github-actions Bot commented Dec 2, 2025

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeConfirmationsRedesigned
  • Risk Level: medium
  • AI Confidence: 75%
click to see 🤖 AI reasoning details

Change Analysis

Files Changed:

  1. package.json (CRITICAL) - Likely contains dependency updates related to delegation
  2. app/util/transactions/delegation.ts - Core delegation transaction utility
  3. app/util/transactions/delegation.test.ts - Unit tests for delegation
  4. app/util/transactions/snapshots/delegation.test.ts.snap - Test snapshots
  5. yarn.lock - Dependency lock file update

Impact Assessment:

Core Functionality Affected:

  • Transaction delegation utilities that handle EIP-7702 account abstraction
  • The getDelegationTransaction function which is used by TransactionPayController
  • Authorization list building for atomic batch transactions
  • Delegation signing and execution mode handling

Integration Points:

  1. Used in app/core/Engine/controllers/transaction-pay-controller/transaction-pay-controller-init.ts
  2. Related to batch transactions (TransactionType.batch) and revoke delegation (TransactionType.revokeDelegation)
  3. Confirmation redesign flows explicitly handle these transaction types
  4. EIP-7702 account upgrade/authorization flow

Why Medium Risk:

  • Changes involve transaction processing utilities that are part of the critical path
  • Affects confirmation flows for batch and delegation transactions
  • Unit tests and snapshots were updated, indicating functional changes to delegation logic
  • The code handles signing operations and authorization lists which are sensitive
  • Integration with TransactionPayController suggests this touches the payment/relay flow

Why SmokeConfirmationsRedesigned Tag:

  • The confirmation redesign explicitly handles TransactionType.batch and TransactionType.revokeDelegation as shown in useConfirmationRedesignEnabled.ts
  • These transaction types always return true for redesign enablement (lines 68-70)
  • The delegation functionality is integrated into the confirmation flow
  • Changes to delegation logic could affect how batch transactions and delegations are confirmed

Confidence Notes (75%):

  • Clear connection to confirmation flows through TransactionType.batch and revokeDelegation
  • Direct integration in TransactionPayController which is part of the transaction flow
  • Could not retrieve git diffs to see exact line-by-line changes
  • The unit tests and snapshots changed, but exact nature of functional changes is unclear
  • Package.json changes might include related dependency updates that could have broader impact

Not Selected:

  • SmokeCore/SmokeWalletPlatform: While this touches transaction processing, it's specifically scoped to delegation/batch transactions handled by confirmation redesign
  • SmokeAccounts: Not directly related to account management
  • Other tags don't align with the transaction delegation/confirmation scope

View GitHub Actions results

@joaoloureirop joaoloureirop added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Dec 2, 2025
@joaoloureirop

Copy link
Copy Markdown
Contributor

@SocketSecurity ignore npm/@metamask/network-controller@27.0.0

@sonarqubecloud

sonarqubecloud Bot commented Dec 2, 2025

Copy link
Copy Markdown

@joaoloureirop
joaoloureirop merged commit 0bc9473 into release/7.60.2 Dec 2, 2025
85 checks passed
@joaoloureirop
joaoloureirop deleted the runway-cherry-pick-7.60.2-1764686762 branch December 2, 2025 15:42
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 2, 2025
@metamaskbot metamaskbot added the release-7.60.2 Issue or pull request that will be included in release 7.60.2 label Dec 2, 2025
@metamaskbot

Copy link
Copy Markdown
Collaborator

No release label on PR. Adding release label release-7.60.2 on PR, as PR was cherry-picked in branch 7.60.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.60.2 Issue or pull request that will be included in release 7.60.2 skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants