feat(transaction-pay-controller): send v2 metamask envelope and alternate caveats for subsidized executes - #9298
Conversation
7aa8583 to
f2d9f00
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
0b1ee61 to
81662a8
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
…538ab03c Preview build from MetaMask/core#9298 (feat/pay-subsidized-submit) for testing the isSubsidized delegation flag, executeVersion: 2 quote request, and signed metamask execute envelope end-to-end.
…538ab03c Preview build from MetaMask/core#9298 (feat/pay-subsidized-submit) for testing the isSubsidized delegation flag, executeVersion: 2 quote request, and signed metamask execute envelope end-to-end.
…538ab03c Preview build from MetaMask/core#9298 (feat/pay-subsidized-submit) for testing the isSubsidized delegation flag, executeVersion: 2 quote request, and signed metamask execute envelope end-to-end.
e248ad2 to
380bb5c
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
…538ab03c Preview build from MetaMask/core#9298 (feat/pay-subsidized-submit) for testing the isSubsidized delegation flag, executeVersion: 2 quote request, and signed metamask execute envelope end-to-end.
… callback and signed metamask envelope for Relay executes - Add optional isSubsidized flag to GetDelegationTransactionCallback - Send signed metamask envelope (executeVersion: 2) for Relay executes; refuse without HMAC signature - Derive isSubsidized from quote.fees.subsidized.amountUsd - Reconcile server requestId after JIT re-quote via mutable clone of frozen quote.original - Extract submitViaRelayExecute into relay-submit-execute.ts - Tolerate undefined maxFeePerGas/maxPriorityFeePerGas in normalizeParams
…utcome, derive execute error prefix - Set metamask.executeVersion: 2 on Relay execute quote requests so intents-api activates the v2 subsidized flow (was a dead type field) - Restore shared RelayCompletionOutcome import from ./types; remove duplicate local definition in relay-submit.ts - Use RELAY_EXECUTE_ERROR_PREFIX constant in execute throws instead of hardcoding the 'Relay: Execute: ' literal; outer wrapper composes the 'Relay: ' prefix
- Wrap submitViaRelayExecute body in a single try/catch that applies RELAY_EXECUTE_ERROR_PREFIX via prefixError, instead of prefixing each throw individually - Plain error messages in the inner helpers; remove the redundant inner try/catch around submitRelayExecute
…rent quote Build the delegation transaction's txParams (to, value, data) from the current quote's nested transactions before requesting the delegation transaction on Relay executes, instead of spreading potentially stale txParams from a previous quote. Single nested transaction is used directly; multiple are wrapped into an atomic ERC-7821 batch. Also export generateEIP7702BatchTransaction from @metamask/transaction-controller to build the ERC-7821 execute(mode, calls) batch.
380bb5c to
fd072cb
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 fd072cb. Configure here.
| }; | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Subsidized flag omitted prepended delegation
Medium Severity
For subsidized Relay execute with a post-quote account override, buildDelegatedOriginalParams still calls getDelegationTransaction without isSubsidized, while the later execute path passes isSubsidized: true. The prepended redemption calldata can then disagree with the subsidized caveat set used for the outer execute delegation.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit fd072cb. Configure here.
## Explanation Release `1111.0.0` with version bumps for: - **`@metamask/transaction-controller`** `68.3.0` → `68.4.0` (minor) - **`@metamask/transaction-pay-controller`** `24.0.0` → `24.0.1` (patch) ### `@metamask/transaction-controller@68.4.0` #### Added - Export `generateEIP7702BatchTransaction` utility for building an ERC-7821 `execute(mode, calls)` batch transaction from a list of nested transactions ([MetaMask#9298](MetaMask#9298)) ### `@metamask/transaction-pay-controller@24.0.1` #### Changed - Bump `@metamask/assets-controller` from `^10.1.0` to `^10.2.0` ([MetaMask#9450](MetaMask#9450)) - Bump `@metamask/assets-controllers` from `^109.3.1` to `^109.4.0` ([MetaMask#9450](MetaMask#9450)) - Bump `@metamask/transaction-controller` from `^68.3.0` to `^68.4.0` ([MetaMask#9456](MetaMask#9456)) ### Dependency updates 15 packages had their `@metamask/transaction-controller` dependency range updated from `^68.3.0` to `^68.4.0`, with corresponding changelog entries under `[Unreleased]` (`earn-controller` and `perps-controller` are omitted as they only consume `transaction-controller` as a `devDependency` — matching precedent from prior releases). ## References - [MetaMask#9298](MetaMask#9298) — Export `generateEIP7702BatchTransaction` (transaction-controller) - [MetaMask#9450](MetaMask#9450) — Bump assets-controller/assets-controllers (transaction-pay-controller) ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > The change propagates a new transaction-controller minor across many packages that touch transaction flows; 68.4.0 is additive but wide blast radius warrants careful consumer integration testing. > > **Overview** > **Monorepo release `1111.0.0`** that cuts **`@metamask/transaction-controller` `68.4.0`** and **`@metamask/transaction-pay-controller` `24.0.1`**, and aligns dependents on the new transaction-controller range. > > **`@metamask/transaction-controller@68.4.0`** documents and ships the **`generateEIP7702BatchTransaction`** export (ERC-7821 `execute(mode, calls)` batch tx from nested transactions). Package version and changelog section **`[68.4.0]`** are added; root monorepo version moves **`1110.0.0` → `1111.0.0`**. > > **Dependency sweep:** many workspace packages (assets, bridge, client-utils, EIP-5792, gator-permissions, phishing, smart-transactions, wallet, etc.) bump **`@metamask/transaction-controller`** from **`^68.3.0`** to **`^68.4.0`** with matching **`[Unreleased]`** changelog lines; **`yarn.lock`** is updated. **`transaction-pay-controller`** patch **`24.0.1`** records the transaction-controller bump alongside its existing asset dependency updates. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f98dc13. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
|
@metamaskbot publish-preview |
1 similar comment
|
@metamaskbot publish-preview |
…538ab03c Preview build from MetaMask/core#9298 (feat/pay-subsidized-submit) for testing the isSubsidized delegation flag, executeVersion: 2 quote request, and signed metamask execute envelope end-to-end.
…538ab03c Preview build from MetaMask/core#9298 (feat/pay-subsidized-submit) for testing the isSubsidized delegation flag, executeVersion: 2 quote request, and signed metamask execute envelope end-to-end.
…538ab03c Preview build from MetaMask/core#9298 (feat/pay-subsidized-submit) for testing the isSubsidized delegation flag, executeVersion: 2 quote request, and signed metamask execute envelope end-to-end.


Explanation
What
The Relay
/executepath now requires a signedmetamaskenvelope and opts into execute v2. Execute submissions carrymetamask: { isSubsidized, quoteRequest, signature }— the HMAC token minted by the intents-api — and are refused without it. ThegetDelegationTransactioncallback gains an optionalisSubsidizedflag so the delegation can select the subsidized caveat set.How
RelayExecuteRequestcarriesmetamask: { isSubsidized, quoteRequest, signature };submitViaRelayExecutethrows ifmetamask.signatureis absent.metamask.executeVersion: 2.isSubsidizedon the delegation callback.getDelegationTransactionacceptsisSubsidized?: boolean(derived fromquote.fees.subsidized), letting the callback select the subsidized caveat set.txParams(to,value,data) are rebuilt from the current quote's nested transactions — a single nested transaction is used directly; multiple are wrapped into an atomic ERC-7821 batch via the newly exportedgenerateEIP7702BatchTransactionfrom@metamask/transaction-controller.quote.original(state is frozen by Immer), so completion polling targets the re-quoted request.References
Checklist
Note
High Risk
Breaking callback/API changes and signed execute envelopes affect money movement and EIP-7702 delegation; incorrect txParams or caveat selection could mis-submit or fail subsidized executes.
Overview
Updates the Relay EIP-7702
/executepath for execute v2: quote requests on enabled chains now sendmetamask: { executeVersion: 2 }, and execute POSTs require a signedmetamaskenvelope (isSubsidized,quoteRequest,signature) or submission fails.getDelegationTransactiongains an optionalisSubsidizedflag (from subsidized quote fees) so clients can pick the right delegation caveat set. Execute flow is moved intosubmitViaRelayExecute, which rebuildstxParamsfrom the current quote calls (not stale meta)—one call used as-is, multiple wrapped via newly exportedgenerateEIP7702BatchTransactionfrom@metamask/transaction-controller—then posts delegation data to Relay. After execute, the first steprequestIdis updated from the server response via a mutable clone ofquote.originalso status polling stays correct.Minor relay submit tweaks: optional EIP-1559 fields when missing from quote data, and execute tests consolidated into the new module.
Reviewed by Cursor Bugbot for commit fd072cb. Bugbot is set up for automated code reviews on this repo. Configure here.