Skip to content

Conversation

@matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Nov 20, 2025

Explanation

Minor optimisations to addTransaction and addTransactionBatch methods:

  • Don't await initial gas limit and gas fee estimation if skipInitialGasEstimate set.
  • Skip EIP-7702 request and upgrade check if disableUpgrade set.
  • Do not wait for delegationAddress and instead update asynchronously.
  • Skip unnecessary eth_getCode requests when determining transaction type.
  • Only decode transfer recipient for first time interaction validation if transaction type suitable.

References

Related to #6165

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
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Speeds up addTransaction/addTransactionBatch by allowing async gas estimation and skipping EIP-7702 upgrade checks, plus tighter type handling and first‑time interaction optimizations.

  • Transaction add flow (performance):
    • Add skipInitialGasEstimate to addTransaction and addTransactionBatch; when set, skip blocking gas calc and update gas fields asynchronously.
    • Resolve delegationAddress asynchronously post-add; remove from initial snapshot, update later.
  • Batch (EIP-7702) changes:
    • Add disableUpgrade to TransactionBatchRequest; when set, bypass upgrade check and avoid type 0x4 (setCode) path.
    • Propagate skipInitialGasEstimate from batch to underlying addTransaction.
    • Use provided nested transaction type directly; only infer when not supplied.
  • First-time interaction:
    • Only decode recipient from data when type is tokenMethodTransfer or tokenMethodTransferFrom; otherwise fall back to to.
  • Misc:
    • Import noop to safely swallow async errors; minor test updates and slight coverage threshold tweak.
    • Changelog updated accordingly.

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

@matthewwalsh0
Copy link
Member Author

@metamaskbot publish-preview

@github-actions
Copy link
Contributor

Preview builds have been published. See these instructions for more information about preview builds.

Expand for full list of packages and versions.
{
  "@metamask-previews/account-tree-controller": "4.0.0-preview-4ed214fa",
  "@metamask-previews/accounts-controller": "35.0.0-preview-4ed214fa",
  "@metamask-previews/address-book-controller": "7.0.1-preview-4ed214fa",
  "@metamask-previews/analytics-controller": "0.0.0-preview-4ed214fa",
  "@metamask-previews/announcement-controller": "8.0.0-preview-4ed214fa",
  "@metamask-previews/app-metadata-controller": "2.0.0-preview-4ed214fa",
  "@metamask-previews/approval-controller": "8.0.0-preview-4ed214fa",
  "@metamask-previews/assets-controllers": "90.0.0-preview-4ed214fa",
  "@metamask-previews/base-controller": "9.0.0-preview-4ed214fa",
  "@metamask-previews/bridge-controller": "62.0.0-preview-4ed214fa",
  "@metamask-previews/bridge-status-controller": "62.0.0-preview-4ed214fa",
  "@metamask-previews/build-utils": "3.0.4-preview-4ed214fa",
  "@metamask-previews/chain-agnostic-permission": "1.2.2-preview-4ed214fa",
  "@metamask-previews/claims-controller": "0.2.0-preview-4ed214fa",
  "@metamask-previews/composable-controller": "12.0.0-preview-4ed214fa",
  "@metamask-previews/controller-utils": "11.16.0-preview-4ed214fa",
  "@metamask-previews/core-backend": "5.0.0-preview-4ed214fa",
  "@metamask-previews/delegation-controller": "2.0.0-preview-4ed214fa",
  "@metamask-previews/earn-controller": "11.0.0-preview-4ed214fa",
  "@metamask-previews/eip-5792-middleware": "2.0.0-preview-4ed214fa",
  "@metamask-previews/eip-7702-internal-rpc-middleware": "0.1.0-preview-4ed214fa",
  "@metamask-previews/eip1193-permission-middleware": "1.0.2-preview-4ed214fa",
  "@metamask-previews/ens-controller": "19.0.0-preview-4ed214fa",
  "@metamask-previews/error-reporting-service": "3.0.0-preview-4ed214fa",
  "@metamask-previews/eth-block-tracker": "15.0.0-preview-4ed214fa",
  "@metamask-previews/eth-json-rpc-middleware": "22.0.0-preview-4ed214fa",
  "@metamask-previews/eth-json-rpc-provider": "6.0.0-preview-4ed214fa",
  "@metamask-previews/foundryup": "1.0.1-preview-4ed214fa",
  "@metamask-previews/gas-fee-controller": "26.0.0-preview-4ed214fa",
  "@metamask-previews/gator-permissions-controller": "0.6.0-preview-4ed214fa",
  "@metamask-previews/json-rpc-engine": "10.2.0-preview-4ed214fa",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.8-preview-4ed214fa",
  "@metamask-previews/keyring-controller": "25.0.0-preview-4ed214fa",
  "@metamask-previews/logging-controller": "7.0.1-preview-4ed214fa",
  "@metamask-previews/message-manager": "14.1.0-preview-4ed214fa",
  "@metamask-previews/messenger": "0.3.0-preview-4ed214fa",
  "@metamask-previews/multichain-account-service": "4.0.0-preview-4ed214fa",
  "@metamask-previews/multichain-api-middleware": "1.2.4-preview-4ed214fa",
  "@metamask-previews/multichain-network-controller": "3.0.0-preview-4ed214fa",
  "@metamask-previews/multichain-transactions-controller": "7.0.0-preview-4ed214fa",
  "@metamask-previews/name-controller": "9.0.0-preview-4ed214fa",
  "@metamask-previews/network-controller": "26.0.0-preview-4ed214fa",
  "@metamask-previews/network-enablement-controller": "4.0.0-preview-4ed214fa",
  "@metamask-previews/notification-services-controller": "21.0.0-preview-4ed214fa",
  "@metamask-previews/permission-controller": "12.1.1-preview-4ed214fa",
  "@metamask-previews/permission-log-controller": "5.0.0-preview-4ed214fa",
  "@metamask-previews/phishing-controller": "16.0.0-preview-4ed214fa",
  "@metamask-previews/polling-controller": "16.0.0-preview-4ed214fa",
  "@metamask-previews/preferences-controller": "22.0.0-preview-4ed214fa",
  "@metamask-previews/profile-sync-controller": "27.0.0-preview-4ed214fa",
  "@metamask-previews/rate-limit-controller": "7.0.0-preview-4ed214fa",
  "@metamask-previews/remote-feature-flag-controller": "2.0.1-preview-4ed214fa",
  "@metamask-previews/sample-controllers": "4.0.0-preview-4ed214fa",
  "@metamask-previews/seedless-onboarding-controller": "7.0.0-preview-4ed214fa",
  "@metamask-previews/selected-network-controller": "26.0.0-preview-4ed214fa",
  "@metamask-previews/shield-controller": "3.0.0-preview-4ed214fa",
  "@metamask-previews/signature-controller": "37.0.0-preview-4ed214fa",
  "@metamask-previews/subscription-controller": "5.0.0-preview-4ed214fa",
  "@metamask-previews/token-search-discovery-controller": "4.0.0-preview-4ed214fa",
  "@metamask-previews/transaction-controller": "62.0.0-preview-4ed214fa",
  "@metamask-previews/transaction-pay-controller": "9.0.0-preview-4ed214fa",
  "@metamask-previews/user-operation-controller": "41.0.0-preview-4ed214fa"
}

@matthewwalsh0
Copy link
Member Author

@metamaskbot publish-preview

@matthewwalsh0 matthewwalsh0 changed the title perf: optimise adding transactions perf: speed up adding transactions Nov 20, 2025
@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review November 20, 2025 22:32
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners November 20, 2025 22:32
@matthewwalsh0 matthewwalsh0 added this pull request to the merge queue Nov 21, 2025
Merged via the queue into main with commit 216b0a6 Nov 21, 2025
276 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/mm-pay-perf branch November 21, 2025 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants