fix: Fix hardware wallet MMPay on EIP-7702 chains by gating 7702 paths on account keyring capability#8388
fix: Fix hardware wallet MMPay on EIP-7702 chains by gating 7702 paths on account keyring capability#8388
Conversation
|
@metamaskbot publish-preview |
…account keyring capability
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
packages/transaction-pay-controller/src/strategy/across/across-submit.ts
Show resolved
Hide resolved
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 bce8c09. Configure here.
| ); | ||
|
|
||
| const useExecute = | ||
| accountSupports7702 && |
There was a problem hiding this comment.
Relay quotes missing gas re-estimation for hardware wallets
Medium Severity
Unlike the across-quotes path, relay-quotes doesn't re-estimate individual gas limits when estimateQuoteGasLimits returns is7702: true but the account is a hardware wallet. The quote stores is7702: true with a single combined gas limit in metamask.gasLimits. When relay-submit later disables 7702 for the hardware wallet, the first batch transaction gets the combined 7702 gas value (meant for all transactions together) and subsequent transactions get undefined gas. The across path explicitly handles this with per-transaction re-estimation, but the relay path does not.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit bce8c09. Configure here.


Explanation
Fix hardware wallet mUSD conversion on EIP-7702 chains by gating 7702 paths on account keyring capability
Summary
KeyringController:accountSupports7702messenger action that checks whether an account's keyring supports EIP-7702 signing (returns true only for HD and simple keyrings, false for hardware wallets like Ledger)useExecuteflag onaccountSupports7702, ensuring the relay API receives non-7702 requests for hardware wallets and returns quotes with proper individual gas limitsauthorizationListandgasLimit7702in relay submission onaccountSupports7702, preventing 7702 batch transaction paths that would failsignEip7702Authorizationon hardware keyringsKeyringControllerAccountSupports7702ActionintoTransactionPayController'sAllowedActionsso the messenger call is available at each decision pointReferences
Checklist
Note
Medium Risk
Touches quote generation and transaction submission logic for Relay/Across flows; incorrect gating could change gas estimation behavior or disable batching on EIP-7702 chains. Changes are narrowly scoped and covered by new unit tests, lowering regression risk.
Overview
Introduces
KeyringController:accountSupports7702(andaccountSupports7702) to determine whether an account can sign EIP-7702 authorizations (true for HD/simple keyrings, false otherwise).Updates MMPay Relay and Across strategies to gate all 7702-only behaviors on that capability: Relay quote requests only enable execute/origin overhead when supported; Relay submit only includes
authorizationList/gasLimit7702and otherwise disables 7702 batching; Across quotes re-estimate per-transaction gas limits when a batch estimate indicates 7702 but the account can’t use it. Adds corresponding messenger wiring and unit tests, plus changelog entries.Reviewed by Cursor Bugbot for commit bce8c09. Bugbot is set up for automated code reviews on this repo. Configure here.