Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support type 4 transactions #5285

Merged
merged 18 commits into from
Feb 7, 2025
Merged

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Feb 5, 2025

Explanation

Support EIP-7702 / type 4 transactions including authorizationList via the TransactionController.

Specifically:

  • Upgrade ethereumjs/tx and ethereumjs/common.
  • Add setCode to TransactionEnvelopeType.
  • Add authorizationList to TransactionParams.
  • Complete and sign all authorizations using KeyringController before signing transaction.
  • Prevent type 4 transactions if origin is not ORIGIN_METAMASK.
  • Validate authorizationList property before approval request.
  • Centralise prepare and serialization logic into prepare.ts utils.
  • Encapsulate all EIP-7702 specific logic in new eip7702.ts util.

Currently using a local messenger action type for the signing. To be replaced once available in the KeyringController.

References

Fixes #4095

Changelog

@metamask/transaction-controller

  • ADDED: Add setCode to TransactionEnvelopeType.
  • ADDED: Add authorizationList to TransactionParams.
  • CHANGED: Bump ethereumjs/tx to ^5.4.0.
  • CHANGED: Bump ethereumjs/common to ^4.4.0.

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 highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Copy link

socket-security bot commented Feb 5, 2025

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

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

Ignoring: npm/@ethereumjs/[email protected], npm/@ethereumjs/[email protected], npm/@ethereumjs/[email protected], npm/@ethereumjs/[email protected]

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@matthewwalsh0
Copy link
Member Author

@SocketSecurity ignore-all

@matthewwalsh0
Copy link
Member Author

@metamaskbot publish-preview

Copy link
Contributor

github-actions bot commented Feb 6, 2025

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

Expand for full list of packages and versions.
{
  "@metamask-previews/accounts-controller": "22.0.0-preview-2a6578b3",
  "@metamask-previews/address-book-controller": "6.0.2-preview-2a6578b3",
  "@metamask-previews/announcement-controller": "7.0.2-preview-2a6578b3",
  "@metamask-previews/approval-controller": "7.1.2-preview-2a6578b3",
  "@metamask-previews/assets-controllers": "47.0.0-preview-2a6578b3",
  "@metamask-previews/base-controller": "7.1.1-preview-2a6578b3",
  "@metamask-previews/build-utils": "3.0.2-preview-2a6578b3",
  "@metamask-previews/composable-controller": "10.0.0-preview-2a6578b3",
  "@metamask-previews/controller-utils": "11.5.0-preview-2a6578b3",
  "@metamask-previews/earn-controller": "0.1.0-preview-2a6578b3",
  "@metamask-previews/ens-controller": "15.0.1-preview-2a6578b3",
  "@metamask-previews/eth-json-rpc-provider": "4.1.8-preview-2a6578b3",
  "@metamask-previews/gas-fee-controller": "22.0.2-preview-2a6578b3",
  "@metamask-previews/json-rpc-engine": "10.0.3-preview-2a6578b3",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.6-preview-2a6578b3",
  "@metamask-previews/keyring-controller": "19.0.5-preview-2a6578b3",
  "@metamask-previews/logging-controller": "6.0.3-preview-2a6578b3",
  "@metamask-previews/message-manager": "12.0.0-preview-2a6578b3",
  "@metamask-previews/multichain": "2.1.0-preview-2a6578b3",
  "@metamask-previews/multichain-transactions-controller": "0.1.0-preview-2a6578b3",
  "@metamask-previews/name-controller": "8.0.2-preview-2a6578b3",
  "@metamask-previews/network-controller": "22.2.0-preview-2a6578b3",
  "@metamask-previews/notification-services-controller": "0.19.0-preview-2a6578b3",
  "@metamask-previews/permission-controller": "11.0.5-preview-2a6578b3",
  "@metamask-previews/permission-log-controller": "3.0.2-preview-2a6578b3",
  "@metamask-previews/phishing-controller": "12.3.1-preview-2a6578b3",
  "@metamask-previews/polling-controller": "12.0.2-preview-2a6578b3",
  "@metamask-previews/preferences-controller": "15.0.1-preview-2a6578b3",
  "@metamask-previews/profile-sync-controller": "6.0.0-preview-2a6578b3",
  "@metamask-previews/queued-request-controller": "9.0.0-preview-2a6578b3",
  "@metamask-previews/rate-limit-controller": "6.0.2-preview-2a6578b3",
  "@metamask-previews/remote-feature-flag-controller": "1.3.0-preview-2a6578b3",
  "@metamask-previews/selected-network-controller": "21.0.0-preview-2a6578b3",
  "@metamask-previews/signature-controller": "23.2.0-preview-2a6578b3",
  "@metamask-previews/token-search-discovery-controller": "1.0.0-preview-2a6578b3",
  "@metamask-previews/transaction-controller": "44.1.0-preview-2a6578b3",
  "@metamask-previews/user-operation-controller": "23.0.0-preview-2a6578b3"
}

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review February 6, 2025 13:27
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners February 6, 2025 13:27
@matthewwalsh0 matthewwalsh0 enabled auto-merge (squash) February 7, 2025 15:20
@matthewwalsh0 matthewwalsh0 merged commit c2a4312 into main Feb 7, 2025
127 checks passed
@matthewwalsh0 matthewwalsh0 deleted the feat/type-4-transactions branch February 7, 2025 15:25
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.

3 participants