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

refactor: remove message managers from signature controller #4785

Merged

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Oct 10, 2024

Explanation

In order to greatly simplify future maintenance and readability of the SignatureController logic, this PR completely removes any usage of the @metamask/message-manager package.

This has intentionally been done as backwards compatible as possible meaning there should be zero functional breaking changes, and only very minor breaking changes due to alternate property types.

The state and public function signatures are unchanged, and the only addition is the primary usage of a signatureRequests object to include all message / request data directly in the state, to avoid reliance on the legacy messages getter.

The legacy state properties are automatically updated whenever the signatureRequests state is updated, and all legacy state and getters have been marked as deprecated.

References

Fixes #1930
Related to #27787 (Extension Adoption)

Changelog

See updated changelogs for signature-controller and message-manager.

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

Add initial unit tests.
Remove unnecessary types.
Add SIWE support.
Add signing options support.
Set origin and request ID.
Throw custom reject error.
Mock individual messenger actions.
Add additional unit tests.
Copy link

socket-security bot commented Oct 10, 2024

No dependency changes detected. Learn more about Socket for GitHub ↗︎

👍 No dependency changes detected in pull request

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review October 11, 2024 12:49
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners October 11, 2024 12:49
Split large processSignatureRequest method.
Always finish in switch statement.
Add unit tests for emitted events.
@MetaMask MetaMask deleted a comment from github-actions bot Oct 15, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Oct 15, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Oct 15, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Oct 15, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Oct 15, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Oct 15, 2024
@MetaMask MetaMask deleted a comment from github-actions bot Oct 15, 2024
@matthewwalsh0
Copy link
Member Author

@metamaskbot publish-preview

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/accounts-controller": "18.2.2-preview-8c68b2ec",
  "@metamask-previews/address-book-controller": "6.0.1-preview-8c68b2ec",
  "@metamask-previews/announcement-controller": "7.0.1-preview-8c68b2ec",
  "@metamask-previews/approval-controller": "7.1.0-preview-8c68b2ec",
  "@metamask-previews/assets-controllers": "38.3.0-preview-8c68b2ec",
  "@metamask-previews/base-controller": "7.0.1-preview-8c68b2ec",
  "@metamask-previews/build-utils": "3.0.1-preview-8c68b2ec",
  "@metamask-previews/chain-controller": "0.1.3-preview-8c68b2ec",
  "@metamask-previews/composable-controller": "9.0.1-preview-8c68b2ec",
  "@metamask-previews/controller-utils": "11.3.0-preview-8c68b2ec",
  "@metamask-previews/ens-controller": "14.0.1-preview-8c68b2ec",
  "@metamask-previews/eth-json-rpc-provider": "4.1.4-preview-8c68b2ec",
  "@metamask-previews/gas-fee-controller": "20.0.1-preview-8c68b2ec",
  "@metamask-previews/json-rpc-engine": "9.0.3-preview-8c68b2ec",
  "@metamask-previews/json-rpc-middleware-stream": "8.0.3-preview-8c68b2ec",
  "@metamask-previews/keyring-controller": "17.2.2-preview-8c68b2ec",
  "@metamask-previews/logging-controller": "6.0.1-preview-8c68b2ec",
  "@metamask-previews/message-manager": "10.1.1-preview-8c68b2ec",
  "@metamask-previews/name-controller": "8.0.1-preview-8c68b2ec",
  "@metamask-previews/network-controller": "21.0.1-preview-8c68b2ec",
  "@metamask-previews/notification-controller": "7.0.0-preview-8c68b2ec",
  "@metamask-previews/notification-services-controller": "0.9.0-preview-8c68b2ec",
  "@metamask-previews/permission-controller": "11.0.2-preview-8c68b2ec",
  "@metamask-previews/permission-log-controller": "3.0.1-preview-8c68b2ec",
  "@metamask-previews/phishing-controller": "12.0.3-preview-8c68b2ec",
  "@metamask-previews/polling-controller": "10.0.1-preview-8c68b2ec",
  "@metamask-previews/preferences-controller": "13.0.3-preview-8c68b2ec",
  "@metamask-previews/profile-sync-controller": "0.9.7-preview-8c68b2ec",
  "@metamask-previews/queued-request-controller": "5.1.0-preview-8c68b2ec",
  "@metamask-previews/rate-limit-controller": "6.0.1-preview-8c68b2ec",
  "@metamask-previews/selected-network-controller": "18.0.1-preview-8c68b2ec",
  "@metamask-previews/signature-controller": "19.1.0-preview-8c68b2ec",
  "@metamask-previews/transaction-controller": "37.2.0-preview-8c68b2ec",
  "@metamask-previews/user-operation-controller": "15.0.1-preview-8c68b2ec"
}

@matthewwalsh0 matthewwalsh0 merged commit 08b9c52 into main Oct 16, 2024
116 checks passed
@matthewwalsh0 matthewwalsh0 deleted the refactor/signature-controller-remove-message-managers branch October 16, 2024 13:15
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